Solenoid or coil turnouts/points

Conductor Hat Propeller Beanie

Important considerations for solenoid/coil turnouts/points

Solenoid/coil based turnouts are switched by very small coils that are typically designed to be energised for very brief periods of time (read milliseconds, not seconds), and leaving these energised for too long will burn them out.

If not using the manufacturer’s turnout/point control hardware, the safest option is to use a capacitive discharge unit (CDU), as the short duration discharge of the capacitor is what is used to energise the coil.

If switching the points digitally via some other means such as a motor driver IC or relay, use the shortest duration that provides reliable switching.

Defining solenoid/coil based turnout objects

To define solenoid/coil based turnouts directly in your EX‑CommandStation via the serial console, use the appropriate one of these commands:

  • <T id VPIN vpin> - use this command when using a turnout/point controller that uses a single pin, whether connected directly to your EX‑CommandStation or via an I/O expander device

  • <T id DCC linear_address> - use this command when using DCC accessory decoders to control the turnout/point

Refer to Defining (Setting up) a Turnout for details on these commands.

To define solenoid/coil based turnouts using EX‑RAIL (whether or not they are to be automated) via the “myAutomation.h” file, use the appropriate one of these commands:

  • PIN_TURNOUT(id, vpin [, "description"]) - use this command when using a turnout/point controller that uses a single pin, whether connected directly to your EX‑CommandStation or via an I/O expander device

  • VIRTUAL_TURNOUT(id [, "description"]) - use this command when you need to define a custom macro that controls the various pins and duration required to switch a turnout

  • TURNOUT(id, addr, sub_addr [, "description"]) - use this command when using DCC accessory decoders to control the servos

Refer to Turnouts/Points for details on these commands, along with Adding Turnouts/Points for some further information and examples.

Connecting and controlling the hardware

Using an L293D motor driver - single solenoid/coil turnouts

Bare L293D with single coil turnouts

A single L293D motor driver IC can be used to control two turnouts/points and will require six digital output pins either directly from your EX‑CommandStation (as per the diagram above), or these can also be connected via an I/O expander such as an MCP23017 or EX‑IOExpander.

To operate the turnouts/points in this manner, the direction of the turnout (close/throw) is configured by setting the input pins (2 and 7, 10 and 15) high or low, and briefly setting the appropriate enable pin high (1 or 9).

Note that the 10K pull down resistors connected from ground to the enable pins are there as a safety feature to ensure that any unknown states during start up don’t cause the enable pins to be set to a high state, causing the coils to overheat and burn out.

The voltage provided to “External Power” is the voltage required to operate the turnouts/points, and will depend on the brand/model. Absolute maximum for the L293D is 36V DC.

Here is an example EX‑RAIL macro that will configure a virtual turnout, setting the correct pins for the two turnouts to operate correctly:

#define PULSE 10    // Set the duration of the pulse to 10ms

#define SINGLE_COIL_TURNOUT(t, p1, p2, p3, desc) \
VIRTUAL_TURNOUT(t, desc) \
DONE \
ONCLOSE(t) \
SET(p2) RESET(p3) \
SET(p1) DELAY(PULSE) RESET(p1) \
DONE
ONTHROW(t) \
RESET(p2) SET(p3) \
SET(p1) DELAY(PULSE) RESET(p1) \
DONE

SINGLE_COIL_TURNOUT(101, 22, 24, 26, "Turnout 101")
SINGLE_COIL_TURNOUT(102, 23, 25, 27, "Turnout 102")

Before implementing this macro (or any similar macro controlling solenoid/coil turnouts/points), it is imperative that the correct voltage for the brand and model of turnouts/points is known, and that the defined pulse or delay time is kept to the minimum value possible for reliable switching of the turnouts/points.

Using an L293D motor driver - dual solenoid/coil turnouts

Bare L293D with dual coil turnouts

Like the single solenoid/coil turnouts, a single L293D motor driver IC can be used to control two turnouts/points. This will still require six digital output pins either directly from your EX‑CommandStation (as per the diagram above), or these can also be connected via an I/O expander such as an MCP23017 or EX‑IOExpander.

To operate the turnouts/points in this manner, the direction of the turnout (close/throw) is still configured by setting the input pins (2 and 7, 10 and 15) high or low, and briefly setting the appropriate enable pin high (1 or 9). The key difference for dual solenoid/coil turnouts is the common (thrid) wire of the turnout being connected to ground as per the diagram above.

Note that the 10K pull down resistors connected from ground to the enable pins are there as a safety feature to ensure that any unknown states during start up don’t cause the enable pins to be set to a high state, causing the coils to overheat and burn out.

The voltage provided to “External Power” is the voltage required to operate the turnouts/points, and will depend on the brand/model. Absolute maximum for the L293D is 36V DC.

Here is an example EX‑RAIL macro that will configure a virtual turnout, setting the correct pins for the two turnouts to operate correctly (note it is identical to the single coil version, but renamed):

#define PULSE 10    // Set the duration of the pulse to 10ms

#define DUAL_COIL_TURNOUT(t, p1, p2, p3, desc) \
VIRTUAL_TURNOUT(t, desc) \
DONE \
ONCLOSE(t) \
SET(p2) RESET(p3) \
SET(p1) DELAY(PULSE) RESET(p1) \
DONE
ONTHROW(t) \
RESET(p2) SET(p3) \
SET(p1) DELAY(PULSE) RESET(p1) \
DONE

DUAL_COIL_TURNOUT(101, 22, 24, 26, "Turnout 101")
DUAL_COIL_TURNOUT(102, 23, 25, 27, "Turnout 102")

Before implementing this macro (or any similar macro controlling solenoid/coil turnouts/points), it is imperative that the correct voltage for the brand and model of turnouts/points is known, and that the defined pulse or delay time is kept to the minimum value possible for reliable switching of the turnouts/points.

Using a Capacitive Discharge Unit (CDU) - single solenoid/coil turnouts

Todo

MEDIUM - Add CDU info

Using a Capacitive Discharge Unit (CDU) - dual solenoid/coil turnouts

Todo

MEDIUM - Add CDU info