The first step of every great project is to install Raspberry Pi OS. Fortunately, we've written a guide that shows you how to install Raspberry Pi OS on your Raspberry Pi. Follow the steps to flash Raspberry Pi OS on your micro SD card, then jump back to this guide to continue.
In an effort to save space, I'm again going to refer you to the guide we've written that shows you how to use the LED Matrix Panel with your Raspberry Pi.
Refer to this guide if you need help setting up the LED panel hardware. Since we're going to use Docker to run the application, you won't need to install the dependencies yourself. So please use the above guide to get your hardware set up only.
What you need
This is one area where you can save a little bit of money. We referred you to a reliable panel made by Adafruit. There are cheaper alternatives on Amazon if you're willing to experiment.
Keep in mind that the 3D-printed case is optional. If you've got a 3D printer and want to give it a shot, great! It will certainly make the project look more professional.
Since the Raspberry Pi doesn't ship with a physical power button, you may want to add your own. This isn't required, but it is a good (and safe) way to shut down your Pi when you're not using it (like if your spouse gets tired of the Bitcoin price glowing at night).
We've written a solid guide that shows you how to add a power button to your Raspberry Pi. I'm linking to the guide here because we need to do some work before wrapping up the hardware portion of this guide.
If you're not going to add the power button, skip ahead to the next step.
Solder male header pins
The RGB Matrix Bonnet attaches to the entire GPIO header on the Pi, but it does expose some GPIO holes that you can solder pins or wires to. In this case, you only need to solder pins to the
GND holes, but for simplicity, I soldered a 2x2 pin square that covers both of the pins I need (see the image below).
Drill a hole in the case
If you're not using a case, you can skip this piece and just let the button dangle! But if you're using the case we recommended, you'll need to drill a 1/2" hole to attach the power button. Again see the image for details.
The location of the button doesn't matter as long as you've got male-to-female jumper cables to extend the leads to the Pi. I put my power button on the Pi-side at the very top.
It's worth noting at this point that the power button we sell does not fit in the hole that the case provides. If you'd like to buy a smaller button, you can skip drilling the hole. But I do recommend using the power button we sell because it comes from a reputable source and you get to support your favorite DIY site :)
Connect to the leads to the bonnet
When you're ready to close up the case, attach the leads (or the jumper wires) from the button to the
GND pins on the bonnet.
If you're using the case, now is the time to secure it. To do so, you'll need to place the panel face down. Then drop two M3 nuts into the brackets on each side of the panel.
Now place the case on top of the panel, and use the M3 screws to secure it.
In order to get up to date price data, you'll need access to a reliable cryptocurrency data API. For this project, I chose to use CoinMarketCap because it has a good free version. To get what you need for this project, simply sign up for the free version at https://coinmarketcap.com/api/ and copy the API key that is automatically created for you.
A note on API usage limits
The CoinMarketCap API measures usage in terms of credits and the limits are daily. For this project, a single API request costs a single credit, and the free version gives you 333 credits per day. This would allow you to make one request every five minutes or so.
If you need more up-to-date data, I'm sure CoinMarketCap wouldn't mind you upgrading to increase your limits :)
Now it's time to log in to your Pi and install the software. To begin, you'll need to open your Terminal application and SSH into your Raspberry Pi.
If you've got multiple Pi's on your network, or the hostname doesn't work for some reason, you'll need to find your Raspberry Pi's IP address and use it instead.
Next you need to install Docker on your Pi. To install Docker, run the following:
curl -sSL https://get.docker.com | sh
Docker allows us to run our application as a software container. For the purpose of this project, it allows us to define all of our dependencies in a Dockerfile and build the application as an image. This saves you from having to run a bunch of commands to install packages directly (among other advantages).
Git should already be installed on your Raspberry Pi, but if it's not you can install it using
apt-get install git.
Clone the crypto-ticker repository with the following command:
git clone https://github.com/Howchoo/crypto-ticker.git
To run the application, you'll need to add your custom settings.env file. This file will be mounted onto the running container and provide the application with your API key, the cryptocurrency symbols you want to track, and a few other things.
You'll need to
cd into the crypto-ticker directory:
Then use your favorite text editor to create the settings.env file and add the following:
CMC_API_KEY=<your coinmarketcap api key goes here> SYMBOLS=BTC,ETH
You can customize the symbols you want to fetch. Simply go to coinmarketcap.com and find the ticker symbols for the cryptocurrencies of interest.
If you want to test this first on CoinMarketCap's sandbox API, you can add the following:
You can also override the
SLEEP, and a few other variables. But please refer to the repositories README.md file for the latest settings and default values.
With your settings.env file in place, you're ready to start the application. Run the following:
docker-compose up -d
This command will take a few minutes because it needs to read from docker-compose.yml, build the image, install the dependencies, and start the application.
It's worth noting that the ticker service in the docker-compose file specifies that we want to restart the container "always". This means that if the container dies, it will be restarted automatically. It also means that when the machine restarts, the container will start up as well. This is an easy way to run the crypto-ticker application on boot.
The application takes a few seconds to get started, but once it does you should see your crypto prices flash before your very eyes. The panel will scroll through the crypto symbols you specified in your settings.env file, and it will update prices every five minutes.
If you're a software developer and want to contribute to this project, I'd be happy to have you participate. Feel free to fork the repository and submit a pull request.
Here are some ideas for improvements:
- Add cryptocurrency icons to the display
- Add a "Loading" screen when the Pi is booting
- Add some animation to transition between screens, maybe even allow the user to specify the transition