How to drive multiple LEDs on a single pin of a micro

Post Reply
User avatar
Shane
Captain
Captain
Posts: 226
Joined: Sun Jul 19, 2009 9:59 pm
Location: Jönköping, Sweden

How to drive multiple LEDs on a single pin of a micro

Post by Shane » Fri Jun 24, 2011 7:38 am

Each digital pin on the Arduino has an internal pull up resistor that can be turned on and off using the digitalWrite() command when it is configured as an output. When it is HIGH, 5V sent to the pin and can deliver 40mA of current. This is adequate to power an LED, but most devices that you will want to power will require more current. A device that is trying to draw more current than this can cause the Arduino to shutdown and could easily damage the chip. There are many methods to increase the current that can be sources on an output pin. When a relatively small amount of additional current is needed, a 2N3904 NPN Transistor (or any similar type) can be used to accomplish this. In this example, we connect four LEDs to one output pin using this simple transistor circuit. For powering higher current devices, see the higher current transistor or relay tutorials.
1.jpg
1.jpg (171.2 KiB) Viewed 3560 times
2.jpg
2.jpg (659.92 KiB) Viewed 3560 times
3.jpg
3.jpg (190.42 KiB) Viewed 3560 times
If you want to handle high current DC devices, have a look at How to handle high current DC devices using microcontroller
Courtecy of UMASS AMHERST
Post Reply

Return to “Arduino”