2 Hardware interfacing There are two fundamental ways you can interface a model railway to a computer: either direct connections, or indirect connections. 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: No 'unnecessary' hardware required. Simple to understand. Cheap Disadvantages of direct connect: Large bundles of cables Lots of inter-baseboard wires (for segmented, non permenent layouts) Very suceptible to noise from track power picked up on other wires. Indirect connect uses some kind of multiplexors between source and destination. For example all sensors on a baseboard are directly wired to a multiplexor and a single wire is run to the control panel where a demultiplexor 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: Most wiring (except track feeds) can be replaced with a single multiplexed line. Tracing through faulty connections is simpler. Rewiring (to reroute a singal to a different location) can be done in software or firmware. Sending signals to multiple destinations, or performing some kind of logic on them (eg. anding two lines together) can all be done in a single programmable device. Signals can be sent further without degradation or noise pickup. Disadvantages of indirect connect: Uses extra hardware. Highter cost. Suppliers of indirect connect interfacing hardware. 1. RPC The kits Gordon supplies 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. The SRI4 module 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. The 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. 2. CTI electronics The modules that are available from CTI (http://www.cti-electronics.com) are similar to the RPC units in capability, but are ready build 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. Digitrax DCC hardware: Not having any real experience I cannot say much here, perhaps someone can give me the proper words. Considering only the indirect connect I/O side, the system looks like this: Output from the PC is mixed with the output from the hand-held controllers to produce the basic DCC signal. This may then be fed through boosters to generate sufficient current capacity for your layout. The boosted signal is fed through track circuit modules (BDL-16 ??) to feed the tracks. Accessory decoders are fed from the track to generate outputs to drive whatever hardware you have - turnout motors, signal lamps etc. The DCC signal is only used for outputs. Inputs are handled over a separate network: 'LocoNet'. For example the BDL-16s (current detectors) connect to the PC via LocoNet and allow application software to receive the track circuiting information. If you wanted to write software to interface to Digitrax DCC hardware you would need to write two, very different pieces of software: one to generate the data to send to the DCC hardware, and also one to send and receive packets on LocoNet. Although DCC is harder to connect to it does have the advantage that the throttles are migrated into the locos, and this does simplify track power feeds (even though you still need to section your track for track circuiting).