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.
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.
Matrix display magnetically mounted and cabled up.
I’m designing a dashboard for an electric motorcycle I’ve built. How does the display fair outside in direct sunlight?
The display is quite bright but I have not taken it outside to look. In daylight (from windows) it is sufficiently bright to read.
In bright, direct sunlight… It looks horrible, lol. I’ll have to figure out a polarizing filter and a hooded enclosure. Or just scrap it & try a different method.
Aw. Really sorry that it didn’t work out. Let me know what you end up doing and post some pics to show your final product!
Here’s a link to the project page I’ve started. The display is part of a larger system I’m designing for EVs. It looks great so far, though I haven’t mounted it on the motorcycle yet.
Thanks for posting this Neal. Looks really cool!
Can You send me changes in thematrix.py file to fit your code for 64×32 adafruit panel?
All the code in this script is set for image height of 32 LEDs/pixels. So you are good there.
If you look at the code https://github.com/WebBreacher/thematrix/blob/master/thematrix.py, line 70 has the default width set to 2200 for text and image. Try reducing those to about 1100. Also, at the bottom, each time the CreateImage() function is called, it passes the width of the text and image to the function. It is the first 2 numeric params. Try changing those.
Can you get the matrix to display any of the content? Perhaps the first “MatrixFill(0x00AA00, 1) #Fill the matrix with a single color” could be uncommented and tried to see if the script sends anything to the matrix.
Finally, do you have all the prereq software to drive the matrix downloaded and local to the script?
Thank you very much for your answer! Already yesterday I checked, the panel fills the pattern (the first line of MatrixFill). This function works ok. Unfortunately, after the changes proposed by you is the same error.
With all of this I can handle, but with the panel rgb I contact two days and I’m not a programmer. Maybe You have any simple python or php program to send text to panel? I have raspberry pi and adafruit rgb hat.
Let me see if I can get you that simple script. You can try the https://learn.adafruit.com/nextbus-transit-clock-for-raspberry-pi/overview project to see if your panel works and it is my code that is broken (which I think you will be able to confirm). You may also wish to try the Adafruit forums to figure this out. I will work on this when I get some time.
I started the panel with another script and it works Ok, I changed it only for my needs.
I like your script but now I have no free time. Maybe someday I will return to him and preferable to try to run.
That looks great Jack! Mind sharing the link to the code you used to make the display content?
I followed (I think!) your instructions above, but made an adjustment for a 32 x 32 display. Line 70 has had the two 2200 parameters set to 550, yet I still get the error pointed out by Jack. The MatrixFill line, when it’s the only routine called, works just fine, giving me a green display. Can you explain the significance of the parameters passed to the CreatImage() function and how different values affect the display?
I should mention that I have plenty of programming experience, but none if it with Python, so I’m on a bit of a learning curve!
Thanks for the comments Jack and Michael. I need to look into this with my panel (which has been off for a while) next week and see if I can troubleshoot more. It may be that the code from Adafruit has changed and so I need to change my code to match. I will look into this.
You may also want to see if the panel works with https://learn.adafruit.com/nextbus-transit-clock-for-raspberry-pi/overview. Just to get content flowing across the screen(s). I will look into this gents.
Michael…the 2200 was a number/param I passed to the function for the image’s width. Since the matrices only display images, I created text, then transform it into an image and then display it. For long text, giving it a width longer than the number of LEDs in the width of your panel allows a kind of buffering. So picture yourself looking straight ahead and someone moving a long picture from left to right across your vision. That is what is happening in this script. The LEDs stay constant and we “drag” a picture across the screen to show it.