loading
Picture of 32x32 LED Matrix
 
Build a 32x32 LED matrix using an Atmega2560 microcontroller.  The project contains the steps to build the matrix board, the PCB and the software (written in C++).  The software contains over 30 animations, a RTC (real time clock), and a text display routine.  By using the Atmega2560, no shift registers are needed.  The circuit uses the ULN2803A and MIC2981 to drive the LEDs.


 
Remove these adsRemove these ads by Signing Up

Step 1: Skill Level and Basic Tools

Picture of Skill Level and Basic Tools
1.6mm Chisel Tip.jpg
0.20mm tip.jpg
0.20mm Curved Tip.jpg
This is not an ideal 'first build' and it requires some soldering experience particularly with SMC components.  It also requires a lot of time and patience.   A basic knowledge of digital electronics is important.  This is my first Instructable - I’ll try to include enough detail to make the assembly straight forward while avoiding too many opinions and comments. 

The most challenging part is soldering the 100 pin Atmega2560 to the Schmartboard daughterboard.  Using the Schmartboard makes it a lot easier that soldering it directly to a PCB.  These guys have made several YouTube videos to show you how it works – more on that later.

You should be proficient at soldering and have a decent solder station with a couple of different tips.  You will get lots of practice assembling the matrix!  You will need a couple of different tips for your iron - a normal 1.6mm or similar for the LEDs and a .2mm tip for the Atmega and the SMCs. 

You should know how to use a Digital VOM to help diagnose problems.

Programming – The source code for the project is C++.  C was not my native language - I am an old school FORTRAN and PL/1 programmer – the C++ routines are probably not the most efficient or well-designed programs, but they work.  The development environment was AVR Studio 5.  The hex, source and makefile files are in the download section.  You can load the hex file and not need to do any programming!

Step 2: Components List

Picture of Components List
PCB Empty.jpg
1x         PCB                                                                      
1x         Voltage Regulator - IC REG LDO 3A 5.0V TO220-3
2x         10uf Capacitor
2x         20pf Capacitor 
1x         0.1uF Capacitor                                              
10x       0.1uF SMC Capacitor                                             
4x         MIC2981 Source Array Driver                  
4x         ULN2803 Darlington Array - Sink           
1x         16MHz Crystal                                               
33x       220 Ohm Carbon Film (use 1 for the red Power LED indicator)
3x         100 Ohm Carbon Film
1x         5 pin 2.54mm Receptacle for DS1307 Module
1x         Atmega2560
1x         5mm LED – Red (power indicator)
3x         5mm LED – Status (your choice)
1200x   5mm LED - Choice of Color (may change the value of the 220 ohm resistors)
16'        Ribbon Cable -10 conductor
1x         ABS - Black 1/8" 14x14" either this one or next
1x         ABS - Black 1/8" 24x24"                               
1x         Power Supply 5V / 3A of wall wart
1x         Straight Double Row Male Headers       
8x         18 Pin IC Socket                                              
10x       PCB Connector - Male
10x       Ribbon Cable Connector - Female
1x         Molex connector for power - Male
1x         Molex connector for power - Female
2x         Molex Pin - Pin - Crimp
1x         Schmartboard - SMC Prototype Board
5x         Mounting Header for Schmartboard -Female
3x         Mounting Header for Schmartboard - Male
1x         Mounting for Switch - Screw Terminal
1x         RTC Module - DS1307

You probably already have your favorite vendors for components.  In the downloads Step, I have included the BOM with part numbers from my favorites - Digikey, Sparkfun and Adafruit. 

The cost range for building this project is $250 - $300.  If there is enough demand, I can order the PCBs in quantity and resell them for $75 each instead of the $211 for from Dorkbot (for 3 boards).  Send me a PM if interested.

Step 3: The Circuit

Picture of The Circuit
Board.png
Using the Atmega2560 made building a 32x32 matrix very straight forward.  With the huge number of PORTS available, there is no need for shift registers.  After a fair amount of research and a few trials, I chose the Micrel MIC2981 IC to source the current and the TI ULN2803A Darlington Array as the sink.  The MIC2981 is rated at a continuous 500mA!  Pretty amazing.  The ULN2803A is also rated at 500mA.  This made it possible to actually drive 32 LEDs at a time - albeit only for an instant.  But long enough to fool our eyes into thinking that more that that are on at any given instant thanks to POV.

