I took some time this Thanksgiving break to work with Raspberry Pi and a flexible LED display. I love the Pi, as it is a familiar environment, but with opportunities to work with different hardware.
You’ll notice above that the LEDs are filled in top-down, then bottom-up. This is because the LEDs are arranged in series, producing a serpentine pattern. In order to display images easily, I’ll need to map those IDs to an XY grid. I’ll get to that more in the Software section below.
Hardware and Mounting
After thinking about how I could mount the flexible, I settled on a flat, length-wise orientation. I initially thought about mounting it curved in a half-circle, so that part of the display could be viewable from multiple orientations. I knew I wanted to mount the sign on the wall, but having it stick out away from the wall was not ideal for my home. I then looked into mounting the display in a way that only the display (and power cord) is visible when mounted to the wall.
After finding some great resources online to work with WS2182B LEDs and Raspberry Pis, I first started with a breadboard to make sure I had the wiring correct. I then started to connect up to a Raspberry Pi Zero, but I realized (thankfully before soldering) that my Pi Zero was a 1.3, not a Pi Zero W. For now, I’ll use a Model 3B+ until a Zero W is delivered. In the interim, I soldered the sign’s three leads to a 5 pin molex connector so that I can simply slide it on to the GPIO pins.
Looking at the backside of the display, the wiring was soldered in at approximately 5/6cm from the other edge. I had some birch plywood around from a previous project. I ripped it down to 4cm wide and then cut it into three pieces, one 30cm and two 6cm. I then glued the two 6cm pieces to the 30cm piece to the longer piece. I then used some heavy double-sided tape to affix the display to the wood. As I wouldn’t be directly soldering to the Zero W at this point, the GPIO pins are closely grouped, so I wired up the display connector to a small molex connector and connected the board to the LEDs.
Code accompanying this write-up is available here: https://github.com/johnjreiser/pisign
One issue I encountered is that the LEDs are identified in series. I needed to make a translation between a 32-wide by 8-high matrix to
an individual LED’s ID. I put together
matrix.py to build the array that would map to the LEDs. After building the matrix, I can then map a list of lists in Python (my XY grid) to the display.
Using the rpi_ws281x module, I put together a few demos of what can be done. I’m sure that they are not the most efficient or elegant code, but they will hopefully give you some ideas for your own projects. Feel free to open an issue on GitHub or submit a pull request if you make changes to the demos.
One item in the repo is a quick and dirty web application using Flask. It allows someone to view what’s displayed on the LEDs and manipulate it. My family has gotten pretty adept at making some cool designs with the sign while I’ve been away:
This was a fun one-day project and it spurred a lot of other ideas. Pushing alerts from the home automation software out to the occupants is one idea. A ticker with time and weather is one common offering. What would you put on your sign?