Why not draw the diagram with the relay (perhaps in a dotted box) first, to show what you're up to? Suggestions can follow from that.
aarg:
Why not draw the diagram with the relay (perhaps in a dotted box) first, to show what you're up to? Suggestions can follow from that.

I should be getting my Triacs today so I will probably play with them over the next few days.
...R
If you have triacs routing power from one bridge to 3 track sections, how do you turn one off?
Efficient h-bridge and motor operation has a ripple current flowing the whole time. You would need something more than the triac.
GoForSmoke:
If you have triacs routing power from one bridge to 3 track sections, how do you turn one off?
Efficient h-bridge and motor operation has a ripple current flowing the whole time. You would need something more than the triac.
I don't know enough about Triacs to understand this comment.
I have been assuming that I would turn a Triac off by turning off the gate signal from the Arduino and then the Triac would turn off the next time the PWM cycle goes LOW.
...R
Remember that microcontroller site I linked to "secrets of the h-bridge" (or like that)?
Which FETs turn on and off depending on PWM HIGH or LOW make the bridge work in different modes.
-- The simplest direct mode grounds the inductive surge from the motor every time PWM goes LOW, making heat.
-- Another mode sends the surge current back through the motor, not kidding, the scope traces were rippled DC. Less heat.
-- There were two other modes I didn't get much into for purposes I wasn't concerned about.
However if you simply ran PWM at 0% for less time than you could notice the voltage and current would zero.
These triacs are for replacing DPDT switches I see on the model railroading sites, right?
Are you going for many power sources and many track sections? Suppose each section could be powered by one of 8 bridges and the control used a shift register per track section that only has one or no bits set? Could daisy-chain the shift regs and control bridge-select through SPI. With PWM control of the bridges you could have a kind of shift-and-clutch arrangement. It might make possible never having a train get power from 2 bridges if all bridges could power all sections.
Two problems I see with your drawing.
First: it's incomplete. "Power in" normally means the positive of a DC current, the other two lines going to a load then GND. That'd be too simple, and you mention before that it's DC that can flow in both directions.
Second: how are you going to make sure that the "power in" can never be connected to both output lines, no matter how much you do your best in software (or how stupid a bug you manage to introduce).
A relay solves both issues - a pair of two triacs only the first.
I realized I got the drawing wrong. I want to be able to connect either A or B to C with the power coming through A or B There is only a requirement to switch one wire as there will be a common return. . Revised drawing ...

