Design Journal

 

Exploratory Research

We began our project by looking into various LED circuits and layouts to create a cube matrix of LEDs uniquely addressable using a row column selection scheme similar to a Cartesian coordinate system.  Using a breadboard we created a controllable 2x2 grid of LEDs using a decoder to select the active line through DIP Switches.  We also experimented with Pulse-Width Modulation for providing LEDs with uniform brightness and regulating the current using the UP2 Board and an RGB LED.

 

Design Prototypes

After building the 2x2 Red model, we moved on to an actual 2x2x2 cube of yellow LEDs soldered  together across their specific anodes and cathodes to form a column and row select respectively.  By applying voltage to the appropriate cathode row line and anode column line, the LED at the intersection of the selected lines will illuminate.  We again controlled this using decoders created from DIP Switches.

  

Next we created 4x4 grids of yellow LEDs and began working on the hardware needed to set up software control through a PIC processor.  We are going to set up the software to run an 8x8x8 cube, but if should work the same for a 4x4x4 since everything will just run through multiple times.  The PIC16 will eventually provide the input from software but for now we used switches.  The basic flow we set up is that from the input pins for the cathodes or row selects we sent the signal through a 74LS138 decoder (active-low 3-to-8) and into a 74LS240 inverter chip.  From the inverter we now have an active high signal which we can route to the appropriate base connect of the NPN transistor so that when active it allows current to flow from the collector to the emitter acting as a switch, completing circuit by grounding the appropriate cathode.  For now we kept the anodes hardwired to simplify debugging.

 

 With the cathode wiring set up, we moved on to the anodes.For these we took the 8-bit serial input data packets from the PIC and sent them serially into the 74LS273 8-bit shift register so that we could output all 8-bits in parallel after 8 clock cycles.  On the 8th cycle the flip-flops (74LS164) clock and basically take a snapshot of the 8-bit packet from the shift register outputs.  We discovered that when hooking up only four outputs on the shift register we needed to be sure to begin with the last output as it will have the first shifted bit of data at the end of the 8 clocks.  After the flip-flops, the signal travels to the anodes, lighting the appropriate LEDs and allowing us to light multiple LEDs at a time.

 

At this point we assembled an 8x8 grid of RGB LEDs using the tools shown below.  After spending five hours assembling the grid, and a week discussing how to get over five hundred LEDs from china, we decided that for reasons of cost and time we would shrink the project down to a 4x4x4 cube of RGBs so that we can focus on the software control rather than spending all of our time wiring up control circuits and soldering LED leads.  The only problems we had with the RGBs we do have is that they were clear which made the three diodes inside stand out so we sanded each LED to provide a frost that helps diffuse the light and make the three diodes appear as one combined color.

 

Final Design

 

We took the 8x8 grid we assembled, and carefully cut it into four 4x4 grids.  We set up these four panels in a cube formation on a breadboard and we plan on having all of the control circuitry on separate breadboards to keep things clean. At this point we have already bought the required chips with an 8x8 in mind, so although many of our chips will not be fully utilized we will continue using these for cost purposes and with the possibility in mind of upgrading our cube to an 8x8x8 someday so that all we would need was the larger grids of LEDs and some wiring with all of the chips and software already ready to go.

 

Below is the layout for one of our control circuits.  There are two panels on each board, one on the left and one on the right.  Focusing on the right hand side of the board you can see the inverter chip (74LS240) on the upper right, with the encoder (74LS138) right below it.  Continuing down the right hand row, we have three of the 8-bit flip-flops (74LS273); one each for the red, green, and blue anode.  Moving to the top of the second column from the right we have the PIC16 at the top which is the driver for the panel, and then 3 of the 8-bit shift registers (74LS164), one for each anode red, green, and blue.

 \

 

The next step was to wire up the control boards and panels.  Below we have one panel wired to the control circuitry with the DE2 providing a clock for now.  Using this model we are able to experiment with colors by playing with the pulse width modulation and combining the Red, Green, and Blue anodes in various ways.  Since each anode receives an 8-bit stream of data, there are 256 possible combinations for each anode although some are repetitive in practice.  We are going to develop as many distinguishable colors as we can through experimentation. 

At this point we are working on a master control for the cube using the DE2, specifically the NIOS_II, to create a Cartesian coordinate system for selecting LEDs at high level with the origin in the lower left hand corner.  The program will have color codes defined, and the status of each panel will be shown by a matrix of the current color status on each LED.  This matrix will be sent to the appropriate PIC depending on the panel via an SPI interface.  We can then use standard xyz addressing to create various animations through manipulation of the status matrix.  The PIC processors will need to be able to receive these status matrices and update the cube accordingly.

 

The image below illustrates the final wiring that is present on the breadboard. In this stage, all four panels are being controlled properly by the PICs, allowing us to move on from the construction and onto the communication between our DE2 master, and the PIC SPI slaves.

 

 Below is a closer zoom-in of one half of the wiring required for our cube. The wiring could be cleaned up substantially by stacking the control breadboards under the cube, but at this point, we are not finished programming the PICs, so we have decided to leave them unstacked for ease of access.

 

 The following two videos demonstrate the working final cube structure. The animations present are not software-designed at this stage, but rather, the PICs are cycling through all of our available colors, and the sweeping of on/off lights is obtained by varying the clock speed that the PICs operate at. While not our ultimate goal, these videos demonstrate some possible animations that we could later implement in software.

 

 

 

Our next challenge was to get a working SPI interface between our DE2 master and the PIC slaves. After some struggling, we were able to generate a working NIOS processor and the accompanying verilog, but we were stopped cold when the NIOS II IDE continually gave us errors regarding a lack of memory. We streamlined our NIOS design, but were still unable to compile our test program within the IDE due to lack of memory errors. We decided that we needed to get the SDRAM core working in order to alleviate this issue. After a good deal of digging, we were finally successful in getting the SDRAM to build onto the board. We also included the onboard LCD display to combine with the switches forming user I/O, as can be seen below.

Below is the video of our most recent build of the project. It is running on a standalone crystal for the clock (instead of the Tektronix signal generator), and is assigning random colors to each of the LEDs. The SPI master is working as intended, however, we still do not have the SPI slave on the PIC working properly.  At this point we have decided that SPI communication will be further work on the project in the future, but for the immediate demo we will hard-code the animations in each PIC.  The SPI is a problem because we cannot figure out how to configure the PIC as a slave.  It will not receive input from the DE2 master, even when we ditched the avalon_spi core for the NIOS and wrote the code for an SPI module within the C-code.

 

 

 

Project Demo

 For the project demo we have set up ___ animations for our cube.  DETAIL ANIMATIONS WE CREATED HERE