This instructable shows how to control a group of led’s with one microprocessor output.
The micro I will be using is an Atmel Attiny2313.
Step: 1 Parts and Tools
Attiny2313 (got 5 free samples from Atmel)
20 pin socket
Resistors (any size will work, depending on your setup. I will explain later)
5v regulator (any will work, I’m using an LM340)
Transistors or Mosfets (easiest to find and cheapest ones are usually 2n3904’s. Just make sure it’s an NPN transistor, or an N-Channel Mosfet)
2 small Capacitors (look up data sheet for regulator, .1uf and .22uf with LM340)
Lots of LED’s
Some protoboard or a breadboard
Any programmer for the AVR
Step: 2 Schematic and How it works
The first schematic shows how I hooked up rows of led’s to output pins. The output pin of the AVR goes to the base of a transistor, which is wired to work as a switch. When the output is low, or 0v, the transistor is off, and the current can’t flow through the load to ground. When the output is high, or 5v, the transistor is on and current can flow through the load to ground. This is called low side switching, and can be used for led’s, dc motors, stepper motors, and many other things that require more voltage or current than the micro can output.
The load for this project will be some led’s.
The led’s can be wired any way that you want, but the power supply you are using will determine how you can hook them up.
For me, I found a laptop charger which can output 16v at 7.5 amps max.
Now the most efficient way to hook up the leds was in a series parallel array as shown in the third picture.
To determine the resistor size, first find out how much voltage is dropped per led. For blue and green led’s that I used, the voltage drop is around 3 to 3.3 volts. Red and yellow led’s are around 2.2 volts.
Now add up all of the voltage drops in series (3*5=15v)
Now subtract that from your source voltage (16-15=1v)
Now you know how much voltage is dropped by your resistor (1v)
Now use ohm’s law to solve for R: V=IR (1v=.015R)
*I used 15ma for my led’s, this is typical for 5mm led’s
So now each strand is using 15ma from your supply.
Each strand can be its own load, or you can attach as many together as you want, as long as the total current for that load does not exceed the limit for the transistor. (2n3904 can handle 100ma)
*The transistor can be replaced with an N-Channel Mosfet
For more detail: Control Anything with one AVR pin using Attiny2313 microcontroller
This free embedded project also found using:
- Atmega8 dragon rider