Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RGB LED control

Status
Not open for further replies.

MrMikey83

New Member
For a project I'm working on, I have purchased several RGB LED's. There is one cathode and 3 anodes, one for each color.
They will be controlled by an ATMEGA32.

I need to figure out a way to have one output turn the LED on and off, while 3 other outputs control what color is lit. So, 4 outputs total, one on the cathode side and one on each anode.
Do I do this with transistors? If so, how? I did a mockup on the breadboard with switches instead of the ATMEGA32 and somehow, colors lit that weren't supposed to.
Thanks
~Mike
 
Cliff notes: Use 300 ohm current limiting resistors on each cathode and don't worry about any other discreet transistors or switches for controlling the LEDs

Each individual pin is rated for 40 mA on the AVR, so assuming 10 mA per diode the 'master' pin would only have to sink 30 mA of current. Unless you want a single master to control ALL led banks....

If you're driving the chip at 5v, you'll need about a 300 ohm resistor between the output pins and the cathode.

With 32 IO pins, 4 pins per LED group, thats a max of 8 tri-color LEDs you could drive, 24 sources and 8 sinks. 240 mA source and sink if all LEDs are lit. The Vcc and GND pins are rated at 200 mA, but I'm not certain if its 200 mA EACH pin or 200 mA TOTAL. I think its each pin, and on the PQFP there are 2 Vcc pins (not counting AVcc which is PORTA power) and 2 GND pins (not counting AGND which also should be grounded). The PDIP only has one each so technically you could exceed the ratings, IF you're driving the max possible LED banks, but you're probably not....
 
Two of the ports will be to control the cathode side of two sets of display LED's for two lines of a message board. The rest of the LED's will be separate used for hands of a clock and need to be individually able to change color.
So...
---o----3 outputs for color
---o----3 outputs for color
---o---\
---o--- |
---o--- |
---o--- |3 outputs to change color for this bank.
---o--- |
---o--- |
---o---/
---o----connect to 2nd LED's color outputs
---o---\
---o--- |
---o--- |
---o--- |3 outputs to change color for this bank
---o--- |
---o--- |
---o---/
---o----connect to 2nd LED's color outputs

Each o is an LED.
The 2 groups of 7 LED's need separate inputes on the left side while 3 outputs will be needed to control the color on the left side.
The 'spacer' LED's between sections can be on the same 3 color outputs and can light up the same color at the same time. The top most LED is by itself with 3 color outputs. Hope this is more clear. I will probably need transistors or other switching device to turn on the groups of LED's.
~Mike
 
OK no answer to that...

How about if I need an output to control both anode and cathode side of a group of LED's, what type of transistor arangement would I need to construct?
~Mike
 
MrMikey83 said:
OK no answer to that...

How about if I need an output to control both anode and cathode side of a group of LED's, what type of transistor arangement would I need to construct?
~Mike

PNP ones at the top side (positive), and NPN ones at the bottom.
 
Status
Not open for further replies.

Latest threads

Back
Top