Author Topic: Control Bi-Colour LEDs  (Read 15779 times)

Gino

  • Fireman
  • **
  • Posts: 15
Control Bi-Colour LEDs
« on: May 17, 2022, 11:24:32 PM »
I have an interesting problem.

I have an USA Trains locomotive that has Classification Lights (LEDs), front and rear. The LEDs are Bi-Colour, Red and Green.
Currently when the polarity is one direction the LED lights up Green. When the polarity is reversed the LED lights up Red.

The question is how to control the LED with 1 output of an LM-4S-G?

I know that the LED can be controlled using 2 of the outputs on the LM-4S-G but this will use 4 of the outputs, 2 outputs for the Front Class Lights and 2 outputs for the Rear Class Lights.

But I also want to use the other outputs for the Headlights, 2 outputs, and Number Boards, 2 outputs. Not enough outputs to do what I want. I would like to control the Front and Rear Class Lights using the remaining 2 outputs.

Suggestions are appreciated.

Gino

Gibs

  • Engineer
  • ***
  • Posts: 82
Re: Control Bi-Colour LEDs
« Reply #1 on: May 18, 2022, 06:41:52 AM »
Wire the green front and the rear red to the same output wire, just use a different resistor before each LED that you connect to the output wire. One rated for the green LED, one rated for the red LED. Just because a " light" is at the front and the back doesn't mean each one needs their own output wire. You can quite happily wire them up in parallel. JUST make sure each COLOUR has its own resistor ok.

When the loco goes the opposite way, then you do the same as above but in reverse, rear green in parallel with front red. Total outputs used....2.
« Last Edit: May 18, 2022, 06:52:25 AM by Gibs »
Cya Down The Line.

gregeusa

  • Engineer
  • ***
  • Posts: 98
    • Greg's web site
Re: Control Bi-Colour LEDs
« Reply #2 on: May 18, 2022, 11:29:36 AM »
The LED in USAT is BIPOLAR, 2 leads only, not the 3 lead type.

You need to reverse the polarity, and I would use a small DPDT relay to do this, engage the relay for one polarity, and disengage the relay for the other.

Since this is a BIPOLAR LED, only one current limiting resistor is possible.

I don't know the details on the RP function outputs, so the standard BEMF shunt diode across the coil would not be a bad idea, cheap insurance.

Greg
Lots of tips and techniques on my site: www.elmassian.com contact me greg@elmassian.com

Gibs

  • Engineer
  • ***
  • Posts: 82
Re: Control Bi-Colour LEDs
« Reply #3 on: May 19, 2022, 08:45:25 AM »
My bad, late night up at the mine. I missed the bit about it being polarity sensitive. And that's the reason why I  swap out bipolar LEDs, it's easier to set up with three leg LEDs. No need for a micro relay. It's a tight enough fit already in an HO scale. You G scale guys have so much more usable realestate.
Cya Down The Line.

Gino

  • Fireman
  • **
  • Posts: 15
Re: Control Bi-Colour LEDs
« Reply #4 on: May 19, 2022, 05:19:37 PM »
Well I think I figured it out with all the help.

The LEDs have 3 legs so only 1 resistor is required.
Based on the suggestions I am using 1 output to power the Green LEDs in the front along with the Red LEDs at the rear. The second output will be used to power the Green LEDs in the rear along with the Red LEDs in the front.

The next challenge will be to program the 2 outputs so that when the locomotive is moving forward one set of LEDs turn on and when the locomotive is reversed the other set of LEDs light automatically.

Thanks again for the help.

Gino

Gibs

  • Engineer
  • ***
  • Posts: 82
Re: Control Bi-Colour LEDs
« Reply #5 on: May 20, 2022, 09:22:54 AM »
Three leg LEDs come in two types. Common positive ( the type you want) and common negative. Just check which type you have before soldering up all the connections. If wrong type they can be found on places like Amazon or AliExpress cheap as chips with leads attached in 3,5 and 10mm clear LEDs.
Cya Down The Line.

Gino

  • Fireman
  • **
  • Posts: 15
Re: Control Bi-Colour LEDs
« Reply #6 on: May 23, 2022, 11:46:27 PM »
I spoke too soon. After drawing out the circuit I found out that the LEDs used are common cathode. So the circuit will not work using the +5V supply through the LEDs and to the output.

