Saturday, October 16, 2010

Arduino Output : LED, roll of LEDs and LED Matrix

As a beginner, after getting an Arduino board, the first tutorial is to control a Light Emitting Diode (LED) to make it blink or fade at different voltage levels and different timing using the delay function.

For the tutorial, please refer to http://www.earthshineelectronics.com/ and click on the External Links - The Complete Beginners Guide to the Arduino by  Mike McRoberts.

*** Always put at least a 220R or higher resistor between the standard 5mm LED and the Arduino pin to limit the current flowing through the LED. This is to protect the LED and also limit the current flowing across the pin back to Arduino. Even if you are using the correct voltage for the LED, you still need a resistors to limit the current. A good article here talks about LED in details and even have an experiment of using very small resistors between the LED to measure the current flowing through it.

LED have two or more legs, the longer leg is anode (a or +) and the shorter leg is cathode(k or -).
How do you find out the different legs if you have cut both the legs to the same length to be inserted into the breadboard. The way to identify this is easy, the flat side is the cathode as per the picture below.


By now, you would notice that the LED will only light up if you connect them correctly, positive (+) to the anode and cathode goes back to the negative or ground. The resistor can be placed before or after the LED to limit the current of the entire circuit.




This is a very good tutorial to introduce programming to beginners but it isn't very useful in the real world just to make LED on and off over and over again... LED indicator are very useful tool for debugging and to "see" what is going on especially during data transmission and wireless stuff.



When you combined a roll of LEDs together, you can make more fun stuff like LED VU meters to response to audio input or LED chaser on the car from an old tv series called Knightrider. You can control the speed of the LEDs to make it more lively. This setup will take up 8 pins from the Arduino.
If eight rolls of LEDs are combined together, it become a LED matrix like the picture below.

LED Matrix

There are single colour LED matrix or multi colour LED matrix for different usage. One thing you notice is that to drive a 8x8 LED matrix, you will need 16 pins ( 8 top and 8 bottom pins ) and Arduino do not have enough pins for this purpose. The solution is to use a chip called shift registers.. the most popular one are the 74HC595 Shift Registers. Another note for beginners is that if you get a 8x8 LED matrix that is too big, it will NOT fit into the breadboard, anything 3 cm or larger will not fit a single breadboard. If you are buying LED Matrix, please get the common cathode version.

LoL shield


A 9x14 LoL (Lots of LEDs, not Laugh out Loud ) Shield is a nice and clean shield to have without all the messy wiring on the breadboard. The details to make one is here.

Big LED displays


Here are some interesting projects and products using LED matrix. Small Room Labs did a 16x16 LED matrix and Sparkfun did a 64x64 LED Matrix coffee table. If you are not aware, most of the LED monitors and LED TV are made up of very very small three colour LEDs combined to display the graphics in a high resolutions like 1920x1080 LEDs.

7 segment LED display


Another common LED is a 7 segment LEDs that use to display number from 0 to 9. There are single digit or multi-digits parts to choose from. For the 7 segment LEDs, please get the common cathode (CC) version (all the LED cathode pins are connected together) as it is easier to drive the display with either a 74HC595 shift registers or a 4026 or 4511 chips. Both the 4026 and 4511 have 7 segments LEd display drivers/output but the inputs are different.

The 4026 is a decade counter (0-9) that takes input electrical pulses ( for example, every press of a button will increase the digit by one ) and display the digit on the 7 segment LED. This can be used for making a digital clock by sending an electrical pulse to the 4026 every second for the second digit.

The  4511 take in 4-bit binary coded decimal from 0 (binary 0000) to 9 (binary 1001) and display it to the 7 segment LED. An example would be to read an input from a temperature sensors and display the three digits temperature to the 7 segment LED using three 4511.

These useful chips (74595, 4026, 4511) are all building block to make functional gadgets found in other webpages.

Add on : I was viewing a youtube video on Sparkfun founder's speech on a google event and he mentioned something about this giant 7 segment, 12 feet GPS wall clock and how to make one. Why use GPS as a clock source, because GPS have the most accurate clock down to 100 nano seconds.

Please refer to Arduino Playground on the section about LED for more details on all the above mentioned.

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...