LED Board Display Demo
The LED Board features 30 WS2812 LED Strips that each contain 30 addressable LEDs. The board uses a uC32 to control all 900 LEDs in the board. In conjunction with the LED board, the creation of a 4-button controller and the game of “Snake” are included in this demo.
How to build the LED Display
For the original instructions check out the Instructable.
Step 1: Materials
Required Materials for Display
- 30 1m strips of WS2812 addressable LEDs
- chipKIT uC32 microcontroller
- 5V, 75A power supply
- Various lengths of wire for connections
Required Materials for Controller
- RJ45 Pmod connector pair
- 4 momentary push buttons
- 4 1kΩ resistors
- Short wire lengths, solder, bare PCB, metal standoffs with screws, small acrylic panel
- 1/4“ (6.35mm) clear, colorless acrylic sheet (plexiglass)
- 6 friction catches for cabinets
- Super glue
- Acrylic cement
- 1/” (6.35mm) particle board
- Flat black enamel paint
- Band Saw and Hand Saw
- Sandpaper and sanding block
- Drill press with 1/2“ (12.7mm) and 1/8” (3.2mm) drill bits
- Rotary tool with cutoff wheel
Step 2: Design
The strips come with a connector on each end that connects power as well as data lines to allow for serial connection, but they also have a second set of bare wires for power connections. The bare wires are used to connect the strips in parallel to the bus lines across the bottom of the panel and the connectors to pass the data signal down the line. Since the data must be serial, the strips must be connected end to end, meaning that the data comes in from the lower left and runs up the first strip, then down the second, up the third, etc. in a zig-zag pattern across the board.
Step 3: Building the LED Board
Using one strip as a guide, mark all four edges of the acrylic with the gaps between each LED to center each LED on the board where it needed to go to make a square array. Space the first strip lengthwise so that the first and last LEDs on it were the same distance away from the bottom and top edges of the panel. The weatherproof casing and even the strips themselves are not all perfectly 1m in length, nor is the distance from the end of the strip to the first LED consistent between strips, so just lining up one end of each strip would not have resulted in a square array.
Determine the distance from the top and bottom, then mark where the wires are coming out of the end of the strip, but back in toward the center of the strip about 1/2“ (12.7mm). The connectors for the data are about 1/2” wide. By moving the hole back about 1/2“ it allows for the strip to cover most of the hole, giving a cleaner look. Use the standing drill press and some clamps to give a much cleaner cut to the holes.
With the LEDs glued, create and attach the power buses. For each bus, use a length of 12AWG wire as long as the panel is wide plus enough to reach the power supply. This results in the panels all having different total lengths, but the part attached to each panel was identical. Slice and remove little gaps into the insulation of the bus wires at intervals of one LED, leaving the insulation in place between each connection. The wire was laid down on the back of the panel and the bare wires on the LED strips that had been pushed through from the front were measured, cut, stripped, and then soldered to the bus wire.
Once all ten supply wires were soldered to the supply bus wire, the whole wire was glued down. This process was repeated for the ground bus, but the buses were placed so that the gaps were staggered between the supply and ground buses to minimize shorting. On the other end of the LED strips at the top of the panel, where there is no need for bus wires, the bare wires were trimmed as close to the silicone casing as possible to prevent shorting on that end. The bus wires and the AC supply cable were all fitted with spade connectors to connect to the terminal blocks on the 75A power supply.
Step 4: Building the Stand and Controller
When connecting the panels together, use three latches per seam, six in total. After figuring out where to put them and trimming the internal spring to reduce the tension, drill screw holes for the larger piece that contained the spring into the panel, just deep enough to not go all the way through the panel. Then, use a rotary tool with a cutoff wheel to trim the screws so that they would not go through the acrylic panel.
For the other piece of the latch, build small blocks out of acrylic to attach them as they mount perpendicular to the panel. Using some acrylic cement and some scrap pieces of acrylic cut to fit the base of the smaller piece of the latch, these blocks will be cemented in place on the back of the panel. Then drilled holes into these blocks and used screws, slightly trimmed this time, to attach the second piece to the adjacent panel.
Now that the panel was finished and working (code development will be in step 5), it needed a stand, which was a simple collapsible design that is nice and compact for shipping. Each stand has four pieces, two legs and two braces. The spacing between the legs for the two smaller panels places them in between the 3rd and 4th LED strip from each side with 4 strips in between them, or about 6 1/2” (16.5cm). The spacing on the third stand is about 5“ wider since that panel is about 5” wider than the other two. Use a simple mated-notch design to build the stands, wherein the legs and braces have corresponding notches, all cut to a depth of 1/2 the width of the brace. These notches line up when assembled, making the stand simple yet strong. Once completed, the stands can be given a coat of flat black enamel paint.
The last thing to build is the game controller. Start by placing the push buttons in a standard up/down/left/right diamond pattern. Then solder a 6-pin, 90deg angled header to the board to allow for attaching the female RJ45 Pmod. +5V and GND will be coming directly from the Max32 through the RJ45 Pmods. One side of each of the four buttons is tied to the other four pins on the header, with pull down resistors for each button, attached between those same header pins and GND, as well. +5V is attached to the other side of each button. The signal back to the Max32 is driven to GND (logic LOW) by the pull-down resistor until the button is pressed, at which point the pin is driven to +5V (logic HIGH). This design is easily reversed if you want a logic LOW to trigger the code to do something. Once the board was all soldered together, the solder points on the bottom were a little sharp.
Step 5: Software
In order to run the Snake program correctly, you must first install the PICxel Library. This library provides software designed to be used with the WS2812 LED strip. We'll check out the main driving force that allows our particular 30×30 array of LEDs to run as planned: the PICxel library. This library is surprisingly simple and straightforward to use. To start out and initialize the array of all 900 LEDs we first call the construction for the PICxel class: PICxel name_of_the_set_of_LEDs( how_many_LEDs_we_have, which_pin_the_data_is_being_sent_from_to_the_LEDs, color_mode);
Here we can provide how LEDs we are running (900), which pin the data is going to be used to connect to the data line on the LEDs (pin 3 in our case), and the desired color mode. Marshall's library supports two different color modes: GRB (RGB in a different order), and HSV. Our snake game happens to be using HSV since that allowed more flexibility for the user to choose both a color and the brightness. We can get the LEDs lit up and running by first calling in our setup the name_of_the_set_of_LEDs.begin();
function and then choose the settings of the LEDs and subsequently update the strip of LEDs with our new values. For HSV color mode, you can set the hue, saturation, and value. For those of you that might not know, these values roughly translate to the color, how “bold” a particular color is instead of being washed out, and how “bright” a color is instead of being dark, respectively. These are all set with the following function: name_of_the_set_of_LEDs.HSVsetLEDColor(which_LED_out_of_your_set_you_want_to_change, hue, saturaturation, value);
This function will only set (but not yet update) the values on just one LED, so it's recommend to use a for loop to change multiple LED values. To update the LEDs so that they all show their new settings (or old if that particular LED was not updated), simply issue the following command: name_of_the_set_of_LEDs.refreshLEDs();
The refresheLEDs() function utilizes port manipulation and assembly code to make for a tight library so very little time is wasted in sending out the new information to the WS2812 LEDs at their designated data rate. You can check out a screen shot of the HSV demo for this library in the picture for this step.
Go here for a tutorial on installing libraries to MPIDE.
Download Snake, then upload the program onto the uC32.