RGB LED relay question for series / parallel

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Hey all, i have drawn what i think is the correct way to hook up my RGB LED in series.



The way i see it is that:
- The relay will be turned on by the digital pin on the ardunio using 5v.
- Then the relay will connect and produce the 0v (gnd) to the RED LED pin on the RGB led.
- The Anode will be powered by 12v that will be in series of 19 LED's per 12v

Here is the datasheet:

http://www.lemicro.cn/rar/SRD%28T73%29.pdf

The black dots are the relay pins. 3 on one side and 2 on the other. From the picture below it seems as though i did hook it up correctly? With the coil being on the side of the 3 dots...




I used 3.3v as the forward voltage since that's the highest it will need to go (blue). So i figured the RED and Green would work just fine with that?

As for the ASCII drawings i changed the specs listed to:
Rich (BB code):
12v Source voltage 
3.3 diode forward voltage 
20 diode forward current (mA) 
18 number of LEDs in your array

Solution 0: 3 x 6 array uses 18 LEDs exactly
 * *+----|>|----|>|----|>|---/\/\/----+ *R = 120 ohms
 * *+----|>|----|>|----|>|---/\/\/----+ *R = 120 ohms
 * *+----|>|----|>|----|>|---/\/\/----+ *R = 120 ohms
 * *+----|>|----|>|----|>|---/\/\/----+ *R = 120 ohms
 * *+----|>|----|>|----|>|---/\/\/----+ *R = 120 ohms
 * *+----|>|----|>|----|>|---/\/\/----+ *R = 120 ohms
However, i have been told that i would not be able to connect this via series. How can i connect this using parallel?

David
 

SgtWookie

Joined Jul 17, 2007
22,230
David,
Your relay idea won't work, because the common terminal is not connected to anything.
The common terminal is the pin between the two coil connection pins. If you really want to use a relay, then ground that pin.

No, you cannot use those LEDs in series; you have to use them in parallel. You would be better off to use 5v for the supply voltage, as otherwise you'll be expending a lot of power in current limiting resistors.

You can use transistors or logic level power MOSFETs to multiply the current output of your microcontrollers' I/O pins.

But, you really need to tell us what the Vf is for each color at their rated current.

You will need one resistor per color per LED.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Hey SgtWookie!

In a nutshell this is what i am trying to do with my RGB project:





I have a distance sensor on my arduino and depending on how close you are, the green arrow will be lite if your further away, yellow if your mid-ways, and red if your really close to it.

The total number:
of Green RGB's is: 53
of Yellow (red+green) RGB's is: 53
of RED RGB's is: 64 (takes 32 from green layout)

And your suggestion about grounding the middle pin is like so?


The Vf is as follows:
Red = 2.0
Green = 3.2
Blue = 3.2
Yellow = ???

David
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
OK, for the red portion, you'll need 150 Ohms
For green, you'll need 91 Ohms.
For blue, you'll need 91 Ohms.
Ok good to know. I put the resistor on the anode part of the LED, right? And i take it all these are 1/4W 5% Carbon Film?

Can i make the 91ohms into 1k? It seems to be easier to find: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=CF14JT1K00TR-ND

And for the 150ohms: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=CF14JT150KTR-ND

Can i solder all the negative leads together (as in, all that will only light up green) and connect that to my relay to turn on/off?

To produce the yellow do i just turn on the green and red relay for each of those LED's that need to be on?

David
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Your RGB LEDs have a common anode. You connect the anode to the positive supply.
No, you can't connect the cathodes (what you are calling the negative leads) all together. Each cathode of each LED needs a resistor. I thought I spelled that out before?

This would have been somewhat easier if you had bought common cathode LEDs.

My time is really limited at the moment, and I'm away from my regular computer, so this will need to wait until later on this afternoon.
 

SgtWookie

Joined Jul 17, 2007
22,230
The end of the relay with three pins; if you connect 5v across the two outer pins with nothing else connected, you should hear the relay click.
 

SgtWookie

Joined Jul 17, 2007
22,230
The 1N4004 may not switch fast enough to protect the NPN 2N2222 transistor. We had another poster with that problem just the other day. Use a 1N4148 or 1N914 diode instead.

The relay coil has ~70 Ohms resistance, so you'll need ~70mA current flow through the collector of the transistor to turn it on, and 7mA current flowing through the base.

Let's calculate the base resistor. You said you're using 5v for your Arduino.
Rbase ~= (Vcc-Vbe) / (Ic / 10) = (5-0.7) / (70mA/10) = 4.3/0.007 = 614 Ohms.
You're a bit high with that 1k Ohm resistor.
Here's a standard decade table of resistor values: http://www.logwell.com/tech/components/resistor_values.html
620 Ohms is the closest standard value in the E24 range. You could also use 560 Ohms.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
The 1N4004 may not switch fast enough to protect the NPN 2N2222 transistor. We had another poster with that problem just the other day. Use a 1N4148 or 1N914 diode instead.

The relay coil has ~70 Ohms resistance, so you'll need ~70mA current flow through the collector of the transistor to turn it on, and 7mA current flowing through the base.

Let's calculate the base resistor. You said you're using 5v for your Arduino.
Rbase ~= (Vcc-Vbe) / (Ic / 10) = (5-0.7) / (70mA/10) = 4.3/0.007 = 614 Ohms.
You're a bit high with that 1k Ohm resistor.
Here's a standard decade table of resistor values: http://www.logwell.com/tech/components/resistor_values.html
620 Ohms is the closest standard value in the E24 range. You could also use 560 Ohms.
I was trying to follow this schema here:


But im not sure what would be equivalent to the BC238 transistor they have in it.

David
 

SgtWookie

Joined Jul 17, 2007
22,230
The 2N2222 is a better choice. The BC238 would have had a higher Vce(sat).

But like I suggested, you may have zapped the transistor because the switching of the 1N4004 diode was too slow. The 1N4000 series doesn't have any specifications for turn-on or turn-off times. They're just used for slow sine waves.

You also might have installed the transistor incorrectly.
 

SgtWookie

Joined Jul 17, 2007
22,230
You have the collector connected to ground. You're supposed to have the emitter grounded instead. Move it from g51 to g49 (the black wire).
You have the relay coil ground side wire (orn/wht) isolated by itself. You need to plug that in to f thru i (pick one) on 51, so that it's connected to the collector of the transistor.

You should also change the resistor from 1k to 560 Ohms or 620 Ohms. It might work with 1k, but it may not work with all transistors, and the transistors might overheat using 1k.
 

SgtWookie

Joined Jul 17, 2007
22,230
Check the drawing again.. updated it
You still have the connections to the collector and emitter swapped.
Look at the package image again; it's the bottom view, not the top view.

From left to right, face towards you, it's (1) emitter, (2) base, (3) collector.
 

SgtWookie

Joined Jul 17, 2007
22,230
Awwww, rats. You have the relay wires swapped!

Pull the orn/wht wire from f49, and plug it in on the POSITIVE rail (the diodes' cathode must go to the positive rail).
Pull the orn/wht wire from the negative rail, and plug it in to f51.
Remove the black wire from g51 and plug it into g49.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
You still have the emitter and collector connections swapped.
Isn't that correct though? As the package for the transistor has 321 which is collector base and emitter

In the drawing the emitter (far right) is grounded
the middle is base
and the far left is the collector?

David
 
Top