Gibs you are correct. You need common anode LEDs to make things work.

I have another thought.
Can you use the output to supply power through the LEDs and connect them to the Common pin?
Can this work using an LM-4S-G? If so then I could use the existing common cathode LEDs.

Gibs

  • Engineer
  • ***
  • Posts: 82
Re: Control Bi-Colour LEDs
« Reply #7 on: May 24, 2022, 11:18:31 AM »
What a lot of people tend to forget is what we term as "OutPuts" on RP's LM's are in fact Negative switched connections. The "Common" which by normal conventions would be a common "Ground/Negative" is in fact the "Positive" power supplied connection.

So you need a Common Positive LED to do what you're after.
The correct "Colour" resistor needs to be on the switched Negative connections or the LED wont work correctly.

Now as to your idea, I have no idea as to what voltage and polarity is available at the "common" connection on the LM 4G, its not displayed on the diagram so I'd need to know that before I'd even think about give you a yes or no, but even if its/was usable, you cant control it like the output connections that are for lights/effects as far as I can tell.
Cya Down The Line.

Gino

  • Fireman
  • **
  • Posts: 15
Re: Control Bi-Colour LEDs
« Reply #8 on: May 26, 2022, 12:05:18 AM »
I asked Ring Engineering if the output(s) of the LM-4S-G could be the source to power the LEDs. The answer was NO. The outputs can only sink current.

So to make things work I went ahead and purchased some common anode bi-colour LEDs.
I will replace the ones on the boards and wire them accordingly.

Thanks for all your comments and suggestions.

Gino

gregeusa

  • Engineer
  • ***
  • Posts: 98
    • Greg's web site
Re: Control Bi-Colour LEDs
« Reply #9 on: May 26, 2022, 12:05:29 AM »
Gino, I have a large number of USAT locos, what model do you have that has a 3 lead red/green led?

Mine are all bipolar, 2 lead.... perhaps you bought them used and someone changed the LEDs
Lots of tips and techniques on my site: www.elmassian.com contact me greg@elmassian.com

Gino

  • Fireman
  • **
  • Posts: 15
Re: Control Bi-Colour LEDs
« Reply #10 on: May 27, 2022, 12:20:08 AM »
Greg

The locomotive is a GP30 that I purchased used. One of the class lights PCB has a date code on it, April,06,02. The boards are factory and they have the 3 lead LEDs.
The problem is that the LEDs are common cathode and do not play well with trying to turn them on using the +5V supply. But common cathode LEDs work well with the ability to reverse the polarity in a DC system.

You can wire them to work using the +5V but you end up using too many outputs.

I also have an SD40-2 that I purchased used with classification lights but they appear to be single colour, Red.
Now come to think about it I never did try to see if they were bipolar. I just wired them as a one colour LED.
I will take the locomotive apart to confirm that the LEDs are in fact just one colour.
If they are bipolar then it be be back to the drawing board to wire them to take advantage of the find.

If the LEDs are just a single colour and the locomotive is apart anyway I will rewire the class lights with the extra 3 lead red/green LEDs that I purchased.

Gino

gregeusa

  • Engineer
  • ***
  • Posts: 98
    • Greg's web site
Re: Control Bi-Colour LEDs
« Reply #11 on: May 28, 2022, 05:07:23 PM »
Thanks Gino, I have mostly older design USAT, PA, F3, NW2, etc.

Sound like they modernized a bit.

The real difficulty is finding a common anode white/green led... class lights were never red.

Greg
Lots of tips and techniques on my site: www.elmassian.com contact me greg@elmassian.com

Gino

  • Fireman
  • **
  • Posts: 15
Re: Control Bi-Colour LEDs
« Reply #12 on: May 28, 2022, 07:28:57 PM »
Greg,

Some of the locomotives I purchased used have an LM317 regulator to provide constant voltage to the lamps in the units. This way they can use lower voltage bulbs and not worry too much about burnt bulbs using direct power from the rails.

I did not know that class lights were only Green and White, my bad!
I did some looking and found a 5mm common cathode Green/White LED. No luck on a common anode version.

But now that I have purchased the Red/Green LEDs I will install them in the locomotives I have with class lights. Not prototypical as noted but under the circumstances this is my railroad, ha, ha, ha.

The upside is that I can also use the bi-colour LEDs for signaling.

Gino