How can I switch between 2 LEDs using a momentary DPDT switch?

SgtWookie

Joined Jul 17, 2007
22,227
If you stay with a 5v supply, the cost for the relay goes up to around $2.60 at Digikey; there isn't the demand for 5v relays as there is for 12v. Here's an example relay:
http://www.digikey.com/product-detail/en/EC2-5SNU/399-11053-5-ND/4291119

Avnet Express has a better price on them:
http://avnetexpress.avnet.com/store...-1&storeId=500201&CMP=KNC-Supplyframe_VSE-T11

[eta]
The trouble with using just about any kind of all-semiconductor solution is that when power is turned off, the last state of the switch being thrown is lost; when powered up again the LEDs will be in an unpredictable state. You would have to throw each switch on your control panel in order to ensure that your LED displays are correct.

With a latching relay, this doesn't happen; the last state of the switch throw is saved, no matter how long the power is off.

Additionally, logic ICs are prone to "glitches" when sharing power with inductive loads - like your model RR turnout motors.
 
Last edited:

Thread Starter

rigerman

Joined Apr 25, 2014
40
If you stay with a 5v supply, the cost for the relay goes up to around $2.60 at Digikey; there isn't the demand for 5v relays as there is for 12v. Here's an example relay:
http://www.digikey.com/product-detail/en/EC2-5SNU/399-11053-5-ND/4291119

Avnet Express has a better price on them:
http://avnetexpress.avnet.com/store...-1&storeId=500201&CMP=KNC-Supplyframe_VSE-T11
I can go for a 12v relay. But will it work? Can you post a schematic? I can give it a try.
 

inwo

Joined Nov 7, 2013
2,419
So the cathode of the diodes will be grounded as well as connected to the "mechanical part" ?
No, connect anode of diodes to bases. Where switches are shown in schematic. Cathode of diode gets connected, one to red wire and one to blue wire.

In one position of switch, red goes to grd. Flip switch the other way and blue goes to grd.

A single set/reset relay will work to replace electronics.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,227
John P, if the CD4013's Q and Q/ outputs drove the gates of logic-level power MOSFETS, like 2N7000's, battery power could be ORed together with Schottky diodes with the 5v power for the power supply, and then it might be workable - would still need high-value resistors on the inputs to ground to keep them from floating (say, 100k Ohm), and lower-value resistors (say 10k) between the inputs and the switches to help prevent spikes from zapping the internal ESD diodes.
 

John P

Joined Oct 14, 2008
1,971
That's why I was talking about battery-backed logic--to hold the state of the turnouts when power goes off. The cost of those latching relays seems rather excessive.

Of course, as always here, the answer comes out to "use a microntroller". Then there would be an EEPROM available to store the state of hundreds of turnouts.
 

SgtWookie

Joined Jul 17, 2007
22,227
Here is a schematic using a 5v relay, and whoops I forgot to change the resistor value for the LED current limiting; it should be around 300 Ohms - 1st draft anyway. See the attached. The .sch file is in Cadsoft Eagle v6.4 format. This being a "rough draft", the selection of component models was pseudo-random, as I don't know what switches you plan on using, and there wasn't an exact model for the relay in the existing library. Note that if you use the Avnet Express 5v relay, it works out to be not much more than the Digikey 12v relay.

The "X"es are wirepads where you can actually connect wires to a circuit board. You may want to use screw-type terminals instead.

The bridge rectifier takes care of the reverse-EMF spikes that will occur when the switch contacts open; it gives the current from both the relay coil and the switch coil someplace to go. Without that, you risk burning up the switch contacts before their time.
 

Attachments

Last edited:

Alec_t

Joined Sep 17, 2013
12,744
From the under-view of your turnout it looks as though the solenoid mechanism itself includes a DPDT switch (non-momentary type). Can't you wire the indicator LEDs to that?
 

Thread Starter

rigerman

Joined Apr 25, 2014
40
From the under-view of your turnout it looks as though the solenoid mechanism itself includes a DPDT switch (non-momentary type). Can't you wire the indicator LEDs to that?
The track power plays a spoil sport in tapping any wire from the turnout themselves.
 

