Hardware interfacing

There are two fundamental ways you can interface a model railway to a computer: either direct connections, or indirect connections.

Direct connect

Direct connect means running a wire from where a signal originates to where that signal needs to go. Naturally this method uses a great deal of wire, but is easy to understand.

Advantages to direct connect:

Disadvantages of direct connect:

Indirect connect

Indirect connect uses some kind of multiplexers between source and destination. For example all sensors on a baseboard are directly wired to a multiplexer and a single wire is run to the control panel where a demultiplexer feeds the lamps that the sensors needed to drive.

RPC is one example of an indirect connect implementation. For inputs, sensors and buttons connect to SRI4 modules and track circuiting is handled directly by FTC modules. The RPC stack is a shift register which multiplexes all the inputs onto a single wire and to some kind of demultiplexor which might be a PC, or perhaps an SRO4 module. Outputs from the control logic are multiplexed and sent to output modules on the RPC stack (SRO4, or DPR modules).

Advantages of indirect connect:

Disadvantages of indirect connect:

Suppliers of indirect connect interfacing hardware.

1. QtuTrains

QtuTrains can supply kits for QTU (Quadruple Throttle Unit) modules. QTUs can be mixed with RPC modules (see below) and have I/O to the same specification as RPC except that each QTU can be equipped with two slow-motion turnout motor drivers, has eight analogue inputs and four track drive outputs. The QTU can be configured to run as manual throttles, autonomously (runs a program downloaded into it) and also to run as a computer interface board.

2. RPC

The Merg RPC kits meets most of the railway interfacing requirements for most of us. The kits are relatively cheap, and physically compact.

The RPC system is based on a shift register design and adjacent modules are connected by four signals and power. These signals are transmit data, receive data, clock and load. These signals are TTL compatible (short distance only) and are used to interconnect and control the shift register. It is easy to design and build your own hardware (or software) to drive an RPC stack.

The following interfaces are available:

Inputs, for signals coming from sensors and buttons.

These are connected directly to CMOS input pins, with pull-up resistors to 5V. You can use any source that has TTL or 5V CMOS compatible outputs, or sources that are open-collector (such as buttons that pull the inputs to ground).

You should NOT use sources that drive the signals above 5V unless you add some kind of protection circuitry, preferably a resistor and transistor to turn the signal into an open-collector source.

Our QTU and the RPC SRI4 module each provides 32 such inputs.

Open-collector outputs.

These can drive LEDs (with series resistors), filament lamps, relays, motors etc provided that the current is within specification. One or two outputs could drive 500mA at the same time, or perhaps all 8 outputs on one chip could drive 250mA.

The loads can be any positive voltage normally found on a model railway (5V, 9V, 12V, 18V, 24V), but should never be negative or over the maximum rating of the transistor package.

These outputs only pull to ground, they do not source any current.

With two BC177 transistors and two resistors you can drive a tortoise motor from two of these outputs.

Our QTU provides 24 and the RPC SRO4 module provides 32 of these outputs.

Relay outputs.

Where outputs are required to drive higher currents (up to 1A) the relays cards can be used. The DPR module provides 8 DPDT (double pole, double throw) relays (but does not include the relays), the QPR module provides 8 QPDT (quadruple pole, double throw) relays and relays with 24V coils are included.

These relays are suitable for feeding track power upto G scale, routing signals cables between hardware units and driving motors beyond the scope of the SRO4 modules.

Current detectors (track circuiting).

The FTC module provides 8 current detectors that can be wired in series with track feeds. The FTC inserts three diode drops and so you will lose 2V of power feed to the track. If you are using feedback throttles then connect a 1K resistor across the FTC pins to allow the feedback signal to reach the throttle.

RPC infrastructure (modules apart from basic input and output)

Remote Panel Interface (RPI) module.

These interface a single stack (of as many modules as you require) onto an RS232, RS485 and (soon to be available) USB. These modules (or equivalent) are required if you want to connect to a computer.

Point To Point (PTP)

This unit simply transfers data between two stacks. If, for example you have two stacks, each of which consist of an SRI4 and an SRO4 then when connected by a PTP the 32 inputs (on the SRI4) of one stack are sent to the 32 outputs (on the SRO4) of the other stack. This can be useful for implementing control panels without using the sort of massive wiring loom that would suit a battleship.

Remote Stack Extender (RSE)

These are simply buffer that allow you to physically split a single stack into two separate locations. With one RSE two physical stacks are joined into one logical stack so an RPI or PTP will treat the two stacks as a single double-sized stack.

3. CTI electronics

The modules that are available from CTI are similar to the RPC units in capability, but are ready built and naturally cost rather more.

The modules are connected in an RS232 loop. This has some advantages over the TTL signals used by RPC, especially that modules may be placed a fair distance apart (several metres). As a message circles around the loop each module receives one byte from the message, and relaces it with its input values (if it has any). As the CTI system uses RS232 (9600 baud standard) any hardware with an RS232 interface can be used to build your own modules. If you conform to the message protocol (fully documented on the web) the CTI application software (or my tcc application) will treat your hardware as if it were actually CTI modules.

The modules are all much bigger than the RPC equivalents, and cannot be stacked adjacent (for example the trainbrain module has connectors on three of its sides). They each need a separate power feed cable and links to the adjacent modules.

TrainBrain module

This is the basic interconnect module providing 4 inputs and 4 outputs.

The inputs are similar to the SRI4 module for RPC in that the signal connects directly to 5V logic (actually a PIC chip) with pull-up resistors. Three different plug-in pull-up resistors are supplied so you can chose the best for your sensors. This is useful with LDRs (Light Dependant Resistors) so you can match the resistor to your supply of LDR.

The outputs are SPDT (single pole double throw) relays capable of switching 10 amps. This makes them suitable for controlling solenoid motors (simply connect between a CDU and the motor).

Watchman

A module with 8 inputs and no outputs.

Dash-8

A module with no inputs and 8 outputs.

Signalman

A module with 16 outputs to drive LED and filament lamps.

SmartCab

This is a computer controlled throttle which drives PWM at low speeds and plain DC at higher settings. This is actually a good module and recommended for those who want computer driven trains without having to build a throttle on breadboard.