This document describes how devices may be connected to a QTU board.
There are 24 general purpose outputs, arranged in three groups of 8.
These can handle upto 500mA each (though no more than 1A continuous on each group).
The outputs are 'open-collector' and when activated (output value set to '1') pull the output line down to ground. When the output value is set to '0' the output line is allowed to float positive to wherever external circuitry wants to take it.
The outputs should never be pulled to negative volts.
These outputs are compatible with those found on the RPC SRO4 module.
PL9 (central on the end away from the heatsink) has outputs 0..7
PL10 (nearest the RS232 connector) has outputs 8..15
PL11 (between the processor and the RJ45 connectors) has ouputs 16..23 but see below on connecting motorized switch machines - outputs 20..23 can have optional extra components fitted.
LEDs are useful in layout signals or control panel lights. The cathode (normally the shorter lead, but not always!) can be conected directly to the QTU output pin, and the anode taken to some supply line through a resistor. Suggested resistor values:
Supply voltage minimum maximum typical
5V 100ohm 600ohm 220ohm
12V 400ohm 2Kohm 1Kohm
V+ 680ohm 4Kohm 2.2KohmThe QTU can feed these supplies (see the power supply section below), but I suggest using V+ as any current drawn from this output does not cause heat dissipation in the heatsink. The only drawback with V+ is that it is not current limited, so you might like to insert a 1A fuse.
Same as LEDs, but without resistors. Use whichever power supply voltage is required by the lamps. If an external supply is used then connect its negative rail to ground on the QTU using pin 10 of the output connector. You can also use pin 7 of the power supply output or pin 2 of the AC feed block, but see these notes.
The QTU already has four DPDT (Double Pole, Double Throw - meaning two changeover switches) relays available for whatever you want, but if you want more relays, or perhaps remotely mounted relays, then these can be connected directly to the outputs. If you use any form of inductive load like relays or electromagnets then the positive supply for the relays should be connected to pin 1 of the connector, and strapped (using the three pin link by the connector) to the transistor drive chips (U12, 14 or 16) so that the built-in diode can protect against back EMF.
Use a PMD1, or a PMR1 if you need the extra relay.
The V+ line may be used to feed the PMD1/PMR1 provided your turnouts move reasonably freely and you only have a single motor on each PMD1/PMR1 (otherwise you may find you need an extra volt or two, but try V+ first as it is already available).
You can connect one of the output lines directly to the control input of the PMD1/PMR1 module. Then the state of the output directly controls the turnout.
Personally I prefer to omit the first transistor of the PMD1/PMR1 and use TWO outputs from the QTU, one to drive normal and one for reverse. The advantage of this arrangement is that the turnouts do not all change state when you power down your layout, which can of course derail any trains that are over the turnouts.
Outputs 20..23 can have extra components fitted which make them drive high when they are not pulling low. These outputs can source 500mA as well as sinking 500mA.
If you use tortoise motors then the regulator formed by R8,ZD2 and Q7 reduce the 12V supply to 7V for these outputs. Operating tortoises at 7V gives a much quieter operation and a slower action.
If you use Conrad motors, or any other form of motorized switch machine that runs from 12V at upto 500mA then transistor Q7 should be shorted out (link collector and emitter pins then assembling the board).
If you want to use outputs 20..23 for other purposes then simply omit transistors Q2, Q3, Q4 and Q5, and link across diodes D11, D12, D13 and D14.
Connect your QTU to a computer running Tcc.
Run Tcc with a .tcl file that declares the QTU throttles and at least as many inputs and outputs that the stack has available. It is best to use a test script at first so there is no confusion over pin naming. An example file qtu.tcl is available for this purpose.
Make sure you have no script in the QTU (or at least one which doesn't drive the outputs).
Start the network (or the stack the QTU under test is connected to).
Open the 'Controls' window (Menu->View->Control).
Click the buttons that represent the outputs.
The devices connected should activate appropriately.
LN1, LN2 and LN3 control what is connected to the clamp pin of the output transistor array associated with that connector. If you use inductive loads you should connect the appropriate power line to pin 1. The strap allows the 5V line to be used instead.
There are 32 general purpose inputs, numbered 0 to 31. These are connected to four connectors (8 inputs to a connector) PL5 to PL8.
These inputs can only handle signals between ground and five volts, but this still gives plenty of flexibility. Signals having higher voltages present must be interfaced appropriately to avoid damaging the QTU input buffer chips.
The four input connectors are around the corner opposite the RS232 connector, and each has a resistor array next to it (a long thin black blob). Inputs 0..7 are on PL5, the connector nearest the processor and inputs 8..15, 16..23 and 24..31 are progressively counter-clockwise, finishing next to outputs 0..7.
Any device that looks electrically like a switch can connect directly to an input, with the other side of the switch connected to ground on pin 10 of the same connector. Try to avoid using other ground pins for reasons explained here.
IRDOT (by Heathcote electronics) and HECTOR (from Merg) modules have open-collector outputs and these can be connected directly to an input. The sensor module can be fed directly from the 12V and ground pins of the QTU power supply connector. If an external supply is used for some reason then its negative rail should be connected to ground on the QTU (pin 10 of the output connector or your single star-connected common ground).
Light Dependant Resistors are a cheap way to detect trains, provided you can rely on ambient lighting (so they won't work in tunnels or dark rooms). They are connected directly to the QTU input and the ground pin on the same connector (pin 10) but also need a resistor between the input and 5V (pin 1 of the connector). The resistor value depends upon the LDR characteristics and the room lighting intensity. Experiment with values using a voltmeter and chose the value that gives the best voltage swing so that when obscured by a carriage (not your hand or a large object, but the rolling stock item with the largest ground clearance so it causes the least shading) the voltage rises nearest to 5V and when unobscured the voltage falls closest to 0V.
Use the same setup as for testing outputs but open the 'Sensors' window (Menu->View->Sensors)
Start the network.
Watch the sensors window while activating the various input devices.
The QTU has four DPDT relays available for driving things that the general purpose outputs are not capable of. For example track feed can be switched with a relay, or point motors requiring more than 500mA (but less than 2A) can be driven.
There are two 12-pin connectors situated at each end of the run of relays. Two relays are connected to each connector. Refer to the circuit diagram for connection details.
You might not use these on a QTU that is connected to computer and a layout if the computer is controlling the layout, but if the QTU is used for manual control, or if manual input is wanted either for the QTU script, or by the computer then the analogue inputs can be useful.
The analogue input connector (PL3) is situated in the middle of the board, between the relays and the processor.
Simply connect a potentiometer (any value between 1K and 100K, I suggest 10K is ideal) between 0V and 5V (pins 1 and 10 of PL3) with the wiper (center pin) connected to one of the pins 2..9.
Any line that varies in voltage can be sampled, provided it can be interfaced such that the input to the QTU never goes negative, or exceeds 5V. For example a line which varies from 0V to 12V (for example a track output from a conventional controller) could be connected through a potential divider (perhaps 5K and 7Kohm - 4.7K and 6.8K are preferred values), but the controller output must never be reversed if this is done!
Using the same test setup as for testing inputs and outputs, start the network and then click on the QTU in the network configuration window. Select 'Show RAM'. This will open a window that shows the memory available to scripts inside the QTU.
Look for 'AdcUser' down the left hand side.
To the right are eight, two-digit numbers. These are the values read from the analogue to digital converter for each of the inputs. The first value is AdcUser0 and the last is AdcUser7
As you turn your potentiometers up and down, one of these values should change for each input. Note that the window is only updated slowly, perhaps once a second, so be patient.
If your QTU has the 9-pin D connector fitted in the corner furthest from the heatsink then the board can be connected to a computer using a standard 9-pin serial cable. If your computer has no serial connections then use a USB-serial adaptor.
Associated with the serial connectors is the DIL switch. This defines the board address, which has to be configured in the 'Address' field under the 'Stack' in the network configuration window of Tcc.
Addresses are defined by the positions of switches 1..5:
1 2 3 4 5 Address
on on on on on 64
off on on on on 65
on off on on on 66
off off on on on 67
on on off on on 68and so on. Five bits of address are available, allowing upto 32 stacks driven off a single RS22 port. Each stack can have several QTUs (I have tested three, but it should handle sever or more).
You need to define an address even for RS232 connections because the RS232 signal actually travels through the RS485 system, and the board with RS232 is just one of the 32 possible stacks connected to the computer.
RS232 is a point to point system - it can only have a single device at each end of the cable. We might need to be able to connect more than one stack to a computer (to avoid long wires, or to overcome stack size limitations) and using one RS232 port for each board would be extremely wasteful, so the QTU supports RS485.
Next to the RS232 connector (or the space, if it is not fitted) is space for three RJ45 connectors. Boards not using the upstream stack have TWO of these fitted with connectors. These are the two nearest to the RS232 connector (SK2 and SK3).
A daisy chain (or loop if you prefer) of QTUs may be formed using standard ethernet cables. Straight pin-to-pin cables must be used (not crossover cables).
Each board in the chain (or loop) must be given a different address.
Define one stack in the network configuration window for each QTU in the chain.
If you have a suitably configured QTU (throttle outputs and relays removed, smaller heatsink and RJ45 in SK1) then it can be used as a walkaround control panel.
The general purpose inputs connect to the switches, the outputs drive LEDs (fed from V+) and control knobs connect to the analogue inputs. If necessary you can use SRI4 and SRO4 modules to add more inputs and outputs, but I think that would be unlikely for a walkaround panel!.
A single ethernet cable is connected from SK1 (the RS485 connector not normally fitted) to SK1 of another QTU on the layout (with SK1 supplied as part of the walkaround QTU kit).
Not only is data transferred by this cable, but the supply current is also (upto 2amps).
OK, you cannot make a hand-held unit as small as most DCC throttles, but you have have several speed controls (or inertia or whatever) on a single panel.
You configure Tcc to read the analogue input values and pass them to the (normal) QTU that is driving the appropriate train. Note that this function has not yet been tested and might required some software 'enhancements'.
If your QTU is a second (third, or subsequent) board in a stack, then the right-angled connector between the RJ45 connector positions (not fitted) and the track outputs will be plugged into another RPC board (or another QTU) in the stack. In this configuration the RS232 and RS485 (RJ45) connectors will be omitted, to avoid space conflicts between the two boards.
One day I plan to make an ethernet interface board that can be connected here instead.
Do not connect anything else to this connector.
Other RPC modules and/or QTUs may be connected to the right-angled socket connector positioned opposite to the upsteam stack connector. This connector is only usable if the QTU is connected to a computer (by RS232, RS485, ethernet or upstream stack).
This connector (next to the AC input block) provides 5V, 12V and V+ (around 21V) for external devices. This can power sensors, turnouts, solenoid motor drivers, signals and practically anything you might want on your layout. If you have several QTUs on your layout then it is probably a good idea to feed devices from the same QTU that their input or output is connected to. This shares the power consumption between the boards, so no QTU runs its heatsink too hot.
In addition to the basic supplies there are also:
+bias, -bias and AC that can be used for FTC (Floating Track Circuit) RPC modules.
Vtort - the 7V supply used for driving tortoise motors, so if you need to drive more than two tortoises from one QTU you can add the extra few components (two resistors and two transistors) for each tortoise.
AC1 and AC2. These pins connect straight to the transformer input so you can do whatever you like with them. Be aware that the QTU is unfused. If you short either of these pins, or V+ then large current can flow which can damage the QTU components or PCB. Either take great care around this connector or fuse the AC power.
This 3-pin pluggable terminal block is between the heatsink and the main decoupling capacitor. It should be connected to the secondary of a transformer (not supplied). The AC supply should be 50Hz. I have plans to support 60Hz, but it is not implemented yet.
For N and 00, a 15V-0-15V or 0-15V+0-15V transformer is required.
For G (where track voltages over 12V average are required) an 18-0-18V transformer is required.
The current rating should exceed the total draw of all the locos that could be moving simultaneously, plus an allowance for all the devices powered from the QTU (sensors, turnouts etc) plus 10%, then rounded up to the next available size.
The centre pin should be connected to the centre-tap of the transformer, and the other two pins to the outer connections of the transformer.
For safety it is wise to fuse the AC feeds to your QTUs. One strategy is to have a single large transformer for your whole layout, and fuses mounted on a power distribution panel which feeds all your QTUs. Alternatively fit inline fuses where a power bus feeds each QTU. Note that separate fuses are required for AC1 and AC2.
This connector can be equipped as any of:
a. 0.1" molex style. This is best for smaller scales, and where the track feed cable can be fitted into the crimp terminals.
b. A standard terminal block, soldered to the board.
c. A larger, pluggable terminal block, as used for the AC input.
d. A Push-to release terminal block that doesn't require a screwdriver to operate.
The PCB has been designed to accept any of the above (the larger connectors should have a 5mm spacing, not 0.2").
Each pair of pins should connect to a section of track (or several sections through relays, in any manner you choose). Note that there is not an output and common return. Both rails must be isolated between track sections. QTU does not support common return.
I do not use common return as it would require separate transformers for each output, and lots of opto-isolation components. This would means 24 transformers for my layout, and I expect it to at least double before the layout is finished. To me that is an unacceptable overhead, so I have removed common return from my layout.
13.1. J1: Relay power.
This is strapped during assembly to select either 12 or 24V for the on-board relays.
13.2. J2: Programming port.
This is only required during assembly and should not be connected.
13.3. J3: 5V power link.
This should always be linked, except during assembly testing.
13.4. J4: Uplink stack 5V options.
As the QTU does not receive power from the stack, this jumper should not normally be connected (it is reserved for the ethernet extension later).
13.5. PL4: One wire comms links.
This is reserved for future expansion. Plans include comms links to allow adjacent QTUs to communicate without a computer, also servo drive outputs, or PWM.
13.6. U6: EEPROM expansion
This chip is not fitted as no support is included for it yet. It might be used to allow larger scripts to be downloaded.
The three LEDs on each QTU show a little of what is going on.
If the red LED is flashing once a second, and the green is off, then no valid firmware is available, and the QTU is waiting for a firmware download from Tcc. This condition should only be seen if a download is aborted for some reason.
If the red LED is off it means that no errors are detected.
If the red LED flashes occasionally then an error has occurred. This is most likely because messages from the computer are invalid, or running at a bad baud rate, or that the AC supply frequency is not 50Hz.
If the yellow LED is flashing it means that message from the controlling computer are being received. Each time the yellow LED changes state a message has been received. Thus five flashes per second indicates 10 messages per second.
If the green LED is flashing it means that the script is being interpreted. Each flash indicates that the whole script has been interpreted 256 times! You will soon discover that even complex scripts are interpreted hundreds of times per second.
If the green LED stops flashing (but all is otherwise working) it means that you are downloading a new script, or that have an infinite loop in your script. As script outputs are only sent to the hardware when the script completes one pass, it would mean that no inputs or outputs are being processed.