Thread Starter

rigerman

Joined Apr 25, 2014
40
Here is a schematic using a 5v relay, and whoops I forgot to change the resistor value for the LED current limiting; it should be around 300 Ohms - 1st draft anyway. See the attached. The .sch file is in Cadsoft Eagle v6.4 format. This being a "rough draft", the selection of component models was pseudo-random, as I don't know what switches you plan on using, and there wasn't an exact model for the relay in the existing library. Note that if you use the Avnet Express 5v relay, it works out to be not much more than the Digikey 12v relay.

The "X"es are wirepads where you can actually connect wires to a circuit board. You may want to use screw-type terminals instead.

The bridge rectifier takes care of the reverse-EMF spikes that will occur when the switch contacts open; it gives the current from both the relay coil and the switch coil someplace to go. Without that, you risk burning up the switch contacts before their time.
Thanks for your time and to everyone for their time! I will try to test this out. I have a few question regarding this circuit, I will shoot in a while.
 

inwo

Joined Nov 7, 2013
2,419
INWO, the power to the relay is a separate power?
No it can all be common power supply.

I can't think of simpler solution.

Use a dual coil set/reset relay the same coil voltage as you specifed. It connects thru diodes to your switch as you drew it.

The same momentary pulse from your switch will toggle relay and hold position.

And, while sourcing a dual coil relay, I found this.
Polarity sensing set/reset.
Coil would connect directly across your load. And change states with momentary activation.:D

So I guess there is always an easier way.:eek:

http://www.ebay.com/itm/2-pcs-9-Vol...207?pt=LH_DefaultDomain_0&hash=item5d4a9a4eb7



"As a latching relay, the relay will "memorize" its state even after power is removed. Reversing the polarity will put the relay in the opposite state."
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,227
inwo, did you have a look at the schematic I posted?
My circuit uses a single coil latching relay. A common DIP bridge rectifier is used to take care of the back-EMF from the relay coil AND the switch machine's inductance.
 

Alec_t

Joined Sep 17, 2013
12,744
The track power plays a spoil sport in tapping any wire from the turnout themselves
?? If you mean the turnout is switching track power from one track branch to another then that could provide your LED switching too.
 

Thread Starter

rigerman

Joined Apr 25, 2014
40
?? If you mean the turnout is switching track power from one track branch to another then that could provide your LED switching too.



The problem is no matter how the rails are oriented the points B X R X always have power. So if you tap wires from these, both LEDs will glow.
 

Alec_t

Joined Sep 17, 2013
12,744
So if you tap wires from these, both LEDs will glow
Hopefully not necessarily.
Pardon my ignorance of modern model railway systems, but
1) Does X signify a disconnected/floating conductor?
2) What is the BR voltage; AC or DC?
 

Thread Starter

rigerman

Joined Apr 25, 2014
40
Sorry I do not think the latching relay will work. A LED cannot be wired in parallel to the contact pins of the relay.
 

djsfantasi

Joined Apr 11, 2010
8,258
Sorry I do not think the latching relay will work. A LED cannot be wired in parallel to the contact pins of the relay.
What do you mean by this? The LED is wired in series with the contact pins of the relay, one set of contacts used as a SPDT switch. The NC contact for the main route and the NO contact for the diverging route (or vice versa).

In fact, the latching relay SgtWookie posted works exactly the same way your Kato Switch machine works. A pulse of DC in one polarity sets the switch/relay one way; a pulse of the opposite polarity sets the switch/relay the other way. So you wire the relay in parallel with the switch machine to the output of your momentary DPDT switch, you have extra contacts (on the relay) to switch your LEDs to indicate the track position.

I have seen this work in other applications, such as powering the frog or sidings beyond the switch. In fact, the latching relay recommended has a spare pair of contacts that could be used for these as well.

By the way, the two step process is closer to the prototypical practice, so many model railroaders prefer it.
 
Last edited:
Top