On first glance the Atmega seems to have more than enough digital outputs to make the circuit design work.  However, I ran into a few obstacles and challenges once I started the actual design and software.  After lots of head scratching, reading and different approaches, I came up with the following:

Source PORTS
PORT A
PORT C
PORT E/G - Can only use bits 0-5 on PORTE.  Last 2 bits are from the 2 high order bits PORTG
PORT F

Sink PORTS
PORT H
PORT J
PORT K
PORT L

Other PORTS
PORT B is used for programming interface for the AVR.
PORT D is used for the RTC Interface
PORT G is Split - the 3 low order bits are for the 3 Status LEDs - Heartbeat, Soothing Mode and DS 1307 Error

The only part I really don't like is having to split PORTs E/G - this made the interrupt routing a little less 'streamlined'.  I considered giving up the RTC, but in the end I kept it and settled for using two ports to control a block of 8 outputs.

The current limiting resistors worked out to be 220 Ohms for the LEDs I chose.  They have a forward current of 20mA and forward voltage of 1.7 to 2.0.  Using the formula to calculate the correct resistor - (Supply V - LED V) / LED Current you get something in the 150 - 165 ohm range.  I chose 220 Ohm to reduce the current load on the circuit due to the number of LEDs.  The 220 Ohm resistors work well - I have not tried a 150 Ohm, although I suspect it will work as well.

The input power offers two options - 5V regulated or 7-12V unregulated from a wall wart.  The jumper in the power section is just a precaution.  It bypasses the Voltage Regulator. 

The external crystal clocks the CPU at 16MHz.

Step 4: LEDs

Picture of LEDs
eBay LEDs.jpg
LED Table.jpg
LED Diagram.jpg
For buying large quantities of LEDs (1000+) eBay is hard to beat.  Look for diffused - not clear.  I ordered 1200 just to be sure I would have enough expecting some to be DOA and some soldering mistakes.  I bought 1000x and 200x.  Be sure you order them from the same supplier with the same specifications - most vendors will sell them in 1000x 200x and 100x quantities.  Look for either free or cheap shipping. 

Colors and Current - Red and Yellow LED frequently have a 20mA Forward Current and 1.9 to 2.1V Forward Voltage.  You can see from the chart that the Green, Orange and Blue have a higher Forward Voltage.  Many LEDs also have 30mA of Forward Current.  Keeping within the recommended Forward Voltage and Current is important so you don't overload the Source and Sink ICs.

Step 5: Power Supply

Picture of Power Supply
Wall Wart Power Supply.jpg
The 32x32 Matrix includes a voltage regulator on the PCB if you want to power if from a simple Wall Wart.  There is a Jumper to bypass the voltage regulator if you are powering it with a regulated 5V supply.  A 3 - 5 Amp regulated supply will work well. 

Step 6: Project Organization

This project build is divided into 4 Parts:
  1. Assembling the LED Matrix
  2. Assembling the PCB
  3. Loading / Modifying the Software
  4. Files for Downloading:
    • BOM – Excel format
    • PCB - Eagle Files
    • hex files – 32x32.hex and 32x32_Test.hex (and .eep files)
    • makefile
    • C++ Source

Step 7: Part 1: Building the LED Matrix

I chose 1/8” Acrylonitrile Butadiene Styrene (ABS) plastic as the material for the matrix.  I looked at plywood (thin plywood tends to warp), Plexiglas and other acrylics (too expensive and hard to work with).  A 36”x36” sheet was less than $10.00.  I chose black, but I believe it also comes in several colors.  I also chose one with a lightly textured pattern on one side.  It is easy to cut with a power saw or even a hand saw.  I used a small table saw.  Drilling holes is also easy – the material does not crack or chip like other harder plastics.

LED Spacing – This is personal preference.  My prototype was built using ½” centers.  After I finished it, I thought it was a little too much space so I changed to 3/8” spacing.  The outside dimensions of the board are 14”x14” for 3/8” spacing and 17 ½”x17 ½” for ½” spacing.    The holes are 13/64” or 5mm on both boards.  Using either ½” or 3/8” centers, the legs serve as the connecting wires. 

Drilling the holes…

