RGB Led

HI all,

Well, I received my Arduino today. :slight_smile:

Rather than jump straight in to my proposed first project (See http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1213165074 ), I thought it might be wise to start with something simpler.

I thought what I might do is make a nice glowing orb, much like this one over at todbot ( http://todbot.com/blog/2006/10/23/diy-ambient-orb-with-arduino-update/ ) except that mine would just cycle randomly through colours.

So, I went and bought one of these:
http://www.jaycar.com.au/productView.asp?ID=ZD0270&CATID=&keywords=rgb&SPECIAL=&form=KEYWORD&ProdCodeOnly=&Keyword1=&Keyword2=&pageNumber=&priceMin=&priceMax=&SUBCATID=

Firstly I programmed Ardy to only light one colour, then turn off that colour, then light the next colour, then turn that colour off, then finally light the last colour, then turn that colour off, and back to the beginning. i.e. it cycled through the three colours RGB. That worked a treat, and impressed the girls.

Then I thought that rather than turn each colour off, I would leave the colour on before turning the next colour on, thereby combining the colours. This doesn’t work. It either just stays the first colour, or turns the second colour on and the first off.

Why is this? (It’s not my code.)

Is the LED even capable of doing this? Or is it something to do with the Ardy (like maybe not enough juice?)

Your advice is appreciated.

Wongdai

How have you got it wired up that could be the problem.
It’s common cathode so one way to wire that up is that the cathode should go to earth, with each anode through it’s own resistor to each Arduino pin. Then a high turns it on.
It’s either that or it is the software. Let’s see it.

EDIT. I’ve just twiged what you have probably done. Wired all the anodes to the Arduino pins and then put one resistor in the cathode to ground. That would work exactly as you describe because the different colours of LED drop different voltages across them so ensuring only one will be on at once.

OK, so what I have is the common going to earth via a 100k resistor. Each of the other legs (catodes?) goes to a different digital out on the ardy. That’s reverse to what you say above, but it’s basically the same, no?

Edit: (coz I just saw your edit ;D ). So it’s not the same? I need to have a resistor on each of the pins, but not the common ground?

I need to have a resistor on each of the pins, but not the common ground?

Yes that’s it. :wink:

Now wire it up to PWM pins and watch those colours blend. :slight_smile:

I need to have a resistor on each of the pins, but not the common ground?

Yes that’s it. :wink:

Awesome. Thanks for your help.

I’ll have to go out and buy some more resistors. I only had one. :’(

Fantastic, I have never met anyone who had only one resistor. Zero - lots, lots - lots but only you have one. Made my day :slight_smile:

… and after months spent learning to play notes one at a time you progress to… chords.

Also where are these girls that you are impressing? I’d like to meet them.

Also where are these girls that you are impressing? I’d like to meet them.

I got the impression they were his kids.

Also where are these girls that you are impressing? I’d like to meet them.

I got the impression they were his kids.

Exactly. ::slight_smile:

Well, my glowing orb project is a complete success. It goes through pretty much all the combinations of R+G R+B B+G etc, but not all the three colour combinations (some though). I will probably leave this as an exercise for some other time.

I need to go and do a bit of research into how subroutines work in ardy now, so I can tidy up my code somewhat.

Also where are these girls that you are impressing? I’d like to meet them.

I got the impression they were his kids.

Damn - not the answer I was imagining!