Switching polarity of a DCC signal (model railway control)

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,396
There is a circustance where it is necessary to switch the polarity of the DCC signal. DCC is an alternating polarity square wave of 12V at 5kHz to 9kHz. It is used as apower source (a couple of amps) and as a control signal.

It is possible to switch the polarity using a DPDT relay in the usual way however this is rather slow. Is there a semiconductor way of doing this switch?
 

eetech00

Joined Jun 8, 2013
4,056
There is a circustance where it is necessary to switch the polarity of the DCC signal. DCC is an alternating polarity square wave of 12V at 5kHz to 9kHz. It is used as apower source (a couple of amps) and as a control signal.

It is possible to switch the polarity using a DPDT relay in the usual way however this is rather slow. Is there a semiconductor way of doing this switch?
You mean change the phase of the signal?
 

crutschow

Joined Mar 14, 2008
34,844
Not if you want to invert the power signal with the source and load sharing the same ground.
Either the source or the load would need to be floating.

An XOR gate, such as the CD4070, readily does that for a low level signal.
The signal goes in one input, and the state of the other input determines the output polarity.
The output could then control a power driver.
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,396

eetech00

Joined Jun 8, 2013
4,056
Basically, you will need to maintain the bi-polar signal integrity while reversing the signal connections to the track.
So, a sort of "high power analog switch" ,similar to a DPDT switch, should work.

EDIT:
The DCC signal is a pulsed DC waveform that is not bi-polar. It is a uni-polar signal.
But at a reversing loop, the polarity of the wire connections need to be swapped to prevent a short circuit.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,188
I understand this isn’t directly related to your question but are you aware of the many commercial DCC reversing modules available?
 

crutschow

Joined Mar 14, 2008
34,844
switch the polarity using a DPDT relay in the usual way however this is rather slow.
How fast and often do you need to switch it?
Yes, but they are expensive ~£40.
Not surprising, as it requires a rather complex circuit to reverse the polarity of an isolated bipolar signal with solid-state devices.
Much easier to do it with a DPDT relay.
 
Last edited:

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,396
How fast and often do you need to switch it?
It would only need to switch occasionally, up to a minute between switches.
When a train enters the section it will create a short circuit and that should only be very brief. The circuit will detect the increased current and switch so the short is released.

The link below shows a picture of a commercial board. At the left youcan see two current transformers and at the right are 8 MOSFETs presumably doing the switching. There are 4 IRFZ44NS but I can't read the code on the other 4.
https://midwestmodelrr.com/nce0233/
 

djsfantasi

Joined Apr 11, 2010
9,188
How does that cause a short?
How does reversing the phase of the signal stop that?
Power and DCC signals are carried on the two rails. Call one the + rail and the other the - rail. In a reversing loop, the + rail ends up connecting to the minus rail. And vicey versey. Hence, a short when the metal wheels cross the gap. Or an engine.

Hence the loop must be isolated by gaps in the rails. While the train is in the loop, the polarity of the main line is reversed so this won’t happen.

The commercial boards detect the short that occurs when a wheel crosses the gap and the polarities mismatch. It quickly reverses the polarity so there is no short.
 

crutschow

Joined Mar 14, 2008
34,844
Okay, a thought--

Could you use a photo sensor to detect when a train enters the loop to reverse the phase of the isolated track, and then another sensor to go back the the normal phase when it is completely in the isolated track?
Since it now doesn't have to switch rapidly to remove a short current, the photo sensors could control a DPDT reversing mechanical relay.

If it needs to work for trains going in either direction around the loop, then some simple logic would be needed for that.

That should be easier to do then detecting a short, and about the cheapest way I can think of to detect and do the reversing.
 

djsfantasi

Joined Apr 11, 2010
9,188
If it needs to work for trains going in either direction around the loop, then some simple logic would be needed for that.
It would have to work in either direction. Note that a reversing section may have multiple entrances and exits. If the TS has a simple reversing loop, this is a viable option. However, the logic for all cases could get quite complex and would have to be created individually for all arrangements of reversing sections. This is one reason why the commercial modules look for a short. (Plus on a model railroad, a photo sensor is not prototypical and clever scenery design would be needed to hide it.)
 

crutschow

Joined Mar 14, 2008
34,844
Note that a reversing section may have multiple entrances and exits.
Okay, but won't it work to have the sensors just before and after the isolated track section?
Plus on a model railroad, a photo sensor is not prototypical and clever scenery design would be needed to hide it.
Is that a big problem?
The sensor could possibly be built below the track, looking up.

Just thought it might be a cheaper way to perform the function, which the TS was looking for.
 
Top