My latest project was done over Christmas break. I had been reading up a lot on Adruino boards and the new Raspberry Pi. I decided I wanted to do a project using the Pi since I enjoy programming more in python than I do in C/C++ or assembly. I wanted to construct something that would be fun and also somewhat useful. I also wanted to donate a good bit of time to the project and make sure the finished design was one that looked nice. I wanted to be able to proudly display my final result.
After much thought I decided it would be fun to do a project that involved an LED matrix. The goal was to use the Pi to develop a scrolling marquee with everything enclosed in a nice box that I could sit on my desk. I had two main uses in mind. The first use was to make it clock. This seemed to be a fairly simple idea and one that could be done with limited issues. The second use was to make it an ESPN ticker. To keep a long story short here is how the process went:
I cannot claim all the knowledge for this project. Much help was received from an instructable. I had to expand the design a bit as the instructable was for a 24×6 matrix and mine is a 24×8 matrix. There was also large modification to the source code since I chose to drive with a Pi. You can see the details at Instructables Website If you don’t feel like reading all the nitty gritty… the columns are controlled by a series of shift registers chained together. The rows are controlled by the decade counter. This way I am able to control 256 LED’s with only a few pins.
After the LED matrix was all soldered up and ready my focus turned to the Pi. To drive the matrix, the GPIO pins on the Pi were used. I had to tap into the RPi.GPIO library for python to do this. Since the implementation was done using shift registers I only needed 5 pins, as described in the instructable, however I decided to use 6. I added another pin which clears out all the shift registers. The idea behind the display is just like a television screen.
To begin you must enter the first row into the shift registers one bit at a time. Then the first row is lit up. The second row is then entered into the shift registers one bit at a time and the second row is lit up. This is done one row at a time through all 8 rows. It happens so fast that our eyes perceive it as all the LED’s lit up simultaneously. In reality there are at most 8 LED’s on at once. To see how this works in code you download my test files here . This file simply displays the text entered into the prompt.
To display text, each character had to be converted into a binary object. After some research and trial it was found that each character needed at least a 6×6 square to be represented properly. In python I used an array of 0’s and 1’s. For example: “A”:[“011100″,”100010″,”100010″,”111110″,”100010″,”100010”] represented the character ‘A’. Each index in the array is the corresponding row of the LED matrix. Each character of the string represents the corresponding column. 1 means the LED is on, 0 means the LED is off. I did run into one major issue. After I had everything running, I noticed that I had two LED’s which were bad. They appeared on the top and bottom rows this is why the characters only have 6 rows and not 8.
The final step was to put everything in a nice enclosure. To keep things looking clean and professional, I decided to use oak. I purchased a sheet of oak plywood and cut out a box. Put everything together and stained the box. The internals were kept on a solder-less breadboard so if something blew it could be replaced easily. The Pi was mounted on a separate wooden plank. This plank is held in place by kitchen cabinet door holders. The only parts that were soldered were the LED matrix cubes. I wanted to keep everything as modular as possible. The top of the box is held on by metal pins that are normally used to hold up book shelves. A hole was drilled in the back to allow for a power and Ethernet cord to pass into the box.
I later added a wireless USB dongle which has an access point mode. This allows me to move the box around and show it off to friends. I can now connect to the Wi-Fi network it generates without the hassle of having to hook it to a TV, or figure out its IP address to ssh into the Pi.
I also registered for the ESPN API access. I then added a script that will pull down from ESPN’s news ticker and display the latest headlines.
This box also found a place in my wedding. Instead of printing table numbers on table cards the guests found a barcode on the back of their table card. They then had to go scan their table card to find out what table they were seated at. The LED matrix would welcome the guest. An attached DYMO printer would print out their table number and a list of associated guests. You can see a video of the final design below.