controling common ANODE rgb led's

hi! i just got some rgb led's and they are strangely common anode led's. I'm not sure how to hook up this common anode led's, all i know is that i usually connect all anodes to the pins ( 0 - 13 ), so i'm ued to common cathode things, like common cathode 7 segment displays.

how do i hook up my common anode rgb led's so i can light up the individual colors?

o yea, and it seems that when i turn on blue and green, they can mix, but when i turn on red, blue and green turn off, and i cant have blue and red at the same time, or green and red, but green and blue works, why is red stealing all the love?

thanks -big93

http://chaokhun.kmitl.ac.th/~kswichit/2051/7-seg/7-seg.htm

Voltage to the anode, resistor to the cathodes, resistors to the sink device (microcontroller pin, digital IC or some other device to provide a LOW)

huh? sorry i'm confused, in lame mans words, do i have to buy ANOTHER ic to make common anode things work with the arduino?

if not, please further explain, i dont quiet understand, and the link sends me to a 7 segment display, and i have an rgbled, sorry for my nubishness...

big93

Nope.

Think of it this way - normally you would have an LED connected between an Arduino pin and ground, and when you want to light it up you send a HIGH signal to the arduino pin.

Another way of doing it would be to connect the LED to an arduino pin and the other side to 5V. Then when you light it up, you send a LOW signal to the arduino pin.

You should (if I'm interpreting your question correctly), be able to connect the LED's common ANODE to +5V, the three CATHIODES to digital pins, and light the colours by sending LOW signals.

You should be able to use any of the RGB LED examples out there, just make the substitution on the hardware side by swapping the anodes and cathodes, and on the code side by swapping HIGHs for LOWs.

wait, connecting a pin to 5v, and setting it to high sounds like it makes sense, but what if its turn on high accidentaly, wont it short? and what if i wanna pwm it? you know, dimm it on and off?

Connecting the anode to 5v and the cathodes to the arduino pins will result in 5v between anode and cathode when the respective digital pin is low, and zero volts between anode and cathode when the pin is high. The only current flow will be when the pin is low.

PWM should work, but in the opposite sense, writing 0 would be maximum brightness and 255 would be off. analogWrite (255-val) should make it work the same as analogWrite(val) with the more conventional LED connection.

I ended up doing something similar with my LED display using HEF4794 IC's the all the LEDs get +5 on one end and the IC on the other, taking them low turns them on.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1195995586

wait, connecting a pin to 5v, and setting it to high sounds like it makes sense, but what if its turn on high accidentaly, wont it short? and what if i wanna pwm it? you know, dimm it on and off?

No sure what you are asking here... You DON'T connect the arduino pin to 5V, you connect the CATHODE of the LED to the arduino pin, and the ANODE of the LED to 5V. Then when you send a LOW signal to the pin, the LED turns on. Of course need your typical current limiting resistor in series with the LED - can be between the LED and the arduino of the LED and 5V,

Yes, as mem says PWM works, just need to again think of it in the opposite way - a value of 0 would be full brightness, a value of 256 would be full off.

ok, just one more question, isint the pin set on low by default, or when i write in the program DigitalWrite(led1, LOW), then its low, does that mean that there is a third state, in which nothing is hooked up?, i swear thats my last q about it lol and also can anybody still explain to me why red hogs all the colors?

blue and green mix well, but when red is turned on, it takes out both blue and green, and i cant turn them on!

ok, just one more question, isint the pin set on low by default, or when i write in the program DigitalWrite(led1, LOW), then its low, does that mean that there is a third state, in which nothing is hooked up?, i swear thats my last q about it lol and also can anybody still explain to me why red hogs all the colors?

blue and green mix well, but when red is turned on, it takes out both blue and green, and i cant turn them on!

Yep, there is a third state. I think when you start up the arduino, the digital pins are "floating" - i.e. not high, and not low. Another way of doing it is to specifically put the pins into a high-impedance state by doing a

pinMode(pin, INPUT);

statement.

You need to balance the current going into each of the colours, if one is specifically brighter than the others. Play around with the individual current limiting resistors - make the one on the red pin a bit higher than the others - if the others are using 220 ohms try a 330 ohm. There are heaps of examples out there talking about this.

what do you mean by "high-impedance state"? what does this statement do once i put it in void setup?

o yea and before you answer, can i use one resister to pwer one rgb led, or do i need one resistor for each color?

High Z aka high impedance is as close to an open connection as you can get and still be connected to the chip. It's not providing a low (ground) nor a high (+5V).

I'm not sure if you set a pin as an input that it will be high impedance, the statement would set the pin as an input. I'd have to check.

You can't cheat and do it well, use one resistor per LED and you need to calculate the resistor based on +5V and the current needed and forward voltage of the LED.

This nifty calculator will tell you the value and wattage needed for the resistor. http://led.linear1.org/1led.wiz

The datasheet should tell you the forward voltage and current for each color in that RGB LED.

This one shows each on a web page, most others are PDF files. http://superbrightleds.com/TriColor%20LED.htm

Red VF=2.0v IF=20ma at 5v resistor is 150 ohm 1/8 watt Green VF=3.5v IF=20ma at 5v resistor is 82 ohm 1/8 watt Blue VF=3.5v IF=20ma at 5v resistor is 82 ohm 1/8 watt

I just grabbed that link off google but they have a nice variety of LEDs.

oh, wow, i just had the arduino hooked up to do the 3 potentiometer, 3 led color dimmer thing hooked up to my proto board, and i was thinking..."hmmm how about instead of 3 leds ( red green blue ) how about i test this rgb led the way that dude told me!" and i hooked up the anode from ground to 5v, and i changed around the ground and 5v of the potentiometers, and it worked! it was freaken awsome! i was mixing colors with ONE LED!!! JUST ONE LED GAVE ME LIKE 256 DIFFRENT COLORS!!!!. as you can see, it was pretty awsome.

and it had 3 indavidual ressisters hooked up ( they were 1k resistors ) to the individual legs, so maybe they need individual resistors to make it mixable...

thanks man for the advice, and i dont thing i have to worry about having resistors to mess around with, i just bought a 370 piece resistor set, and they are all half wat which is what seems like the standard...

but thanks for solving my problem, i'm happy i can still use my rgb leds!

Cool! Now do an instructable and post the link. ;)

Then go make this fur coat cause it's pimpalicious!

http://blog.makezine.com/archive/2007/12/faux_fur_led_coat.html?CMP=OTC-0D6B48984890

hahaha yea right!

lol but that fur coat is awsome, u must need alot of juice for dat

If you figure 20ma per LED then 100 of them would draw 2amps. With that divide the amp/hr by 2 to get time it would last approx.

4.6amp/hr would last 2.3 hrs give or take

hahaha yea right!

lol but that fur coat is awsome, u must need alot of juice for dat

see, i dont get the point of amps, i see voltages and i stop looking, what are amps good for? i just dont understand them, like what do they tell me?

http://en.wikipedia.org/wiki/Ampere

see, i dont get the point of amps, i see voltages and i stop looking, what are amps good for? i just dont understand them, like what do they tell me?

http://en.wikipedia.org/wiki/Ampere

see, i dont get the point of amps, i see voltages and i stop looking, what are amps good for? i just dont understand them, like what do they tell me?

10th grade geometry doesent cover 1/10000000 of what they talk about! lol ill google it, but thans, i get the generla jist of what amps are

Try to find a used "Basic Electronics" by Grob

http://www.amazon.com/Grob-Basic-Electronics-Books/dp/002802253X

The book to start with for any of this. You can also use the free books on

http://www.allaboutcircuits.com/