Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
chipkit_ledboard [2015/03/10 17:59] – [Step 3: Building] Joshua Woldstadchipkit_ledboard [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 50: Line 50:
 {{ :cords2.jpg?700 |}} {{ :cords2.jpg?700 |}}
  
-===== Step 3: Building =====+===== Step 3: Building the LED Board=====
  
  
Line 69: Line 69:
  
 {{ :terminal.jpg?300 |}} {{ :terminal.jpg?300 |}}
 +
 +
 +----
 +
 +======Step 4: Building the Stand and Controller ======
 +
 +==== Latches ====
 +
 +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. 
 +
 +{{ :latch.jpg?600 |}}
 +
 +==== Stand ====
 +
 +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.
 +
 +{{ :stand.jpg?600 |}}
 +
 +
 +==== Controller ====
 +
 +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. 
 +
 +{{ :controller.jpg?800 |}}
 +
 +====== Step 5: Software ======
 +
 +{{:snake.jpg?200 |}}
 +
 +In order to run the Snake program correctly, you must first install the [[https://github.com/mwingerson/PICxel/archive/master.zip |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 30x30 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 [[http://chipkit.net/started/learn-basics/party-libraries/|here]] for a tutorial on installing libraries to MPIDE.
 +
 +Download [[http://www.instructables.com/files/orig/FJO/6KW3/I6NI5AL5/FJO6KW3I6NI5AL5.zip|Snake]], then upload the program onto the uC32.