Detecting Trains
It must be 15 years since I started adding detection sensors to the railway, and little has changed. Commercially available detectors fall into two camps:
- Electrical block detectors: these give a yes/no indication about whether a train is present in a block, but no information about where the train is in the block. This is a good technology to indicate that a block is occupied, and therefore another train should not enter it. By default, locomotives are detected because the prove=ide a current load to the track. Resistor wheelsets are needed for other rolling stock (wagons, carriages...) to they can also be detected.Â
- Infra-Red detectors: these are OK to provide an indication that "there is something a this position" but they do not signal that a track section is occupied. Plastic bodies of modern modes are not very IR reflective, but sticky tape can resolve that. They are prone to being operated by human hands passing over them, and by background lighting.
Block detectors are great for indicating occupancy. Identifying train position within a block remains an unsolved problem. There are at least a few ideas around for alternative solutions, and Hans Tanner in his excellent "Internet of Toy Trains" work has identified most of these and investigated some.
- Hans Tanner has investigated Lidar sensors. These indicate the distance of an object from the sensor, using a fairly narrow optical beam. They give an analogue readout of distance, which would need an extension to LocoNet messaging or a different message transport (eg MQTT). In principle this technology could be really good for stopping a train at a particular spot on a platform, for example: short trains could be stopped further up the track so the passengers can be near the entry and exit. A potential issue is that they probably lack the ability to discriminate between two adjacent tracks at longer distances. This is OK if the relevant track can be deduced from context. Traincontroller could make that distinction, because it knows which block to expect moving trains in, but it would need new code to do that and it is closed source. Possibly qualifying the sensor report with the "most recently occupied" status of the two tracks from block detectors could help.
- "Train side" sensors could work well, but that would need new electronics an new communication from the rail mounted vehicles. Viable for larger scales but probably not for N/TT/Z scales.
- Camera based detection has been proposed (and I think Hans Tanner mentions this in an interview). Prone to interruption by humans leaning over, and by lighting conditions that may change during the day. Given the very low cost of modern cameras and processing, this must be a technology to be considered at some point.Â
- Could acoustic detection and triangulation using several microphones be relevant?
- ... no doubt there are other possible technologies!
Â
LocoNet supports up to 4096 track sensors. Sensors are generally numbered on the basis of 256 sensor boards each of which can have 16 sensors: 256*16=4096. This convention comes from the BDL168 detector having 16 inputs, and having to be assigned a sensor board number when set up.
On the South Downs Railway we have sensor messages generated by DAC20, BDL168, DTM30 and SIGM20 devices. To keep a record, here is the list of sensor numbers in use:
Board type | Board number | Sensor number(s) | Purpose |
SIGM20 serial 65 | 20 | 1-8 | Track occupancy sensors, from BD4 |
BDL168 | 21 | 1-16 | Track occupancy sensors |
BDL168 | 22 | 1-16 | Track occupancy sensors |
BDL168 | 23 | 1-16 | Track occupancy sensors |
BDL168 | 24 | 1-16 | Track occupancy sensors |
BDL168 | 25 | 1-16 | Track occupancy sensors |
BDL168 | 26 | 1-16 | Track occupancy sensors |
BDL168 | 27 | 1-16 | Track occupancy sensors |
BDL168 | 28 | 1-16 | Track occupancy sensors |
BDL168 | 29 | 1-16 | Track occupancy sensors in Portsmouth goods yard |
BDL168 | 30 | 1-16 | Track occupancy sensors in Portsmouth goods yard |
DAC20 serial 2 | 161 | 1 | microswitch on Eastleigh lift-up section. ON when flap in normal position. |
DAC20 serial 2 | 161 | 2-5 | Track occupancy sensors, from BD4 |
DAC20 serial 4 | 158 | 1-4 | Track occupancy sensors, from BD4 |
DAC20 serial 684 | 159 | 1 | microswitch on Portsmouth lift-up section. ON when flap in normal position. |
DTM30 | 160 | 1-4 | interlocks with DTM30 at Eastleigh |
DTM30 | 160 | 5 | button press to signal traincontroller to start oil train schedule |
DTM30 | 160 | 6 | A "toggle" button to signal traincontroller that track 1 is/isn't available |
DTM30 | 160 | 8 | A "toggle" button to signal traincontroller that track 2 is/isn't available |
DAC20 serial no. 6 | 162 | 1-4 | Track occupancy sensors, from BD4 |
DTM30 ser 457 | 163 | 1-16 | DTM30 special functions triggered by button presses |
DTM30 ser 457 | 164 | 1-4 | DTM30 interlocks |
DTM30 ser 457 | 164 | 5-8 | DTM30 special functions triggered by button press |
DTM30 clanfield | 165 | 1-4 | DTM30 interlocks |
DTM30 clanfield | 165 | 5-7 & 9,10 |
special functions: platform 3-1 access & schedule requests |
TXC1 | 240 | 1 | reports occupied while turntable is turning |
The BDL168 settings are set as follows. There are more option switches than are published in the BDL168 manual; Stefan Trachsler's excellent "LocoNet-Checker " program finds them all and can edit them.
sw1=t | direct home wiring. |
sw3=c | reverse railsync polarity for transponding detect (not important with no transponding) |
sw5=t | transponding NOT enabled |
sw9=c | Do NOT show "occupied" when track power is off |
sw10=t | detector 16=normal detection |
sw11=c | do not allow to become LocoNet master |
sw12=c | do not allow to terminate LocoNet |
sw13=t | 5s power up delay |
sw19=t | normal sense threshold |
sw25=t | 16 LEDs show occupancy (we don't use them though) |
sw26=t | LEDs would be driven by DCC (not relevant) |
sw33=t | OPS read detect is enabled (not relevant) |
sw36=c | ignore GPON message |
sw37=t | standard OFF timing |
sw38=c | Extra long release delay for sensors (prevents "chattering") |
sw39=t | verbose mode not enabled (I don't know what this is) |
sw40=t | don't reset factory defaults |
sw42=c | respond to first "interrogate" request |
sw43=t | don't disable filter for transponding (not relevant to us) |
sw44=t | don't select extra transponding filter (not relevant to us) |
sw45=t | send transponding messages at GPOFF (not relevant to us) |
 When viewed in the LocoNet-Checker Module configuration window, a check box is ticked for that option being CLOSED. It is unticked for THROWN.Â
Â
The fundamental need is to be able to split the track into blocks, and monitor the presence of trains in each block. Each block must be longer than the largest train; movement from block to block sets the basis for automatic control. If the block ahead is free, a train can proceed; if it is not, a train must stop.
It is logical for each block to have a signal, which tells the train driver if it is safe to proceed; on this railway, those signals are automatically set. That requires an ability to detect trains.
We need to be clear at this point that the computer control software packages need to know that something is occupying the track. They don't need to know what is occupying the track. Consequently Digitrax's "Transponding" is not required.
There are two quite different detector technologies:
- Occupancy detectors determine if a train is present in the track ahead. They do this by monitoring the current fed into each track section. This requires that the track is fed with power in short sections, and that each feed has a current detector. These, nowadays, are sensitive enough to detect a loco that is present but not moving.
- Position detectors identify the presence of a train at a particular location. This might be an optical detector (either using reflected light, or an interrupted light beam), a microswitch, or a reed relay operated by magnets. These can reliably indicate that a train is here right now. However they provide no reliable indication that a train is between one location and the next. Some manufacturers have provided ways to join them together, so that a train passing the next detectors cancels the indication from the previous one: but it is essential to make sure that such a scheme can't be fooled by human hands near the rail etc.
On my railway there is a need for both kinds of detector. Occupancy detectors are great for identifying that there is a train ahead, but not exactly knowing where. This is good to detect if a signal is red or not. Position detectors would be good at identifying the exact time a train reaches a location. This would be good for stopping at a specific position - e.g. in a station or at a signal.
In practice, I've selected occupancy detectors for both roles. A "main" block detector covers the majority of the path to the next signal; a short section covers the piece of track immediately in front of the signal to tell a train to stop if it is not safe to proceed. Some research into stopping distances identified that the train would typically stop within 40-100mm of a new occupancy detector region, depending on speed. In practice the speed would be low by then, with a smaller margin of uncertainty.
I've mostly used Digitrax BDL168 block detectors. A single board provides 16 separate detect channels, split into groups of 4 (each group may be in a different power zone, but all 4 within a group are connected to a single power zone feed). Some of the predecessors of this product had issues with some kinds of loco decoder; but the newer ones are pretty reliable and I've seen them in use with no problems on other computer controlled railways. In the fiddle yard, a late design change resulted in a need for a few extra detectors. The Digitrax BD-4 has been used to provide 4 detection channels, and connected to LocoNet by SIGM20 units.