So at work we have one of those SOC World Clocks that looks a little bit like the one below (and yes I know that London is not spelled with that many “o” letters…I found this on the Internet.). It works OK but has to be reprogrammed for daylight savings time, it loses time and, well, it is kind of single purpose. It is 2015 and I thought that we should have something more flexible, more functional and really I have always wanted to play with LED matrices. So my goal was, at the very least, to replace this old wall relic with something from this century.
I looked at several places and finally settled on buying the equipment needed for this project at Adafruit. Their tutorials and videos are very helpful and I had high hopes that their gear would just work. It did! Below is what I chose for my project. You can definitely alter it for yours.
I bought it all for about $200 (minus the Pi) and did the soldering (see below). I cabled everything up and it just worked. Ahhhhhh. A great feeling.
First thing I sourced was the appropriate LED matrix. I knew I wanted something that could hang on the wall and could be seen across a 10-20 meter room. I also wanted something that had the LEDs in close formation (pitch) so that the content displayed on the matrix looked sharp. The Adafruit 64×32 LED Matrix, 4mm looked to be just what I wanted AND it could be chained to other 64×32 matrices to make a longer display. I bought 2 of these at roughly $80 each.
The next piece was to get something to interface with my Raspi2. Adafruit has that covered too with their Adafruit RGB Matrix HAT + RTC for Raspberry Pi – Mini Kit. At $25 it is well worth it for someone like me that is more interested in using the LED matrix than figuring pin-outs and such.
WARNING: You will need to do some simple soldering with this kit. So if you don’t have that equipment or those skills, beware.
The benefit of the HAT is that I don’t have to connect every single pin to every other one. There are easy cables to plug in that “just work”. So you do the soldering (instructions are here) and then cable everything up with the included cables.
The Pi is not able to run the LED matrices without an external power supply. Knowing I wanted to run a couple of matrices off of the HAT, I chose a 10A (a little overkill) 5v power supply for about $25. I found out later that this power supply will actually power 2 64×32 LED matrices, the HAT AND my Pi.
My goal was to be able to display streaming/moving text on the matrices. Adafruit got me started with their AMAZING documentation. Step 6 in the “Driving the Matrices” section describes the python and other software you need to download/install in order to get your matrices up and running. I followed the directions and it just worked (sensing a trend here?).
I took the demo python code from the https://github.com/adafruit/rpi-rgb-led-matrix download (in the previous steps this was downloaded and compiled) and started tinkering. The demos show how to move content on the matrices and also how to draw, display images and they hint at writing text.
My code (available on my GitHub site https://github.com/WebBreacher/thematrix) is the result of my lessons learned. It:
- Has a function to move text left to right or right to left
- Has a function to move text up or down
- Generates an “image” from text you choose and then displays that on the display
- Has a “world clock” function in it to generate the time in different time zones
[UPDATE] October 2015
I’ve added several features to the code. One pulls the local food truck data from a site on the Internet and displays it on the panel. The other interfaces with the API at Washington DC area Metro Train web site and pulls the time to next train for a certain station. Check out the YouTube video below to see it in action.
What does it look like?
And a video of it working: