Simple RGB led (or alternatives) setup

Thread Starter

itolond

Joined Feb 27, 2010
23
Hi Forum,
Apologies for the newbie questions here...

Scenario - planning to setup a backlit illuminated panel for the car (carling switches -12VDC). The backlit panel will be illuminated via LEDs-
the objective:

if possible would the to use a sequence of RGB LEDS which change colour depending on corresponding Carling (rocker) switch position.
the resting backlight would be Blue (which is handy) but i want to colour to change based on the switch (some are SPST, some are SPDT), Which would mean at some level the RGB led would operate independently. (with an inline resistor for 12VDC or do this via the common earth - see below)

Secondary control LED brightness - have i got this wrong but i can use the common ground via a PWM to set brightness across all LEDS whilst the 12VDC will operate the RGB led?
 

Tonyr1084

Joined Sep 24, 2015
9,744
Not sure I'm following exactly what it is you want to do. So I'll start with one part of your question: Blue background changes when switch is in (let's assume) ON, and (let's assume) RED. For that you'd need a double pole double throw (DPDT) switch. The common connection on the switch should be tied to ground and both red and blue LED's should be powered when the car is on. Each LED will need its own independent resistor to set the max brightness of the LED or it may burn out. The second part of your DPDT switch controls whatever electronics you wish to control.

The second part - brightness: You can use PWM to dim the LED's as you propose, but it has to be independent of the part of the switch you're using to control something else. In other words, you turn the key, the engine starts, power is supplied to all electronics in the car. Power routes to both LED's through independent resistors. The LED controlling side of your DPDT switch selects the color. From the common lead (that goes to ground) goes to ground through your PWM. Thus, you can control the brightness from there.
 

Reloadron

Joined Jan 15, 2015
7,887
From our friends at Carling:
"Carling offers a wide array of full-sized to miniature illuminated and non-illuminated snap-in Rocker Switches. Ranging from 1 to 4 poles, .4 VA to 20 amp, with many styles of solid colored, translucent, two-color Visi-Rockers. Certifications include UL, CSA, TUV, VDE, and more. Carling Rocker Switches include the V-Series Contura family and L-Series, which set the industry standard for IP66, IP68, and UL1500 ignition protection sealed switches".

Using a double pole rocker switch one set of contacts can control whatever you choose and another set of contacts can choose your LED color. Having full brilliance LEDs is easy. Now if we want dimming effects things get a little more complicated and adding some hardware is required. Just a matter of exactly where you want to go with this. Tonyr1084 summed it up nicely. A good response depends on exactly, in detail what you want and what effects?

Ron
 

Tonyr1084

Joined Sep 24, 2015
9,744
Tried to do a drawing in Paintbrush. But for some reason my PB isn't working right. I can draw a whole drawing but not be able to save it. I can start over and do a little, save it, close it, then open it again and do a little more, save it, close it, then open it again - - - . Not sure what's going on with PB, but ever since I installed that last update it's been wonky. Maybe I'll go back in my time machine (Mac product) and reinstall an older version of PB.

OR maybe I'll go on my laptop. I don't think I've updated PB there. We'll see. But the solution seems pretty simple once one understands what's going on. Pictures paint thousands of words.
 

Bernard

Joined Aug 7, 2008
5,784
Do the switches source or sink current & in what positions. Might need a lockout circuit to prevent interaction from 2 switches.
 

Thread Starter

itolond

Joined Feb 27, 2010
23
Not sure I'm following exactly what it is you want to do. So I'll start with one part of your question: Blue background changes when switch is in (let's assume) ON, and (let's assume) RED. For that you'd need a double pole double throw (DPDT) switch. The common connection on the switch should be tied to ground and both red and blue LED's should be powered when the car is on.
So you are saying just use independent LEDs vs RGB?


some clarifications....

A. Blue is the default illumination colour for the car - so all backlighting will be blue and operate from the standard acc circuit of the vehicle. It is intended that this will fall under the same model

B. the intent was to change the corresponding backlit panel (above each Carling switch) dependent on switch location SPST or SPDT. So assuming by acc is live blue would display, should a switch be triggered, the backlight for this switch only would change (from blue or a mix of blue + something else .. e.g RGB was my thought)

C. via the common ground dimming can be set when evening driving triggered by a simple relay with a PWM type unit

D. keep in mind the primary fo this is the carling switched which are only SPST/SPDT on will provide 12VDC triggers (do wish to go back and reorder a bunch of rockers)

if i was to use independent LED vs RGB then how would i have the blue backlight (acc light) turn off when power is received to the separate LED
 

Bernard

Joined Aug 7, 2008
5,784
On SPDT , is there a center open ? If not there might never be a Blue if the 2 positions are assigned to say Red & Green ??
 

Tonyr1084

Joined Sep 24, 2015
9,744
OK, well, if constraints are to use only SPST or SPDT, then I'd go with the SPST. When the device is switched on you can cause a second color to illuminate, thus changing the background color. I'll have to get on my laptop to draw a diagram, but I think I have a solution to your problem. Be back in a short while.
 

Tonyr1084

Joined Sep 24, 2015
9,744
They say a picture paints a thousand words. OK, here's a picture for you; along with some descriptive verbiage:

Below you see the ACC line. When you turn the car on the blue LED will light up through the PWM. The PWM will also be active when the key is on. The head unit (whatever it is you want to switch on or off) is only active when you turn SW1 on. SPST or SPDT, doesn't matter. I show SPDT. SPST - just omit the unused connection in the drawing.

When you turn the head unit on you also turn on an additional color - be it a RGB LED or two different LED's. Your choice. And it doesn't have to be red it can be whatever color you have available. When the head unit is active (on) so is the red (my illustration) LED. The red and blue LED should produce somewhat a yellow color. At least I think that's how it works.

RED-BLUE.jpg
 

Tonyr1084

Joined Sep 24, 2015
9,744
Additional: I should also clarify the reason for the 960Ω resistors: Car electrical systems can regularly see 14.4 volts shortly after startup. At that voltage, a 960 ohm resistor will limit current to 15 milliamps. That'll be plenty bright. Since I don't know the forward voltages of the LED's your using your figures will vary a little. But assuming your blue LED is 3 forward volts (3fV) and the red is 2.2 forward volts (2.2fV) then the calculations for each are as follows:

(B+ (battery/alternator car running) - 3fV) ÷ 0.015 (15 mA) = 760Ω
Let me repeat the formula:
(B+ - 3fV) ÷ 0.015 = 760Ω
(B+ - 2.2fV) ÷ 0.015 = 813Ω

So, at 1KΩ your blue (assumed) will see 11.4 mA. Plenty bright. If not bright enough then lower the resistance 770Ω (using a 470Ω in series with a 300Ω resistor) At 1KΩ the red LED will see 12.2 mA.

The reason for limiting their current at 15 mA is so that you don't burn them out if you should happen to turn the PWM all the way up to full brightness. If you want the full 15 mA on the red then use a 470 and a 330 ohm resistor in series for 800 ohms. Pretty close to the 15 mA.

Your LED's might be rated at 20 mA, and yes, you could burn them that bright if you want. You know how to calculate for their resistors, right? Here's a more simple statement of the equation: (V (voltage) - fV) / A. In other words, voltage minus the forward voltage of the LED first. Then divide that by the desired amperage you want your LED's to operate at.

Also keep in mind that your PWM might not give you 100% full brightness. The PWM might only give you 98% Duty Cycle On Time.

If I can muddy up the waters any more for you, just ask.
 

Reloadron

Joined Jan 15, 2015
7,887
A. Blue is the default illumination colour for the car - so all backlighting will be blue and operate from the standard acc circuit of the vehicle. It is intended that this will fall under the same model

B. the intent was to change the corresponding backlit panel (above each Carling switch) dependent on switch location SPST or SPDT. So assuming by acc is live blue would display, should a switch be triggered, the backlight for this switch only would change (from blue or a mix of blue + something else .. e.g RGB was my thought)

C. via the common ground dimming can be set when evening driving triggered by a simple relay with a PWM type unit

D. keep in mind the primary fo this is the carling switched which are only SPST/SPDT on will provide 12VDC triggers (do wish to go back and reorder a bunch of rockers)

if i was to use independent LED vs RGB then how would i have the blue backlight (acc light) turn off when power is received to the separate LED
Before I forget RGB LEDs come in a few flavors, for example common anode or common cathode. I would suggest along the lines of common anode for what you are looking to do. More on that later.

I would also suggest using a LED String which can be cut to size for each switch. Depending on exactly what you want you may want to consider using 5050 LEDs which can be bought in a string from Amazon and cut down to size for each switch. The strings have adhesive backing and include the series resistors and are designed for 12 VDC operation. Here is an image to serve only as an idea.

5050 LED String.png

The LEDs are on the left, each section contains 3 each or Red, Green and Blue along with the current limiting resistors. As pictured they are common anode and designed for 12 VDC operation. The right side of the circuit simply shows how to turn them on and off or apply a PWM from a micro-controller for brightness or intensity.

With that in mind you can make this as simple or as complex as you like. One suggestion would be to use a uC (micro-controller) such as an Arduino or similar. I am guessing you will be switching 12 volts (automotive). Each switch would have a line from the On position through a simple divider (a resistive 4:1 divider) to a DI (Digital Input) of the uC. Again, this is a rough way to go about it and needs refined. The output color schemes would be defined by analog out channels of the uC. The dimming effects can also be handled by a uC using PWM. The exact uC will depend on how many In/Out you actually need.

So it all comes down to how simple or complex you wish to make this.

Ron
 

Thread Starter

itolond

Joined Feb 27, 2010
23
Before I forget RGB LEDs come in a few flavors, for example common anode or common cathode. I would suggest along the lines of common anode for what you are looking to do. More on that later.

I would also suggest using a LED String which can be cut to size for each switch. Depending on exactly what you want you may want to consider using 5050 LEDs which can be bought in a string from Amazon and cut down to size for each switch. The strings have adhesive backing and include the series resistors and are designed for 12 VDC operation. Here is an image to serve only as an idea.

View attachment 145794

The LEDs are on the left, each section contains 3 each or Red, Green and Blue along with the current limiting resistors. As pictured they are common anode and designed for 12 VDC operation. The right side of the circuit simply shows how to turn them on and off or apply a PWM from a micro-controller for brightness or intensity.

With that in mind you can make this as simple or as complex as you like. One suggestion would be to use a uC (micro-controller) such as an Arduino or similar. I am guessing you will be switching 12 volts (automotive). Each switch would have a line from the On position through a simple divider (a resistive 4:1 divider) to a DI (Digital Input) of the uC. Again, this is a rough way to go about it and needs refined. The output color schemes would be defined by analog out channels of the uC. The dimming effects can also be handled by a uC using PWM. The exact uC will depend on how many In/Out you actually need.

So it all comes down to how simple or complex you wish to make this.

Ron
[Ignorance mode.....]

Would like to keep this simple as possible...less complexity = less problems.

- what is or the purpose of a divider (a resistive 4:1 divider)
- DI (Digital Input) of the uC. .. ?
 

Thread Starter

itolond

Joined Feb 27, 2010
23
Additional: I should also clarify the reason for the 960Ω resistors: Car electrical systems can regularly see 14.4 volts shortly after startup. At that voltage, a 960 ohm resistor will limit current to 15 milliamps. That'll be plenty bright. Since I don't know the forward voltages of the LED's your using your figures will vary a little. But assuming your blue LED is 3 forward volts (3fV) and the red is 2.2 forward volts (2.2fV) then the calculations for each are as follows:

(B+ (battery/alternator car running) - 3fV) ÷ 0.015 (15 mA) = 760Ω
Let me repeat the formula:
(B+ - 3fV) ÷ 0.015 = 760Ω
(B+ - 2.2fV) ÷ 0.015 = 813Ω

So, at 1KΩ your blue (assumed) will see 11.4 mA. Plenty bright. If not bright enough then lower the resistance 770Ω (using a 470Ω in series with a 300Ω resistor) At 1KΩ the red LED will see 12.2 mA.

The reason for limiting their current at 15 mA is so that you don't burn them out if you should happen to turn the PWM all the way up to full brightness. If you want the full 15 mA on the red then use a 470 and a 330 ohm resistor in series for 800 ohms. Pretty close to the 15 mA.

Your LED's might be rated at 20 mA, and yes, you could burn them that bright if you want. You know how to calculate for their resistors, right? Here's a more simple statement of the equation: (V (voltage) - fV) / A. In other words, voltage minus the forward voltage of the LED first. Then divide that by the desired amperage you want your LED's to operate at.

Also keep in mind that your PWM might not give you 100% full brightness. The PWM might only give you 98% Duty Cycle On Time.

If I can muddy up the waters any more for you, just ask.
excuse the ignorance here. I need to clarify a few things:
- Gotcha on the resistors (yes rated voltage from Alt is ~14.1 VDC)
- I know PWN controlling the colour from a RGB LED - bat for simplicity it could be a case of Blue + Green or Red mix (just blue bing the base colour)., based on above slight variations on the RGB mix can be achieved at some level with resistors to each channel albeit small.
- is there (electronic component) that can , on live from switch can turn off the blue led (e.g. Red or green etc...?) - know a 5 pin relay can do this trick but is there something like this in the electronics world?
 

Tonyr1084

Joined Sep 24, 2015
9,744
There's a very basic and inexpensive piece of electronic equipment. It's called a wire. Instead of wiring the blue to the ACC power, wire it to the other leg of an SPDT switch. When the switch is in the off position (head unit off) the blue LED will be lit. When switched on the blue goes off and the (other) LED goes on. Whether you're using a single LED or a string of LED's such as others have suggested, that's entirely up to you. The drawing I've provided is the basic on "How To". You can build upon that block all you want.

RED-BLUE.jpg
 

Tonyr1084

Joined Sep 24, 2015
9,744
An additional offering here at my table: If you want to have full brightness during daylight hours and automatically dim when you turn the lights on then all you need is a small relay that bypasses the PWM. When you turn the parking lights or headlights on the relay goes active and switches to ground through the PWM and you have dimming control. Turn the lights off you go back to full brightness. Again, full brightness will be controlled by the value of the resistors you chose for your LED's. Just do the math. If you're uncertain about the values then come back and ask for help.

[edit] OK, here my daytime brightness is governed by about 15 mA and my nighttime brightness (via the extra 2KΩ resistor) is 5 mA. Certainly not dim but also not glaringly bright. Of course, these numbers are theoretical. You'll have to test and see what you like. With currents that low you can possibly get away with a potentiometer. Once you have the preferred brightnesses you simply read the pot and then build a resistor to that value (or close to).

RED-BLUE.jpg
 
Last edited:

Reloadron

Joined Jan 15, 2015
7,887
[Ignorance mode.....]

Would like to keep this simple as possible...less complexity = less problems.

- what is or the purpose of a divider (a resistive 4:1 divider)
- DI (Digital Input) of the uC. .. ?
The idea behind the divider was to keep the inputs to the uC below 5 volts. The typical 12 volt automotive battery, fully charged is about 12.6 volts and with the engine running around 13.6 or greater. So with a 3:1 divider a voltage of 0 to 15 volts becomes 0 to 5 volts. Using a 4:1 a 15 volt input becomes 3.75 volts. The uC only needs to know the switch is On verse Off.

Keeping it very simple the ACC line could be tied to BLUE and when a switch is turned on that line could be applied to either RED yielding BLUE + RED = Violet or Purple. or Blue + Green = Aqua or Blue + Green + Red = White. All of this being very simple but the selections are limited and there is no dimming or fading effects. Next with a little more switching you could go from Blue to Green for example when a switch is On but that involves removing the Blue and turning on the Green.

Adding a uC to things while adding some complexity open more possibilities including fade features. All a matter of where you want to take things.

Ron
 

Tonyr1084

Joined Sep 24, 2015
9,744
Turn the headlights on - relay goes on - LED's are grounded through PWM. Turn headlights off - relay goes off - LED's are grounded to chassis. Brightness depends on the resistors chosen for the preferred daytime brightness. I like simple. Micro-controllers require programming and a bit more wiring. Plus, the need for power supply control at the µC. Just a small 12 volt relay will give you the option to go daytime brightness or nighttime brightness without having to turn the knob every time it gets dark out or light out. If your car has automatic headlights then your dash lights are going to be automatic also. No muss - no fuss. KISS! Keeping It Stupidly Simple.

[edit] Oh, my LED example has common cathode. No big reason, just how I went with it.

RED-BLUE.jpg
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
9,744
Personally I wouldn't even bother with PWM. I'd just replace PWM with a resistor in series with a preset brightness. Of course that would require some testing and swapping out resistors until I got the right brightness, but then you have even fewer components to go bad. I would give up adjustability, but then again, it's only lights.

[EDIT] OK, I DON'T KNOW HOW MY POSTS GOT MIXXED UP. BUT THEY DID. Sorry. See illustration on post #15
 
Last edited:

Thread Starter

itolond

Joined Feb 27, 2010
23
There's a very basic and inexpensive piece of electronic equipment. It's called a wire. Instead of wiring the blue to the ACC power, wire it to the other leg of an SPDT switch. When the switch is in the off position (head unit off) the blue LED will be lit. When switched on the blue goes off and the (other) LED goes on. Whether you're using a single LED or a string of LED's such as others have suggested, that's entirely up to you. The drawing I've provided is the basic on "How To". You can build upon that block all you want.

View attachment 145852
understand - not all the power to these switch relies upon Acc power live, so this would mean if the led was wired to the swith it would remain on all the time the battery is connected - example of this is the hi/lo cooling fan which is connected to the primary circuit, whilst other loads are connected to an isolated Aux battery. So the known condition is Acc power and switch live's
 

Tonyr1084

Joined Sep 24, 2015
9,744
Can you give us a basic diagram of what you're working with?

Here's what you've given us to work with (in part; post #6)
A. Blue is the default illumination colour for the car - so all backlighting will be blue and operate from the standard acc circuit of the vehicle. It is intended that this will fall under the same model

B. the intent was to change the corresponding backlit panel (above each Carling switch) dependent on switch location SPST or SPDT. So assuming by ACC is live blue would display, should a switch be triggered, the backlight for this switch only would change (from blue or a mix of blue + something else .. e.g RGB was my thought)
As I understand it, ACC is active when the key is in an ON position. From what you just said
not all the power to these switch relies upon Acc power live, so this would mean if the led was wired to the swith it would remain on all the time the battery is connected - example of this is the hi/lo cooling fan which is connected to the primary circuit, whilst other loads are connected to an isolated Aux battery. So the known condition is Acc power and switch live's
I must admit being confused.

If you have constant power (unswitched) from the battery then wouldn't you have a condition where your LED's are on all the time? This is why we need a drawing of what you are attempting to accomplish. Even if you have to scribble something on a piece of paper and take a picture of it and post it - at least we have somewhere to start from.
 
Top