Pages

Thursday, September 19, 2013

LED Array Circuit

Blink and Current Limiting Resistors

In lab this week we got started with the Sparkfun kit and hopefully you all got acquainted the Sparkfun RedBoard (a.k.a. the Arduino Uno).

I believe that all the groups working with the board got the Blink program to work and were able to "blink" the on-board blue LED that is connected to Pin 13. Some groups were able to progress to setting up multiple LED's on the breadboard.

I noticed that some groups were doing this without using a current limiting resistor. Hooking up the LED without the resistor results in a maximum current from the I/O pin and this situation can end up "killing" the pin and can also burn out the whole ATmega328 chip.

You can read about this on the web - google "arduino max current", here is a summary...


LED Array and other circuits

I would encourage those of you with kits to go ahead and explore the kit and create a bunch of the test circuits. I would also like to share a couple circuits and sketches with you.

The first of these is and LED array. The following images show both the actual circuit on the breadboard and then three diagrams of the same circuit that I created using the Fritzing utility.


LED Array setup on Sparkfun breadboard

Diagram of circuit created using Fritzing




Schematic of circuit created using Fritzing




PCB layout for LED Array using Fritzing


Code samples

If you construct this circuit you can use it to run a number of test programs that you can use to explore some elements of C coding.

The Arduino sketches are below.

BlinkTwo - as the name implies, this program demonstrates how to set the sketch to blink two LEDs in unison.




BlinkTwoAlternate - as the name implies, this program demonstrates how to set the sketch to blink two LEDs in an alternating pattern.




LEDarray - this sketch uses the C array construct to simplify the process of setting up and running multiple LEDs. This code also introduces the use of the For Loop and IF and IF-Else constructs. Use this program o create the Knight-Rider effect.