Drilling 1024 holes takes a while.  Keeping them in straight rows and columns is also a challenge.  For my prototype I used a piece of pegboard (1/4” holes on 1” centers) as a guide.  I also had printed a sheet paper with small dots on 1/2” centers.  Using the pegboard and the paper as a guide, I used 4 bolts to secure the pegboard to the ABS sheet.  The paper was between the two.  I drilled all of the holes using the pegboard’s holes.  Then I moved the pegboard ½” along the rows and drilled another set.  Then twice more for the columns – again a lot of holes!  I thought this was a good guide – especially since I drilled the holes with a small drill press.  I was disappointed with the results.  You can see from the pictures that the alignment is not great.   The difference between the 13/64” and the ¼” pegboard holes accounted for the problems. 

I went back to my plastics supplier (Regal Plastics) and they used their CNC machine to drill the holes for this build. 

You can see from the pictures the improvement.

Step 8: Understanding the Matrix

Picture of Understanding the Matrix
3x3 Top View.jpg
Here is a 3x3 matrix that illustrates how the leads are connected.  The Cathodes are pressed flat across the to form the Columns and the Anodes are bent to form an 'Up and Over' for the Rows.

Step 9: Inserting the LEDs

Picture of Inserting the LEDs
Index Top.jpg
Inserting, gluing and soldering the LEDs takes a LONG TIME and a LOT OF PATIENCE.  You probably won’t finish it in one (or even two or three) sittings.  It took me over two weeks.  Also, please follow the steps closely when it comes to the sequences (number of courses and when to glue or solder). 

First - label the board – on the back side – add either tape or labels along the x and y axis as shown below.  This is especially helpful if you plan on developing any additional software animations.

Step 10: Insert the LEDs

Next, following the pictures, add one course of LEDs at a time – paying attention to the correct orientation – start with the flat side of the LED (cathode or the shorter lead) facing the ‘bottom’ of the ABS sheet.  We are actually constructing the matrix column by column. 

You can save some time by cutting the cathode lead before you insert it.  It needs to be at least 1/2" long.  Inserting the LEDs with needle nose pliers is the best way I have found.  Just be sure you push against the plastic case and not the leads. 

After each course, I use a hot glue gun to make sure the LEDs do not come loose from the plastic sheet.  It does not take a lot of glue – just a row down one side of the LED.  Try to keep the glue away from the leads as this makes it more difficult (and makes more fumes) during soldering.  There are alternatives to using a hot glue gun such as plastic model cement or epoxy.

Next bend the the cathode legs 90 degrees towards the RIGHT using your finger.  They should be flat and on top of the cathode lead to the right.  Do not cut the right-most lead.  The others can be cut as shown below for soldering.  The leads can be either on top of or beside the adjoining cathode lead.  Bending them until they touch makes soldering them lot easier.  Leave the anode (longer leg) standing for now.

Step 11: Solder the Cathode Leads Together

Picture of Solder the Cathode Leads Together
Eraser Bend.jpg
Solder the cathode leads together – starting from the right side, solder the right-most cathode lead to the one to its left.  Repeat until all of the cathodes have been tied together along the entire course (column) as shown.

Step 12: Testing the LEDs

Picture of Testing the LEDs
Test each LED – After soldering each course, test a couple of things – first the soldering and next the individual LEDs.  You may elect to test the LEDs before you insert them, but I have had excellent results even with the cheap LEDs from eBay.

There are a couple ways to test them – I discovered by accident that my digital VOM will actually light the LEDs!  I set it to test impedance – I use either the 200 or the 2K ohm setting.  Touching the red (+) VOM lead to the anode (standing lead or ‘+’) and the black lead to the cathode lead you may see the LED light up.  By touching the black lead to the right-most cathode lead and touching each anode lead, you check both the LED and your soldering.  I had some solder joints that were open and had to be re-soldered. 

If your VOM does not light the LED, just use it to check the continuity of each course – you should see zero resistance if all of the solder connections are good.  To test the LEDs using a 5V power supply, put a 100 to 200 ohm resistor in line with the ‘+’ side using a bread board or alligator clips and test across each LED.  Be sure to use the resistor!  Make sure ‘+’ goes to the anode (standing lead) and ‘-‘goes to the cathode (bent lead).

It is time consuming to test the LEDs here, but it is a lot easier to replace a bad LED here than after the matrix is fully wired. 

Step 13: Anode Leads

Picture of Anode Leads
Bent Anode 2.jpg
Bending Part 1.jpg
Bending Part 2.jpg
Pins 1.jpg
Progress.jpg
Add a second and third course of LEDs and glue them in place.  Bend the cathode leads toward the right and solder as before.

