Giter Club home page Giter Club logo

rpi-btc-ticker's Introduction

rpi-btc-ticker

rpi-btc-ticker is a Python-based Raspberry Pi cryptocurrency ticker using a 2.13" e-Ink display.

This program is geared towards ease-of-use. It is not a finished product and there are more features to be added. A section in this README on how you can customize the display will be made eventually.

Installation

First, clone the repository:

git clone https://github.com/nickshanks347/rpi-btc-ticker.git

Install dependencies:

sudo apt update
sudo apt install wiringpi python3-pip python3-pil python3-numpy

Install BCM2835 drivers:

wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.70.tar.gz
tar zxvf bcm2835-1.70.tar.gz
cd bcm2835-1.70/
sudo ./configure
sudo make
sudo make check
sudo make install

Turn on SPI via sudo raspi-config (reboot after doing this step):

Interfacing Options -> SPI

Now cd to rpi-btc-ticker and install the pip requirements:

cd rpi-btc-ticker
pip3 install -r requirements.txt
pip3 install ./e-Paper/RaspberryPi_JetsonNano/python/

Write the config file (from example config):

cp config_example.cfg config.cfg

Usage

Included in the repository is a config_example.cfg file. It has this format:

[main]
coin: bitcoin,litecoin,ethereum
fiat: gbp
refresh_interval: 1

coin specifies which three cryptocurrencies you would like displayed. The order entered in the config file will be the order they appear on the display. Please ensure to keep the same format, and only include commas (no spaces) between each coin.

  • The coin terms entered in the config file are used by the program and sent directly to an API. If you would like to know what to put for a certain coin then go to CoinGecko and search for your coin in the top right. Under the Info section, you'll see an entry for API id. Copy this ID and enter this in the config file.
  • Example: Ethereum Classic (https://www.coingecko.com/en/coins/ethereum-classic) has an API id of ethereum-classic.

fiat specifies which fiat currency you would like the program to display. Example: if you have fiat set to gbp in the config file, the program will display what 1 BTC is equal to in £.

refresh_interval is the time between refreshes of the coin prices and any changes to the config file. The unit is seconds, so for 10 minutes you'd write 600.

The config file is read dynamically (it is not loaded into memory). If you want to change the coins/fiat shown, or the refresh interval then you can do so and it'll be re-read at the next refresh time without having to restart the program.


To launch within your terminal window type:

python3 main.py

To launch the service type:

sudo service crypto-ticker start

This will launch the Python program. After a few seconds, you will see the e-Ink display update with your chosen cryptos.

Starting automatically at boot (systemd integration)

We'll utilise systemd to automatically start our service at boot.

First, type sudo nano /etc/systemd/system/crypto-ticker.service and paste the service definition below:

 [Unit]
 Description=crypto-ticker
 After=network.target

 [Service]
 ExecStart=/usr/bin/python3 -u main.py
 WorkingDirectory=/home/pi/rpi-btc-ticker
 StandardOutput=inherit
 StandardError=inherit
 KillSignal=SIGINT
 Restart=always
 User=pi
 Restart=on-failure

 [Install]
 WantedBy=multi-user.target

Please note the ExecStart and WorkingDirectory, change these as needed if you cloned to a different directory.

Now reload systemctl daemon:

sudo systemctl daemon-reload

Now the service is set up, but it's not running. You can run: sudo service crypto-ticker <option>, replacing <option> with either start, stop, restart, disable, enable and status.

To start the program at boot, run sudo service crypto-ticker enable. Run the command with disable to disable at boot.

If you're having issues then run sudo service crypto-ticker restart.

The status option is quite useful as it shows the services status and the last few log entries.

Known Issues

The program rounds the price of each crypto currency to the nearest 2 decimal places. Ultimately this can be turned off but it might cause issues where digits overflow off of the screen. A fix will be found.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache

rpi-btc-ticker's People

Contributors

nickshanks347 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.