Turnouts

(top)

Having the aim of realistic slow running I was wary of turnout types with insulated rails in the frog area - plus they look less realistic. So I chose Peco Electrofrog. The N gauge ones pose an unusual difficulty if you want to actively switch power to the moving blades.

The classic solution for model turnouts seems to be as follows. Actively switch the polarity of the frog and wing rails and permanently wire each point blade to its adjacent stock rail. The closure rails can either be wired with the point blades (as shown) or with the wing rails and frog. Nowhere can wheels cause a short.

N gauge Peco Electrofrog present a particular difficulty. The wing rails, closure rails and point blades are a single component, electrically. Wires underneath join one side's blade+closure+wing rails to the other side's, and join them to the frog. These wires can be cut.

As supplied there are therefore two problems. First, as usual these turnouts rely on contact between the moving blades and the stock rails. The solution is active frog switching. Second, is that simple, classic, frog switching must either take both point blades with it, as already wired - risking wheels shorting the unused blade to the nearby stock rail, as above, or only the frog is switched, Peco's wiring is cut, and the blades+closure+wing rails are permanently connected to their adjacent stock rails - risking wheels shorting the unused wing rail to the used wing rail or to the frog, as below.

The answer, supplied by "DingoFred", is to leave the unused blade+closure+wing rail floating, not connected to anything. It doesn't matter then if a wheel bridges/shorts that at either the stock rail end or the frog/wing end - so long as both don't happen at the same time, which would be very rare.

This can be achieved using either two or three switches/relays linked to the movement of the turnout. There are five droppers from the turnout - two stock rails, two blades and the frog. There is also the option, shown dotted below, to isolate nearby track to prevent a tain approaching against the points.

Using two changeover switches, as DingoFred does - the lower one (as shown below) is for the frog, and the upper one decides which blade to supply with the same Voltage as the frog. This works but power to the blades must be switched mid-travel or a short can occur where the blade touches its stock rail.

I prefer a more robust option using three switches which has no timing requirements. Only one switch needs to be a changeover switch - for the frog, shown in the middle below. The other two switches are between each blade and its adjacent stock rail. One is closed, the other is open, depending which way the turnout is set.

Servos

(top - Turnouts)

For around 25 turnouts, two 4-gate level crossings and a few other animations, I find SG90 servos very affordable and adequate. Operating them via MERG CANMIO or an Arduino is straightforward. The biggest challenge so far has been to arrange (3) switches for switching track power at each turnout (see above). The appeal of reed switches, over microswitches, is that the mounting does not need to be so rigid or complicated. From China SPST reeds are around £1 for 10, SPDT around £4 for 10.
My first attempts tried to use a magnet approaching the reed switch in the obvious way (A) directly from the OFF zone into the ON zone. This requires some "give" in the mechanism for when the servos overshoots and pushes the magnet hard against the reed switch.

Approach (B) avoids the collision problem. Instead you just have the magnet the right distance from the reed switch to give a usable range on the ON zone.

I standardised on a cylindrical magnet. Cubes or cuboids might have been easier to mount but it is less obvious where the poles are, as I found out putting 2mm cubes under locos to operate train locaters. Whilst a spot of superglue holds a magnet on to a servo arm surprisingly well it is not robust enough. A jig is needed to hold the magnet and servo arm in a repeatable position so I made one where the fixing is done directly with hot melt glue. This does not stick very well to the magnet, or to the servo arm, so has to be applied as a kind of wrapper. This wrapper serves a second purpose when the assembly flies off before installation and sticks to something magnetic, it forms a cushion on the surface of the magnet which make it easier to unstick.

I tried various ways of mounting the three reed switches, mainly using a piece of stripboard with 5 strips. "Surface" mounting the reeds on the strip side means less, risky, bending of the reed wires and makes it easy to move the reed along the assembly to a better position.

I made a test setup with an Arduino Nano. This sweeps the servo and observes and logs the state of the switches. This exposed that the SPDT (changeover) reed switches are of variable quality. Some move very smartly from one state to the other, others have a sizeable "dead zone" where neither contact is made and significant hysterisis on the normally-open contact. Packs of 10 seem all to be of the same quality so it may be possible to avoid the poorer ones but tricky with long lead times from China.

Fortunately each assembly only needs one changeover, one normally closed and one normally open. The poor quality SPDT switches work fine in the normally closed position and I can use a (cheaper) normally-open SPST reed switch in the normally-open position - although it must be physically offset because it's ON zone is in a different place.

(20 May 2020) Train operation is held up by a frog-switching failure. A SPDT frog-changeover reed is connecting to both the NO and NC connection, creating a short. Tapping it (hard) clears the fault but presumably only temporarily. At least it is further confirmation that my throttle system is short-circuit-proof.
Even simply replacing that reed switch means I have to go back to my servo/reeds test jig. Apart from some SPDT reeds being iffy the solution seems sound but I want to try putting the magnet a little further from the servo axis so that there is less curvature in its path which may make the switch behaviour more systematic. It also means the reeds must be further from the servo axis which could make the reed sub-assembly easier to build and fix in place.
The first jig fixes a magnet at radius 10mm along the servo arm, and it cramps the space available for putting hot-melt glue around the magent to hold it in place. So the first task is to build a new jig aiming for the radius to be adjustable between 10mm and 20mm and allowing more space around the magnet.
Then I plan to build a reed assembly with the reeds (probably 2.5mm) further from the servo axis and, now I know it's worth it, refactor the servo/reed test jig (Arduino NANO) firmware to be easier to use and deliver more useful/legible results.

First attempt. Servo mounted classically in a 15mm aluminium channel under the turnout. Two reed switches on either side of a magnet on the servo arm. Apart from the general difficulty of access under the layout, the sets of switches need adjusting independently and are vulnerable to being pushed aside when the servo arm swings out of control.

Improvement. The magnet now goes past the switches, instead of towards them, and the adjustment is in terms of the servo rotation, the same as for the turnout position.

Servos are mounted more accessibly - covered by scenery if necessary. There are five dropper wires from the turnout (stock rails, closure/blades and frog). Feed to and from adjacent track sections are pink/violet.

Servo test results

Click here.