Anode leads – bend the leads of the first and second courses of anodes as shown in the pictures below using needle nose pliers to give them enough clearance to pass over the cathode leads that we have already bent and soldered.  Bend each of the 32 anode leads and then solder each to the anode lead of the LED on the next row.   This will make the ‘rows’ of our matrix.


Repeat and repeat......

Insert the next course 'column' of LEDs, glue and solder the cathodes.  Then trim and bend the anode leads of the previous course and solder them.

Continue until the board is complete. 

On the last course of LEDs, do not cut the anode leads, but extend them like you have with the cathode leads.


Step 14: Almost Finished Matrix

Picture of Almost Finished Matrix
It took me over 2 weeks to finish this part!  After a few courses of LEDs, it took me about 22 minutes per.  After 2-4 courses, I had to quit and rest my eyes.

Step 15: Connector Cables

It is time to think about how your final project will be configured - specifically where will the PCB be mounted in relation to the LED Matrix.  My prototype had cables about 3 feet long so I could troubleshoot the board and the matrix while they were connected.  Here the cables are about 12-14".  When you decide where your PCB will be mounted, layout the cables and label them.  The connectors and cables are all 10 conductor, but only 8 are used.  Why? Human error - mine.  In my early design I needed 10 and I forgot to change them.  Be sure to use 10 conductor ribbon cable into the connectors - you can strip it back to 8 just past the connectors.

After you have cut the 8 cables to length, add the connector and strain reliefs to one end.  If you have done this before you can skip the following narrative. 

The red wire is the index conductor.  In this project it is always connected to the '0' LED of a row or column and to pln number 1 on the board connector (there is no pin 0).  If you are using the rainbow type ribbon cable, just be consistent with your index wire. 

Using scissors, make sure you have a 90 degree cut on each end.  Insert one end of the ribbon cable into the connector matching the arrow on the connector with the index conductor.  It should be flush or extend slightly on the other side.  Be sure it is inserted straight.  Pinch the cable with your fingers to keep the end on the cable.  Next insert the connector into a vice or pliers to crimp the connector to the cable.  I like a vice because it is easy to apply even pressure.  You should hear one or two clicks as the connector locks to the cable.  I sometimes hear 1, sometimes none, but usually 2.  Don't over squeeze the connector.

Next fold the ribbon cable back over the connector and insert the strain relief as shown in the pictures.  These can easily be locked using just your fingers.

Step 16: Solder the Ribbon Cables to the LED Matrix

Picture of Solder the Ribbon Cables to the LED Matrix
All Cables.jpg
Time to solder the other ends of each ribbon cable to the LED matrix.  First, separate the individual conductors about 1 3/4".  Depending on the LED spacing you may need to adjust this.  Lay the wires on the LED matrix and cut the lengths of the middle conductors as shown.  Last, strip about 1/4"-3/8" of the insulation from each cable and solder it to the leads in the labeled 'Ports' on the matrix board.

Be sure to solder the Index (Red) wire to the '0' LED of each port as shown.  Also, don't forget to separate 2 conductors from the 10 conductor ribbon cable - these can be cut and discarded.

This completes the assembly of the LED Matrix.  Now, on to the PCB!

Step 17: Building the DS1307 RTC Module

Picture of Building the DS1307 RTC Module
The DS1307 assembly takes about 30 minutes.  The components are all through the hole and there aren't that many of them!  The instructions from Adafruit are very clear.  After you complete the build, you need to set it to the correct date and time using an Arduino.  If you don't have an Arduino or other way to set the date and time, send me a PM and we'll make arrangements to ship your DS1307 to me. 

Here is the link to the Kit - https://www.adafruit.com/products/264

Here is the link to the assembly - http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit

If you have an Arduino - http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/wiring-it-up

To set the Date and Time - http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/understanding-the-code

 

Step 18: Assemble the PCB

Picture of Assemble the PCB
PCB Empty.jpg
Pieces and Parts! 

Step 19: Schmartboard Assembly

Picture of Schmartboard Assembly
Liqiud Flux.jpg
Atmega Inserted.jpg
Atmega Taped.jpg
Atmega Soldered.jpg
This is probably the most challenging part of the assembly but if you watch the video below and follow Schmartboard's instructions, you will be amazed how easy it is.


