Home‎ > ‎Model Railroading Projects‎ > ‎

A Tortoise Switch Machine Controller and Signal Indicator for Automatic Layout Operation

September 28, 2009

Tortoise Switch Machine Controller Eagle 3D PCB Animation

This article appeared in the December 2009 issue of Scale Rails Magazine published by the NMRA.

Article, Photographs, and Diagrams by Kevin Fodor

Operations are a large part of our hobby which is enjoyed by many model railroaders. However just watching trains run can be just as enjoyable. For me that is the part of the hobby I like best. Being able to create something and stand back and watch it run is quite satisfying. That’s why I prefer to have my layout automated rather than be involved in the operations of it. To accomplish that goal many components of the layout which are normally controlled by panel mounted switches need to be controlled either by some central controller or in response what is going on around the layout (such as trains arriving or leaving specific locations). One of the basic components on any layout which comes naturally to automate is turnouts. We are all familiar with the simple circuit provided in the Tortoise switch machine manual which allows us to control turnouts with a few diodes and manually operated toggle switches. But what if you want to control your turnout’s automatically either through some centralized controller or in response to a locomotive or rolling stock being detected? That was precisely the reason I designed this circuit.

Here is a circuit that provides a means to automatically control a Tortoise switch machine on layouts which are to be run without operator intervention. It allows you to control a turnout’s position using an external signal rather than a physical switch. The circuit accepts a simple DIRECTION input to move the switch to either position. Additionally there are external indicators (red, green and yellow LEDs) indicate the locomotive should stop, go or warn that the switch’s position is changing. These LEDs are mounted on a mast or overhead signal bridge to indicate that the engineer should do. In addition to signal indicators, these outputs from the circuit may also be used to control power to blocks that approach the turnout from any direction facilitating complete realistic and automatic control anywhere on your layout.

Schematic

The controller circuit can be broken into three basic parts; 1) a 5-VDC Power Supply 2) the H-Bridge Motor Controller and 3) Control Logic and Signal Indicators. Each part is detailed in the following sections. Depending on your own layout requirements not all three components need to be implemented as you can adapt the circuit to your own needs.

5-Volt DC Power Supply

The power supply was included to allow the circuit to be powered using the track accessory output from any power pack (ACC). However, if you have your own 5-VDC source or power supply (wall-wart, etc.) you could eliminate this part of the circuit. The Track Accessory voltage is typically 18-VAC which is connected to J1 labeled “AC” on the input terminals. The AC-input is connected to a full-wave bridge (B1) which rectifies the AC input into DC. This DC voltage is then fed into the 5-Volt regulator (U1) to produce a steady 5-Volt 100mA output for the logic circuits. Capacitors C1 and C2 filter the input voltage of high and low frequencies helping the regulator maintain a steady output voltage (INT_PWR). If you choose to use this internal power supply make sure you place a jumper on JP1 shorting pins 2 and 3. Alternatively if you wish to use an external power supply simply place a jumper on JP1 shorting instead pins 1 and 2 and connect it to the input terminals V+ and GND. An external supply of up t 12VDC may be used. A visual indication of power being provided to the circuit is observed through LED1 and current limiting resistor R1.

H-Bridge Motor Controller

In general an H-Bridge circuit is used to change the polarity of the applied voltage to a load such as a motor which causes the motor to rotate in the forward or reverse direction. In this circuit an H-Bridge is formed using a pair of 2N2907 and 2N222 transistors (T1-T4). You may note the arrangement of these transistors in the schematic form an “H” shape and hence the name “H-Bridge” a common way of controlling a DC motor. Two MPSA55 (Q1 and Q2) and two MPSA05 (Q3 and Q4) general-purpose transistors provide the drive current necessary to control the H-Bridge.  The H-bridge operation is controlled through the DIR and *DIR signals from the control logic circuits. It is important to note that an H-Bridge’s inputs should never be either both high or both low, otherwise a short circuit will be formed. In this configuration opposite DIR and *DIR signals are provided by the 40106 hex-inverter ensuring this never happens.