These triacs are for replacing DPDT switches I see on the model railroading sites, right?
Are you going for many power sources and many track sections? Suppose each section could be powered by one of 8 bridges and the control used a shift register per track section that only has one or no bits set? Could daisy-chain the shift regs and control bridge-select through SPI. With PWM control of the bridges you could have a kind of shift-and-clutch arrangement. It might make possible never having a train get power from 2 bridges if all bridges could power all sections.
Maybe "yes" to the first point - the job I want to do can be done by an SPDT switch because of the common return.
What you describe is probably the way I would do it for myself - but I am building this for someone else and there will just be 2 H-bridges.
(Actually if I was building it for myself I would put a battery in the loco and have no power in the track - but that's another story).
The more I think about this (without yet doing any experiments) the more I think that Triacs will not be the answer - relays will be simpler.
...R
2 bridges and how many sections?
You can run 4 sections per shift register, each as 2 pins that must always be set < 0b11 for 0=none, 1 or 2=bridge #
With matching input shift registers you can get sensor/switch input byte for byte with your output... track status?
Hey I saw the train yard pics when reading about block layouts (searching for "when engine gets double power", found one) but...
As long as every track section can pick a source you should be able to never have an engine bridge bridges.
What I saw about saving power by running 12ga bus wires under the track with 16ga feeder to each track segment and soldering segment joiners... my 1962 Lionel 3-rail tracks are steel IIRC, it's not the best conductor.
First - I'm I right to assume that the "PWM" Power in the output of a h-bridge? If so how do you have a common return?
Second - take a look at the circuit inside a h-bridge ie how a h-bridge works not how it is used. I say because I think that a h-bridge like circuit may be the answer.
Third - why must section of track C be powered in this way? Can't it have it's own power supply?
Mark
I had been hoping not to have to subject people to model railway stuff - but, if you insist.
These pictures show a turnout switched in the two directions

The part I am interested in is the V at the right end of the picture. You can see how it is alternatively connected to the different rails when the turnout is switched. You can use the contact between the point blade and the rail to provide power to the V but it is not reliable and it is normal to use a switch in conjunction with the movement of the blades.
I have been wondering (mainly out of idle curiosity) if I can use two Triacs to do that switching rather than use a relay.
Note that I am not talking here about switching the power to different lengths of track - that will be done using traditional toggle switches.
The concept of common-return relates to the use of two separate power controllers (h-bridges) and is intended to reduce the amount of under-baseboard wiring and to simplify the wiring needed for switching a length of track to controller A or controller B. This depends, of course, on the two controllers being electrically separate drawing power from two different mains transformers.
I hope that makes some sense.
I have now got my Triacs but I have made no attempt to figure out how they might be wired and I am inclined to think the requirement to deal with the separate power supplies will rule them out - even if they would work fine with a single power supply. I may have wasted £2 but I will have learned something.
...R
Hi,
www.dccwiki.com/Wiring_Turnouts
Tom... ![]()
Horrible word "turnout" , "points" more civilized.. GWR for ever.
Thanks for the nicer diagram. But please not that my system will not be DCC.
...R
I like the idea of power and signal on the same conductors with train motion independent of track wring.
But yes it would mean not running people's favorite old models. So you got to put the smarts in the tracks.
Consider making tristate track joins with power-bus connections like buffer chips in a circuit.
However it is done has to support the way the user already knows to run the choo-choos, right?
The smart join should not put power if either side already has power, which comes from another smart join.
When the smart join turns power ON, it would cover the gap and both sides with one power source.
The next sections out from either side would have to be OFF since the smart joins at either end of a track section can't both be ON. That might take an op-amp circuit. Smart join triac would connect the track to a power source, need 1 triac per source though. In control, always follow taking the gate LOW with 0% duty on the power source h-bridge.
This would require more blocks in your layout than the relay systems but if you can make a nice package and get 10,000 or more cranked out the price would drop, plunge at 100,000. If the more expensive hand-assembled small qty boards already work and can be demo'd, a small kickstart to make enough to get the price down might fly and if not then you'd still have the dev units.
But you see that this way never gets dueling h-bridges and lets a single user cab control to follow a train everywhere.
It engineers the conflict away into a mass-producible plug-in block. Is that worth having more independent track sections?
On the Y, 3 smart joins each wired for the direction of the track section it connects to. Only 1 can power the Y at a time, wire the physical switch to match the track/wheel path to the power, might need diodes for the frog. A reverse loop would be mediated between 2 smart joins at the split ends of a Y. Work it right and maybe call it Track Glue. If you don't make a cent you still maybe get a cheap source of smart joins and people who will buy you pints and talk model trains. Is that value?
GoForSmoke:
I like the idea of power and signal on the same conductors with train motion independent of track wring.
That is not how this system is required to work. It is intended for use with "people's favorite old models"
Power and signal on the same conductors is DCC.
...R
You can't be using triac for controlling dc switching, gate is common to both the diodes, they get triggered at the same time, and there is not natural commutation ie., current crossing zero from +ve to -ve, ie., if triac is used for dc, once the gate is triggered it results in short. So it is not the right solution
rockwellramesha:
You can't be using triac for controlling dc switching,
The DC will be a PWM signal so it should include periods of zero amps.
...R
A PWM is not a negative cross over - it only switches from 0 to Vcc, if you have PWM switching between Vcc, 0V, - Vcc - then may be
rockwellramesha:
A PWM is not a negative cross over - it only switches from 0 to Vcc, if you have PWM switching between Vcc, 0V, - Vcc - then may be
My understanding, based on Replies #9 and #18 is that the Triac will switch off when the current falls below some minimum threshold.
I started this Thread is because Triacs are normally used with AC and all the web pages that I could find assumed that they would be using AC. I suspect they can also be used with DC provided that there is a period of zero current to allow them to switch off.
But I have not tested anything yet and I am unlikely to do so before tomorrow.
...R
Hi,
If you use Triacs;
- You apply gate current to one Triac.
- The Loco has not yet run onto the live frog, so NO current.
- The Loco runs onto the live frog, because you have gate current, current flows through Traic and Loco.
- The Loco leaves the live frog, so no current through the Triac.
- You remove gate current.
- The Triac is OFF, due to NO Triac Load current.
Does that sound logical?
What happens to the other non conducting Triac, does it dv/dt trip ON?
Tom... ![]()