Apply liquid solder to the pads on the Schmartboard and then position the Atmega as shown.  The pads are actually small troughs and the chip will 'lock' in place when properly aligned.  Apply more liquid flux to the pins being very careful not to bend them - stroke with the pins not across them.  Tape the IC in place covering approximately 1/2 of the chip.  Inspect the position with a loupe before you start soldering. 

Exactly like the video, using a .20 mm tip and setting your solder iron to 700F, start on the outside end of each pad / trough and move the tip toward the pin until the iron touches the pin.  You should see the solder melt and flow toward the IC pin.  Repeat 99 more times! 

You do not need to apply any solder - it is already on the Schmartboard!

Inspect the solder connections with the loupe. 

The rest is easy!

Step 20: Connect the Processor to the Main PCB

Picture of Connect the Processor to the Main PCB
Pins 1.jpg
Pins together.jpg
Pins together 2.jpg
Pin Right.jpg
Pin Wrong.jpg
Before we jump in to this step, I wanted to offer a little explanation for using this type of pin (male and female) vs. a 2.54mm straight pin connector.  Either will work. By using the male and female type pins, if you happen to brick the processor (for example by setting a fuse incorrectly), you can still salvage the main PCB.  I had this happen to me on another project and it turned out to be a very expensive mistake.  If you are experienced with the fuses on the Atmega and want to save some money, you can use the regular straight pins. 

Using either approach, cut the rows of pins to fit the holes on the main PCB (not the Schmartboard – there are more holes on that than we need).  Both the inner and outer rows must be filled.  If you are using the male and female pins, it does not matter which end is up – as long as you are consistent.  After you have cut the rows of pins, squeeze the male and female parts together and put them into the holes on the main PCB. 

Don’t solder yet.

Making sure the main PCB and Schmartboard are aligned correctly (the lettering is facing 'up' on both boards), work the pins into the Schmartboard. Also be sure to align the pins correctly to the Schmartboard.  They should be in the outer row of holes and the inner rows of holes.  It is easy to get the off by a row - see pictures

Using a wider solder tip (1.6mm or similar), solder the pins to the Schmartboard.  Keeping the two boards together, flip the boards and solder the 100 pins to the main PCB.

Step 21: Remaining Components on the PCB

Start with the (8) SMC Capacitors.  If you are familiar with soldering these components, just skip this narrative.  Otherwise first apply liquid flux to both pads and then add a small bead of solder to (1) pad of each capacitor location.  Place the capacitor in the correct location and then heat the solder bead under one end of the capacitor.  Hold the capacitor in place using tweezers.  Make sure it is flat against the PCB.  Then apply solder to the other side. 

Add the 16MHz Crystal.  It can be mounted flat or bent 90 degrees.  The Eagle template was for a larger (taller) device.

Add the (2) 20pF disk capacitors and the .1uF disk capacitor. 

Add the Power Regulator and then the 10uF electrolytic capacitors to the power section.  Note the white line/bar on the capacitors indicated the negative lead.  The positive (+) leads are labeled on the PCB. 