To help reduce high-frequency electrical noise from the motor, a 0.47uF ceramic capacitor (C3) is placed across the motor terminals. For added protection of the H-Bridge circuit four “fly back” 1N5817 Schottky (fast-acting) diodes (D1-D4) prevent high voltage spikes from damaging the H-bridge transistors when the motor changes direction of travel. These additions may be overkill since the Tortoise motor is very small, however I wanted to make sure the control circuit was absolutely as reliable and maintenance free as possible.

This H-bridge can provide up to 600mA of current to a motor, more than sufficient to drive the 15-16mA a Tortoise switch machine requires. This also means that more than one motor (or load) can be driven by the same output.

Control Logic and Signal Indicators

The third and final portion of the circuit is responsible for responding to control input, control the motor and properly actuating the signal indicators (LEDs) to indicate to a locomotive engineer how to proceed. If you do not want to include signal indicators or additional output control, this portion of the circuit could be eliminated. I feel however including it adds a further dimension of realistic automatic operation to a layout.

All input signals are pulled high through resistors R6, R7, and R8. The control logic is implemented using a combination of Inverters (IC1) and NAND gates (IC2). The implemented logic is best described in the table as shown below. The highlighted color indicates the on-board LED’s state (LED2-LED5), while the “high” and “low” label indicates the transistor output state (Q5, Q7, Q9, and Q11) which may be used to control other devices or signals.

Table 1 - LED Indicator and Output State Table

There are four output signals provided by the controller; GO, CAUTION, RIGHT and LEFT. Note that whenever the motor, and thus the switch are moving the CAUTION indicator is always lit. Likewise the GO indicator is lit only when the switch is in the desired position. The RIGHT and LEFT indicators always indicate their actual position. This gives you the ability to control external devices when and only when the switch machine is in position (i.e. not travelling).

Each of the logic outputs are interfaced to an on-board LED via the MPSA05 NPN transistors (Q6, Q8, Q10 and Q12) to provide sufficient drive current for each of the LEDs via the 470-ohm resistors. This provides a helpful visual indication of the output states. If desired these LEDs could also be brought out to the layout as a signal.

In addition a second MPSA05 NPN transistor is connected to each output (Q5, Q7, Q9, and Q11). On the schematic these transistors show a 0-ohm resistor pulling up the collector lead. Such a resistor should never be connected; however this notation is just a placeholder to allow different configurations of these outputs based on your own layout needs. These outputs may be configured as an open-collector output (if no resistor is inserted) or logic output if a suitable pull-up resistor is inserted (10k).  Shown below are three possible output configurations which might be suitable in your own layout.

Figure 1 - Output Configuration Options for Q5, Q7, Q9 and Q11

As these examples show, the transistor outputs are very flexible and accommodate many types of outputs such as lights, power to blocks, other switch machines or trackside animations.

Parts List

