3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Control Anything with one AVR pin

Control Anything with one AVR pin
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.


 
Remove these adsRemove these ads by Signing Up
 

Step 1Parts and Tools

Parts and Tools
Parts:
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
Wire


Tools:
Soldering Iron
« Previous StepDownload PDFView All StepsNext Step »
12 comments
Sep 7, 2010. 5:44 PMbudabob07 says:
its more like 7 pins than one pin, but good guide. isnt charlieplexing better than multiplexing though?
Nov 19, 2009. 2:02 PMKayvonX says:
You probably want those LEDs facing the other way. In this diagram, they're reverse biased and won't light up.
Aug 30, 2009. 8:07 PMPhoto-Worx says:
I'm not trying to be negative or anything, but the title is kind of misleading. You are not actually controlling the LED's with one output pin of the attiny2313. You are controlling each row of led's with it's own output pin, so you are actually using 7 output pins. To do it properly you would use a serial led driver chip like the A6279 from Allegro and use one output pin on the attiny2313 to send the serial data to the led controller. I am working with these chips and they are great. each chip controls 16 outputs and they are chainable to control even more led's.
Jul 10, 2009. 1:52 AMsyrax says:
You can use simple shifting algorithm for moving

// code left shift
byte = 0x01; //0b00000001
for(x=0; x<7; x++){
PORT = byte;
byte << 1;
_delay_ms(200);
}

// code right shift
byte = 0x40; //0b01000000
for(x=0; x<7; x++){
PORT = byte;
byte >> 1;
_delay_ms(200);
}

// code fill right
byte = 0x40; //0b01000000
for(x=0; x<7; x++){
PORT = byte;
byte >> 1;
byte |= 0x40;
_delay_ms(200);
}

REGARDS FROM BULGARIA
Jul 11, 2009. 3:38 AMsyrax says:
it is high level of programming :))) easy, fast ... only one is not so good when you write C the compiller transform this in asm /not so good like human / :) the programs are little bigger
Jun 23, 2009. 12:51 PMAndyGadget says:
I see you're using each bank the same colour, but beware of mixing colours within a bank as the perceived brightness of the various colours varies even though the current is the same. I found this in my recent Instructable and used different resistor values to compensate. Green was the brightest, then blue, red, yellow (didn't use white). Experiment to get them matched up.
(BTW, your LEDs are drawn reversed in the schematic.)
Jun 24, 2009. 3:10 PMAndyGadget says:
Agreed, but I'm saying something a bit different :

If you put (say) 15mA through a green, a blue, a red and a yellow LED (taking the Vf into consideration), the green will appear brighter than the blue, the blue brighter than the red etc. because of different efficiencies of the LEDs and the eye's sensitivity to the different colours.
For my project, I initially did the calculations for the same current through each colour LED and found it no good at all, so I chose the resistor values by 'eyeballing' it.


Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
1
Followers
1
Author:jufreese