Add the (3) 100 ohm resistors for the indicator LEDs (Heartbeat, Soothing Mode and DS1307 Error) and the 220 ohm resistor for the power Indicator.  Note the resistor for the power LED is in the row of resistors for the LED Matrix.  I changed it to a 220 ohm at the last minute – it was too bright with a 100 ohm. 
The bending tool I found was a handy addition for doing lots of resistors in a very consistent manner - I found it at Evil Mad Scientist (http://shop.evilmadscientist.com/)  for $5.00.

Add the (32) 220 ohm resistors.

Add the AVR ISP port (2x3 pins), the power selector jumper (1x3) and the RTC connector.  Note you will have to cut (1) of the pins from the board side of the connector of the RTC connector - only (4) pins are used.

Input Power Jumper - if you are powering the PCB with a regulated 5V supply, add a jumper across the top (2) pins (indicated by 'Use 5V' on the PCB).  This bypasses the Power Regulator.  If you are using a wall wart or other power supply above 5V move the jumper to the lower (2) pins to use the Power Regulator.

Add the Power and Indicator LEDs.  Use Red for Power.  The color of the Indicator LEDs is your choice.  Here is how they are used by the software - Heartbeat is flashed every 500 interrupts - just shows the microcontroller is running.  Soothing Mode - Indicates the program has been running for an extended time period - the program adjust to display only the soothing patterns.  RTC Error - indicates the RTC module is either missing, the battery is dead or there is another problem getting the date and time.  I used Green for the Heartbeat; Blue for Soothing Mode and Yellow for any RTC Error.

Add the (2) Molex plugs for power and the screw terminal for the switch.  If you do not want to use a separate switch, just add a wire jumper or solder a wire across the pads on the PCB.

Add the (8) IC sockets - be sure to align the notches to match the PCB. 

Add the (10) pin cable connector sockets - be sure to align them according to the PCB - they are polarized.

Finally press the ICs into the correct sockets:

ULN2803As go in PORT H, PORT J, PORT K, and PORT L
MIC2981s go in PORT A, PORTC, PORT E/G and PORT F

Be sure to align the index mark on the IC with the indention on the socket.

This completes the second major part of the project!

Step 22: Power Up!

Picture of Power Up!
Connect the PCB to your power supply.  You do not need to connect the LED Matrix ribbon cables at this time - you should see the Red Power Indicator LED illuminate, but nothing else. 

Step 23: Programming the Atmega2560

Picture of Programming the Atmega2560
USBTiny 1.jpg
If you already have a programmer that you are comfortable with, you can skip ahead to the next step...

Otherwise.....

We need a way to communicate with the Atmega2560 so we can configure and program it.  My favorite programmer is the USBTiny from AdatFruit.  The application that works with this programmer is AVRDude.  

Link for USBTiny - http://www.adafruit.com/products/46

Download AVRDude - http://www.ladyada.net/learn/avr/setup-win.html

Tutorial for AVRDude - http://www.ladyada.net/learn/avr/avrdude.html

Before we are showing off our new LED Matrix, we need to do two things to the Atmega2560.  First, we need to configure the chip by setting a 2 Fuses.  Then we need to load our software program into the Atmega's memory.  The USBTiny and AVRDude can handle both of these tasks.

Step 24: Connecting the USBTiny to the PCB

Picture of Connecting the USBTiny to the PCB
Before you begin, remove the jumper from the USBTiny that provides power from the programmer to the PCB.  Connect the USBTiny to the AVR Port on the PCB - be sure to align the index marks on the port and the connector.  On the PCB it is indicated by 'JP1'.  Connect your power supply to the PCB.  Connect the USB cable to the programmer and to your PC. 

These are Windows-style instructions, you may have to adjust to your environment.  In a CMD window enter:

avrdude -p m2560 -c usbtiny

If things are working correctly, you should see a brief response with a Device Signature that indicates the Atmega is the correct one and the initial fuses are good. 

If you get the rc=-1 error code, you may need to pull the USB cable from the PC, wait a couple seconds and reconnect it.  Try the command again.

If you are still having problems, try the Ladyada USBTiny FAQ / Troubleshooting site:


http://www.ladyada.net/make/usbtinyisp/help.html

Step 25: Setting the Fuses

Picture of Setting the Fuses
Atmega2560 hfuse.jpg
Atmega2560 fuse verify.jpg
Atmega Fuses.jpg
A word of caution on setting fuses - double check your values before you program the Atmega.  Setting the wrong bits can completely brick (ruin) you processor to the point where it cannot be salvaged.  I have done it - it is not a pretty sight.

If you want to cut to the chase here are the commands to set lower (lfuse) and upper (hfuse) fuses:

avrdude -p m2560 -c usbtiny -U lfuse:w:0xff:m

avrdude -p m2560 -c usbtiny -U hfuse:w:0x99:m


The ATmega2560 has (3) fuse bytes - Low, High and Extended.  We are only making changes to the Low and High bytes.  These fuses configure various parameters that determine how the Atmega will perform.  For example, we have to set a bit to allow the Atmega to use an external high speed crystal oscillator.

If you set these wrong in some cases, you cannot recover.  For example, if you disable the reset button, you can't re-program it. If you select the wrong clock source, it might not boot at all.

For further reading - here is the datasheet on the Atmega2560
http://www.atmel.com/images/doc2549.pdf

Here is another good explanation on fuses: http://www.ladyada.net/learn/avr/fuses.html

Step 26: Testing the Matrix and Loading the Animations

Picture of Testing the Matrix and Loading the Animations
32x32 hex.jpg
32x32 eeprom.jpg
There is a test program in the downloads section to help troubleshoot your LED Matrix.  First it turns all of the LEDs on for 5 seconds, then it checks for correct orientation by sequentially lighting the corner LEDs in this order (0,0), (31,0), (31,31) and (0, 31).  Repeat and Repeat...

It also checks the DS 1307 and the Heartbeat LED on the PCB.  If the RTC is not working, the RTC Status LED will be turned ON.  The Heartbeat LED should blink.

Use the AVRDude for programming:

avrdude -p m2560 -c usbtiny -B 1 -U flash:w:32x32_test.hex

If everything is correct, your LED matrix should start displaying the test patterns immediately.  My first attempt showed (3) errors - I had a partial row of LEDs that would not light.  This turned out to be a bad / broken solder joint on the LED matrix.  The other two were a little more difficult to track down and fix.  I had a cold solder connections on the pins in the Schmartboard.  Not the Atmega chip legs but the pins connecting it to the main PCB. 

When you have a working matrix, it is time for the real fun - loading the animations.  The firmware is programmed using the same procedure as with the test code.

avrdude -p m2560 -c usbtiny -B 1 -U flash:w:32x32.hex

Since the program also uses EEPROM memory, we also need to load that code segment.

avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:32x32.eep

Your 32x32 Matrix should start running through the animations as soon as the firmware is loaded.

Congratulations!

Step 27: Software Annimations

There are 29 basic ‘routines’.  Several are driven by random numbers and others have sub-patterns that are controlled by specific parameters.  Here is the list of animations and brief description.  Some are very basic and some are quite complex.

All On
– Mostly used for test routines
All Off – Used between animations
Horiz 1 – Run LEDs from Left to Right then Top to Bottom
Horiz 2 – Run LEDs from Right to Left then Top to Bottom
Horiz 3 – Run LEDs from Top to Bottom then Left to Right
Horiz 4 – Run LEDs from Bottom to Top then Left to Right
Lissajous – Mathematical formulas for the Lissajous patterns.  Generates 8 sub patterns based on parameters
Spriograph -  Mathematical formulas for different Spirograph patterns.  Generates 21 sub patterns based on parameters.
Rain – LEDs ‘raining’ down – starts slow, then builds to heavy rain then slows
Snake – Pattern running through the matrix
In Out – Patterns running in and out in rings of LEDs.  Combinations on leaving the LEDs and progressing in and out.
Random1 – Slowly  turn on more and more LEDs until all are on, they slowly turn them all off.
Random2 – Turn LEDs on and off in a random fashion
Random3 – Turn on a few LEDs, then using a ‘sweep’ action, turn them off
Text Writer – Routines to create and scroll text across the matrix.  Random messages are displayed
Scroll clock – Routines to interact with DS1307 RTC and display the current date and time
Diagnal1 – Turn LEDs on and off in a diagonal fashion – Top Left to Bottom Right – half panel
Diagnal2 - Turn LEDs on and off in a diagonal fashion – Top Right to Bottom Left – half panel
Diagnal3 - Turn LEDs on and off filling full matrix.  Full panel
Sweeper – Rotating line of LEDs from corner to corner
Sweeper2 – Rotation starting in center moving clockwise for 360 degrees
Arrow1 – Solid arrows of LEDs moving Up, Down, Left and Right – in then out
Arrow2 – Random spaced arrows of LEDs moving Up, Down, Left and Right.
Spinner – Math function using sin and cos functions
Circles – Generate circles of progressive radiuses.
Fireworks – Randomly generate fireworks that include the launch, explosion and showers of sparks.
Block Fill - Squares of either 2x2 or 4x4 that move about the matrix in a random pattern filling the Matrix.  The progression continues until the Matrix is completely ‘on’ or no more moves are possible.
Blocks – Blocks of 4x4 LEDs that move around the Matrix but only to an ‘open’ (LEDs are off) space.
Fingers - create a finger-like pattern followed by a checker-board like pattern

Step 28: File Downloads

Here are the files for the project:

32x32.cpp

32x32.hex

32x32.eep

32x32 test.hex

Eagle Files

BOM

pued1 year ago
hello.
job you. I test run on proteus not work.you help me.
thank you.
http://www.4shared.com/rar/jn78iLMw/32x32_2.html
rclayled (author)  pued1 year ago
pued - hello! I will help you. I cannot open the 32x32_2.dns file. What kind of file is it? I can open Eagle files - .brd or .sch

Rick
goldbar29752 years ago
wow! thats cool. nice job