This project was created for our 100,000 YouTube subscriber milestone. Watch the video below for an overview of the project, demonstration of what it can do, and a Q&A special at the end.
Combine the LED DisplaysWe're using two 4-in-1 Max7219 8x8 LED displays for this project. Max7219 modules can be daisy chained together to display long messages. The 4-in-1 modules come pre-soldered together, but we need to combine both displays to make one with 8 elements for space to show our cryptocurrency ticker. We snipped the wire ends off some old resistors to make a couple bridges between the two displays.
Each display has an in/out arrow that shows how data flows through the displays. You'll need to wire "out" of display 1 to "in" of display 2.
Both displays were wired together as follows:
- Vcc => Vcc
- Ground => Ground
- DOut => DIn
- CS => CS
- Clock => Clock
The housing consists of a front and back piece that sandwiches the display to hold it in place. Since our 3D printer's bed was too small to print the each side in one piece, we split it into 3 pieces on each side.
Each part has a set of small tabs on each side. You can use these tabs to attach the parts together with some small nuts and bolts or glue them together with plastic-friendly glue. We decided to use nuts and bolts so that we could take the pieces apart if necessary. A small blade was used to clean out some of the extra material that built up inside the tab holes during the printing process.
The top parts were then screwed together with 4 2.5mm nuts and bolts. A pair of tweezers made it easier to hold the small hardware.
Before joining the back parts, we screwed a Raspberry Pi Zero W into the middle piece using 4 2.5mm nuts and bolts. There are 4 counterbored holes on the back so that the bolts can sit flush with the housing. We chose a Raspberry Pi Zero W for this project because it has a small form factor and built-in wifi.
Once the Raspberry Pi was in place, we attached the rest of the back parts with 2.5mm nuts and bolts.
Finally, we slid the LED display into the top part of the housing. One side has a slightly wider frame so that the jumper wires can fit underneath. We made the following connections to the Raspberry Pi:
- VCC => 5V
- GND => GND
- DIN => GPIO 10 (MOSI)
- CSC => GPIO 8 (SPI CE0)
- CLK => GPIO 11 (SPI CLK)
And added 3mm nuts to the 4 extensions on each side of the top piece. These nuts will be used to hold the housing together.
After joining the two halves together, 4 3mm bolts were screwed through the remaining holes in the back of the housing. To fill the gaps at the seam, we wrapped the housing in a long strip of electrical tape.
- Python 2.7
- pip
- Raspbian
Before you run the program, make sure to install dependencies. Navigate to the project directory and run
pip install -r requirements.txt
to install the python dependencies. Enable the SPI driver for the max7219 LED module to work properly.
sudo raspi-config
Scroll down to Advanced Options
(Interfacing Options
on the Pi Zero) and press enter. Scroll down to SPI
, press enter, and select yes
.
Reboot.
The ticker.py
program runs in three different modes: live subscriber counter, live cryptocurrency price, and cryptocurrency ticker.
To run the program in live subscriber mode, you can run the program with the following arguments:
python ticker.py --youtubeApiKey API_KEY --channelId CHANNEL_ID
Where CHANNEL_ID
is replaced with the channel ID from your youtube channel URL. (For instance Hacker House has the channel ID UCEcNXmr7DYq1XxpWHSxaN0w
from https://www.youtube.com/channel/UCEcNXmr7DYq1XxpWHSxaN0w and API_KEY
is replaced with an API key from the YouTube Data API.
You can obtain an API key for the YouTube Data API by visiting the Google developer console. Search for "YouTube Data API" and enable the API. Once the API has been enabled, visit the API settings page and click credentials
in the left rail.
On the credentials page, click Create credentials
and select API Key
.
You can also display the price of your favorite cryptocurrency by using the following arguments:
python ticker.py --crypto ETH
Where ETH
can be replaced with your favorite cryptocurrency symbol. You can obtain the symbol for your cryptocurrency by searching https://coinmarketcap.com/ for it.
To run the LED bar in Cryptocurrency ticker mode, use the following arguments:
python ticker.py --ticker
By default, it shows the prices for a list of 11 cryptocurrencies. You can add more by modifying the cryptos
variable in ticker.py
here. Simply add your symbols to the end of the list.
To run the program on startup, open your rc.local
file with Vim.
sudo vim /etc/rc.local
Press i
to edit, scroll to the line before exit 0
and add
python /full/path/to/ticker.py --ticker
(Or add other options) and press esc
then ZZ
to save and exit.
Once you've loaded the code on the Raspberry Pi, your LED light strip should be ready to run. Simply plug in the Raspberry Pi Zero and let it fetch data.
If nothing happens, make sure it is connected to the internet and not throwing errors in the terminal. You might need to connect to a wifi network or change some of your input arguments if it fails.
If only a few of the max7219 modules turn on, you might need to wire your max7219 modules directly to the power source. See the circuit diagram below for more information about wiring.
You can use 4 displays (instead of the standard 8), but you'll have to modify the number of cascaded elements in ticker.py.
For any other code related issues, leave a comment on this project or on the Github repository and someone should be able to help.
Thank You!Thank you for helping us reach 100,000 YouTube subscribers. We couldn't have done it without your support. The response to our videos so far has been overwhelming positive and we're glad that we have such an active community of makers. Davis and I have a bunch of interesting projects planned for 2018 and we're excited to bring you guys along for the ride!
Cheers,
Aaron @ Hacker Shack
Comments