Introduction: LED Message Board
In this article I describe how I made an LED message board from ws2812b leds, a 5V power supply, and a raspberry pi. Any Raspberry Pi will do, in this one I used a raspberry pi zero. This works great for displaying messages across at least 5 led strips, but this can work for even more. Read more and watch the video to find out how I did it!
Step 1: Build the LED Screen
The first thing you'll need to do is build the LED screen. There needs to be at least 5 rows to resolve a letter, so for mine I made 60 leds per row since I had a strip of 300. Each row was separated by about an inch and I hot glued them to a 1/8 inch piece of MDF that was later slotted to fit a Mahogany box. To connect the rows I soldered the connections between strips. It is important to alternate the direction of the strips on each row since the data flows in a single direction. In the end your board should look like a serpentine pattern.
Step 2: Build the Circuit
The circuit is fairly simple and consists of an integrated circuit, the LED strip, and a 5V power supply. We connect the pwm data pin of the raspberry pi to the data signal of the led strip and connect the power supply to the strip. To 0 out the 5V difference we connect the ground pin of the pi to the negative wire from the power supply. We need to use an integrated circuit to bump up the voltage from the data signal of the pi to 5V since the ws2812b strips expects a 5V signal and the signal itself is only 3.3 V. You could use any mechanism to bump up the voltage but this is the technique I used.
Step 3: Wire Up the Code
I highly recommend watching the video for the install of the code: https://github.com/tmckay1/message_board and additionally reading the README.md in the repository. It goes over how to run the code given the setup I have, but if you need to change anything, it shows where to change the configuration. I will include some gotchas in this section that aren't included in the video or the README because they have been observed to come up often.
Getting an index out of bounds error
If you get this error and you are running on a different dimension message board than 5 rows, it's most likely that you didn't define your own character set. You'll need to define your own character set that matches the dimensions of the board you have similar to the ones I've previously made.
Defining new characters
To define new characters, you need to define the character in your character set in its own constant. Then you need to update the standard message parser to use that character.
Getting an error about missing rpi_ws281x c extension
For some reason when you install the rpi_ws281x library with the newer versions of Raspian, sometimes it will throw an error saying it is not installed even though it may be installed and you run a command from my Github repository. There are many things that can cause this. I will write out a few here that will assist in debugging.
For one we have found that if you install the code using the virtual environment everything should work. So if you are familiar enough with Python, then I suggest using the virtual environment as a workaround. If you are not familiar with Python, read on.
Make sure that when you run ./test like I do in the video, you get something on screen. If you don't try reinstalling until you do.
If you are getting this error when running something like `python3 animateMessageBoard.py "Hello World!"` then make sure you are running sudo instead `sudo python3 animateMessageBoard.py "Hello World!"`
If you are getting this error when running `sudo python3 animateMessageBoard.py "Hello World!"` then check that you can import the library by running `sudo python3` on the command line. Run `sudo python3` on the command line. You should enter a python shell. Try importing from the shell manually `from bibliopixel.drivers.PiWS281X import *`. If this does not work, then try quitting out of the python shell and enter it again without sudo. Running sudo before entering the shell ensures you are running as root, so all the paths are relative to the root user just like it would be when you run my animation command with sudo. Running it without sudo means you are running the command as the current user, so if you are able to correctly import the library under the `python3` shell but not the `sudo python3` shell, then this means that you installed rpi_ws281x library under your current user and not root. Reinstall it as root.
If you are in the `sudo python3` shell and you run `from bibliopixel.drivers.PiWS281X import *` and it works, but you still get a failure running `sudo python3 animateMessageBoard.py "Hello World!"` complaining about a missing rpi_ws281x extension, then you need to check your python paths. For some reason I've found that the python3 command line shell has more binary paths then running a python script on the command line with python3. For more information on this I suggest watching this video I made explaining why a sports module is missing at the 2:30 timestamp:
This is the same reason you cannot find the the rpi_ws281x module and are getting this error. Basically you want to print out the binary paths in the python3 shell and compare those paths to the binary paths when running my python3 script. Once you find the missing path, you can add it to the script paths in many ways, but here is a stack overflow article I googled that should work
Step 4: Run the Program and Enjoy
Thanks for taking the time to read this and feel free to reach out for any questions!