In general the parts for this circuit were chosen because they are readily available and very inexpensive. I am sure the circuit could be optimized in many ways but I wanted to avoid using uncommon parts or parts which may go out of production. Current prices at various suppliers such as Mouser (www.mouser.com) or Digikey (www.digikey.com) for all parts are less than $13. I have made available any EZBuy Project link to Mouser Electronics for purchasing the parts required (http://www.mouser.com/ProjectManager/ProjectDetail.aspx?AccessID=e5eea6cf72 ) if interested. Alternatively, local electronics shops will typically have these or similar parts in stock.

U1

LM78L05ACZ 5V 100ma Voltage Regulator

IC1

40106N Hex inverting Schmitt Trigger

IC2

4093N Quad Two-Input NAND Gate with Schmitt Trigger

T1,T2

2N2222 NPN Transistor

T3,T4

2N2907 PNP Transistor

Q1, Q2

MPSA55 PNP Medium Power Transistor

Q3-Q12

MPSA05 NPN Medium Power Transistor

D1-D4

1N5817G Schottky Rectifier Diode

B1

RB153 1.5A Bridge Rectifier

LED1-5

5MM LED (3-Red, 2-Green, 1-Yellow)

C1

470uF Axial-Electrolytic

C2

0.1uF Ceramic

C3

0.47uF Ceramic

R1

2.7k-ohm 1/4-watt

R2, R3

1M-ohm 1/4-watt

R4-R10,R13,R16-R17,R20,R23-24

10k-ohm 1/4-watt

R12,R15,R19,R21

470-ohm 1/4-watt

R11,R14,R18,R22

0-Ohm *See Text

Other: Terminal Connectors, Standoffs, Hook-up Wire, PCB (or Vectorboard)

Construction

As with most circuits construction using Vector board and wire wrap is certainly possible. A 3” x 3” piece should be sufficient to construct the circuit. However, I have found Vector board construction quite error prone and time consuming. Plus if you find you need multiple controllers this can be quite time consuming. For convenience I have made available a PCB-layout which you can etch and fabricate yourself from the artwork (See Figure 6 - Figure 10) or it can simply be ordered from any board house using the attached files. The PCB I made has a completely detailed silkscreen to help placing all the required parts easily. I have also made this PCB design available to anyone who would like to order it directly from a PCB manufacturer such as BatchPCB (www.batchpcb.com) using the following link (http://www.batchpcb.com/index.php/Products/23769). Using a pre-fabricated PCB makes the building this circuit very quick and easy as all the parts are all through hole and can be soldered with a 15W or 25W soldering iron. Be sure to use suitable electronics solder for all electronics work. When assembling any PCB, in general start with the smallest parts first working your way up to the larger parts. Trim all excess leads to length.

Installation

Install the controller underneath your bench work near the Tortoise switch machine you wish to control to minimize the amount of wire needed between it and the switch machine. If using the PCB you can use the stand-off holes to mount the PCB directly your bench work with #4 screws. For connecting the switch machine, I used color coded wire to make things easier to follow. In the figure below I describe the colors I used but you can select whatever colors you have available, just be sure to document your work. Note that although in this example I use a wye-turnout, I have used this circuit with left-hand, right hand and even double-slip turnouts successfully.

Figure 2 - Example Wiring Diagram

In the wiring diagram (Figure 2, above) the controller is configured to receive power from the track accessory supply which is typically 18 VAC and is connected to the ACC terminals on the controller. The yellow and brown wires are connected to the switch machine’s pin 1 and 8 respectively which are then connected to the MOTOR terminal outputs on the controller. The switch machine’s internal SPDT switch is used as an input to the controller to determine its position. The blue, green and yellow wires are connected to the switch machine’s pins 2, 3, and 4 respectively. Note that although I connected wires to the second SPDT switch, I did not use it so it is left unconnected for future expansion (See Figure 3 below). Either SDTP switch can be used in this circuit but be sure to reverse the right and left designators as well. The controller receives its direction input from some external controller or block detector to indicate the switch should be positioned to the left or the right. The direction should be grounded to switch one way while it is left unconnected or +5V to turn the other way if using the internal power supply.

The outputs in this example are connected to trackside signals indicating which way the locomotive is allowed to pass. For instance, the GO and CAUTION outputs are connected in the LED configuration to indicate the locomotive can either proceed through the turnout or should stop and wait. While from the left and right sides of the turnout an approaching train is met with either a GO or STOP signal indicating it is safe to proceed through the turnout. A photo of the completed circuit wired to a Tortoise switch machine is shown in Figure 3 below.

Figure 3 - Tortoise Switch Machine Wired to the Controller Circuit

This project has proved to be a versatile and flexible controller allowing a number of configurations that are able to automate my layout operation. I trust you’ll find that with the simple direction input and configurable outputs given their ability to drive LEDs, relays, blocks, actuators and other devices that this controller will prove to be just as valuable for your own layout.

Links / Downloads
Click on the hyperlinks below to download schematics, PDFs and EagleCad project files. You can also use the Mouser and BatchPCB links to order your own parts and boards if you like.
Schematics: .pdf, EagleCad(.sch)
PCB Layout: EagleCad(.brd), Assembly Guide (.pdf)
Gerbers (.zip)
Mouser EZ-Buy Project (Parts)
BatchPCB Order Link (PCB)

 

Comments