Raspberry Pi Cryptocurrency Tracker

by Progetto Company in Circuits > Raspberry Pi

2226 Views, 16 Favorites, 0 Comments

Raspberry Pi Cryptocurrency Tracker

cryptotracker_thumbnail.jpg
Raspberry Pi Cryptocurrency Price Tracker Demo
PXL_20210804_203454639.jpg

DISCLAIMER: CERTAIN COMPONENTS USED IN THIS TUTORIAL ARE FOR SALE BY THE AUTHOR

During this tutorial, you'll create a simple cryptocurrency tracker using a Raspberry Pi. a 16x2 I2C LCD, and a One Pin Keypad, along with a few other miscellaneous components. Since this project uses Python to connect to the CoinGecko API, you can easily add support for other cryptocurrencies beyond the three (Bitcoin, Ethereum and Litecoin) included in the code for this tutorial. Be sure to see the video above for a demo!

Supplies

To build this tracker, you'll need:

- A Raspberry Pi of some variety with the necessary accessories to program it and access the internet

- Plenty of male to male and male to female jumper wires

- A half-pint breadboard or larger

- An I2C 16x2 LCD: https://www.tindie.com/products/Progetto/16x2-lcd-display-with-pre-soldered-i2c-backpack/ (either colour will work, though I used the blue version with white text)

- A bidirectional logic level converter: https://www.tindie.com/products/Progetto/4-channel-bidirectional-logic-level-converter/

- A One Pin Keypad and 4x4 Keypad: https://www.tindie.com/products/Progetto/one-pin-keypad/ (make sure you include the keypad using the product option)

- An ADS1115 Module (from Adafruit or a clone)

Familiarize Yourself With the Components

PXL_20210723_203758172_exported_66.jpg
PXL_20210723_203922568_exported_199.jpg

This tutorial assumes you have set up your One Pin Keypad using this tutorial: https://www.instructables.com/One-Pin-Keypad-Raspberry-Pi-Usage-Guide/ having already installed the One Pin Keypad python package, wired the One Pin Keypad using the ADS1115 and have access to your array of calibrated thresholds.

This tutorial also assumes you have followed this amazing tutorial by Raspberry Pi Tutorials https://tutorials-raspberrypi.com/control-a-raspberry-pi-hd44780-lcd-display-via-i2c/ so you know your LCD's I2C address, enabled the Raspberry Pi's I2C, and have wired the LCD to your Raspberry Pi using the logic level converter. You will also end up downloading a folder of code called hd44780, keep this handy, we'll be putting the crypto tracker code in there later in the tutorial.

Now is also probably a good time to solder the included male header to your ADS1115 and logic level converter modules if you haven't already!

Wiring

crypto_schematic.JPG
PXL_20210804_191443749.jpg

Having followed the tutorials in the previous step, your calculator should already be wired correctly. But I have included a schematic above just in case. As for power, this project runs fine powered through the Raspberry Pi's USB power port.

Python Package Installation!

PXL_20210723_203658017_exported_33.jpg

Open a terminal window and type the following commands:

sudo apt-get update

then

pip3 install pycoingecko

to install the CoinGecko API package and its necessary dependencies.

Note: you should also have the Progetto-One-Pin-Keypad package installed already if you followed the One Pin Keypad Raspberry Pi tutorial linked in a previous step.

Coding Time!

github_code.JPG

Download or clone the python code for this project from GitHub: https://github.com/ProgettoCompany/Crypto_Price_Tracker

Move crypto_price_tracker.py to the hd77480 folder you should have from the I2C LCD tutorial.

Run the code for this project in a terminal with the following command:

sudo python3 crypto_price_tracker.py

(Optional) Set Up Your Raspberry Pi to Run Your Python Script on Startup

PXL_20210723_204432141.jpg

If you want to use this project without running the python sketch manually by connecting to the Raspberry Pi, you can follow this fantastic instructable by scottkidall: https://www.instructables.com/Raspberry-Pi-Launch-Python-script-on-startup/. Make sure to cd into the hd44780 folder before running the script! If your script has trouble launching, uncomment line 7 in crypto_price_tracker.py to add a 15 second delay to the script as accessing the I/O of the raspberry pi during startup seems to throw an exception:

# Uncomment the line below if you are running this script on startup:
# time.sleep(15)

Conclusion

crypto_conclusion.jpg

Congratulations, you have created your own cryptocurrency price tracker! Feel free to remix and improve this project to your heart's content, maybe add a case, battery power, or add support for more cryptocurrencies!

If you have any questions, comments or concerns, feel free to email me at progettocompany@gmail.com Happy hacking!

John Wolf

Progetto Company