Using Arduino to change the colour of TRI LEDs

With a common anode LED, you connect the LED to the positive power supply (5V) and to an I/O pin, via a resistor. Setting the pin LOW makes the LED light up. With a common cathde LED, you connect the LED to the negative power supply (Gnd) and to an I/O pin, via a resistor. Setting the pin HIGH makes the LED light up. With darlington driver chips like the ULN2803, you can't set the pin HIGH, so they only work with common-anode LEDs. Anode = positive end of LED, cathode = negative end of LED.

Pull-up and pull-down resistors are only used with input pins.

OK ive decided to make things a bit more simple and use a Arduino Duemilanove on the PWM pins, ill make up another diagram later

Edit: Here it is

Notes:

  1. the reason for going PWM is so i can have different/more colors
  2. i have two different clusters (front and back) so that they can be turned on and of independently later.

Questions:

  1. Is Pin 9's tracers going to the right place (+5v) (or should it have no traces)?
  2. will the ULN2003 Allow PWM?
  3. if i turn of one set of LEDs would the Circuit still be stable (I belive it should be, just checking ;))
    4.Anything Else?

Bump

Your LED anodes should be connected to +5 not ground.

I wouldn't recommend connecting the three LED cathodes in parallel as you have shown. The three LEDs will have different forward voltages, and so the one with the lowest forward voltage will light up and the one with the highest will be dim. Best to have one resistor per LED. Yes, I know it's a lot of resistors, but that's how these circuits turn out!

Pin 9 to +5V is correct. As Mike says, connect the common anodes of the RGB LEDs to +5V. PWM will work via a ULN2003.

ok then, ill put up another Schematic when i finish it, this forum needs some sort of reputation system you guys would of already would of gotten more that Half a dozen reps from me. :slight_smile:

Edit: done the Schematic.

Also i have found a LED Shop in Australia, it doesnt have any Info on foward voltage ECT, so i will shot a email out their way to get some info.
http://www.ledsales.com.au/cart.php?target=product&product_id=244&category_id=11

Any Other Sugestions, you guys have been great :slight_smile:

wow those leds are expensive. Check out one of the chinese shops or ebay, you'll save a few bones.

http://www.seeedstudio.com/depot/5mm-triple-output-led-rgb-common-anode-p-25.html?zenid=0bdef412a3459fb3b0eed974ea1a3fd2

How bout these

free shipping/resitors

http://cgi.ebay.com/50pcs-Diffused-5mm-4-Pin-Common-Anode-RGB-LED-8-000mcd_W0QQitemZ250408746964QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item250408746964&_trksid=p3286.c0.m14&_trkparms=72%3A1240|66%3A2|65%3A12|39%3A1|240%3A1318|301%3A0|293%3A1|294%3A50

is the Schematics alright?

Now you've made the schematic worse! You have swapped the LEDs around to common-cathode types. You need the common-anode types, and connect the left-hand end (as shown on the diagram) to +5V, not Ground.

Those LEDs, by the way, come with resistors for 12V, but you need resistors for 5V.

yeah and remember when you are buying the resistors, you need 3 times as many resistors as LEDS. Also I'd buy different resistors for all the color cahnnels dependong on the volage drop.

Now you've made the schematic worse!

ok someone shoot me. i'm totally confused now :-/

But i think i have been miss interpreting you when you mean switch 5v with GND, i thought you meant flip the LEDs

so i am tacking a guess here but i think you mean this.

Also a few questions:

  1. i think i will use a Resistor array like this, is it sutable
    http://australia.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=5225535
    should i draw power from the USB or from a Molex Conector?
    3 does someone know the Specifacations for the RBG LEDs a Seeedstudio?
    http://www.seeedstudio.com/depot/5mm-triple-output-led-rgb-common-anode-p-25.html

Bump

and a few more questions,

1.should i just draw the power from the USB, or should i use the +5v that i have been using?
2. if i use the +5v pin will it disconect the USBs power automaticly?

should i just draw the power from the USB, or should i use the +5v that i have been using

Don't try powering that number of LEDs from the USB.

if i use the +5v pin will it disconect the USBs power automaticly?

It depnds on which Arduino you're using.

yeah that what i thought. 200ma tops for a USB

i will be using a Duemilanove.

The polarity of the LEDs, power and ULN2003 are OK now.

thats what i wanted to hear! :stuck_out_tongue: haha

i have a PCB design in Eagle, it is designed to be used as a shield.

the traces widths go like this:
+5v and GND traces are 16 mil
PWM connectors to ULN 2003 to resitors are 12 mil
Resitor to LED 10 mil

Are these measurement appropriate?

Top Traces, Bottom Traces and Silkscreen

Top Traces and Silkscreen

Bottom Traces and Silkscreen

Silkscreen

The Schematic

I'm thinking of making something similar ( have some RGB-led strips, common anode) but they run on 12v. Do I understand this uln2003 correctly when I can just connect an external 12volt power supply on pin 8+9 and the pwm outputs to input 2-7 or do I say something stupid now.

Deodupke, if you are using a Arudino you have to use 5v for pin 9 i believe. as that is the same voltage that the Arduino outputs

pin 9 goes to ground

what sort of LEDs are you using could you just change your resistors to something more suitable for 5 volts.

im going to get this designed made properly on a PCB, your are welcome to one of the 4 extra PCBs i will have afterwards

here is the service i will be using
http://www.seeedstudio.com/depot/propaganda-pcb-service-p-316.html
the cost would be $5 for the PCB and $5 shipping directly to you
because i cant guarantee that the design will work i am happy to refund if there is design problem. there shouldn't be one :p.

Do I understand this uln2003 correctly when I can just connect an external 12volt power supply on pin 8+9

No if you are using 12V then pin 9 of the 2003 should go to 12V or left unconnected if you are just switching LEDs. Pin 8 should go to ground.

Then you can connect the arduino outputs to the 2003's inputs.

ok threadjacking aside, any thoughts guys?