User Tools

Site Tools



Sensors are the "eyes" for Rocrail to be able to run trains in automatic mode.

Sensors are devices that trigger (or "sense") when a train passes through them.
They can be simple pieces of track with isolated rails, magnetic switches embedded in the layout, infra-red beams that
are triggered when a train breaks the beam, or even barcode readers that read a barcode on the bottom of a car as it is passing over.\ Rocrail needs sensor information to automatically control your trains. This is how Rocrail "knows" that a train leaving one part of the layout has made it to another.
Sensors are available in different types and which one to choose depends on your system and the kind of signaling you want.
Some sensors trigger when a wagon connects one rail to another, some trigger when a magnet on the bottom of a wagon passes over them,
and others trigger when a locomotive or other cars with a wheel set resistor draws current from a section of the track.

All types of feedback sensors allow the detection of changes of state, which can then be evaluated in Rocrail as events.
A couple of designs (contact tracks and current sensors) also allow the analysis of the occupancy of entire sections of track for the entire duration of this state. This feedback can then be used as track occupancy detector .
Some designs (switching tracks, reed switches, infrared detectors and bar code readers) are limited or not as track occupancy detector suitable because they can not "see" whole sections of track and detects only changes or certain vehicles.

But all sensor schemes involve the same 2 things:
1. Feedback sensors detects in one or more sections of your layout when a train passes and send this to connected encoders.
2. The encoders report the information back to Rocrail when a sensor is triggered.
The classic scheme is based upon contact rail, for example s88 feedback bus used by Märklin.

Sensor Schemes

Current Detection

One rail is isolated and run through a circuit that senses current draw. Usually used with 2 rail systems like HAMO and American DCC layouts. Trains and wagons with low impedance (i.e. allowing current to flow between the rails ) generates signals. The sensor tracks the current being drawn in a particular piece of track. Locomotives will always draw current. Bridging the normally isolated wheels on a wagon will allow it to draw a small, safe amount of current as well.

smd-wheelset.jpg Wheel set resistor

This can also be used with 3 rail systems by isolating the 3rd rail and sense when current flows through the feeder in the isolated section. Marklin M track is very easy to use with Current Detection since the center rail can be isolated with a small piece of paper.

See for current detection at GCA93 or GCA94

Magnetic Reed Switches

Reed contacts (or switches) are activated with a small magnet. The switches shown below will be activated if a locomotive or wagon with a magnet on the bottom passes over them. The magnet on the rolling stock must be mounted low enough to close the switch embedded in the track.

reed-switch.jpg fl6435.jpg

Reed contacts can be very hard on the pickup shoes in 3 rail locs, and very hard to use with Marklin M track, where the magnet on the bottom of your locomotive is constantly pulling towards the metal track bed. Magnets can fall off your locomotives and wagons, causing all kinds of problems. And once a reed switch that is embedded in your layout breaks, you must tear up the track and replace it, it cannot be serviced.

Hall-sensors and magnets

Compared to reed-switches , the hall sensors is much more reliable and smaller.

An example for the use of hall-sensors and magnets is to be found at GCA173, and for outdoor use GCA179.

Infra Red

A signal is generated when something breaks or disturbs the light beam between the sender and the receiver, usually a train rolling between them. The sending and receiving LED's are usually concealed in track side structures like small houses or signals.

Examples remarks
GCA133 Reflection OR ray suppression (selectabe)
GCA190 Reflection only


NOTE: Infra-red systems will fail if the LEDs are not covered with hoods and the room is flooded with strong light, such as sunshine coming in a window at Sunrise or Sunset.
If you use Infra Red systems, make sure you put hoods or covers over your sensors, try to keep your light levels constant and watch out for direct sunlight.
These problems do not occur with the MGV133 interface, since this unit is using high frequency pulses for detection.
The cheaper GCA190 absolutely need a good cover, it is light sensitive.

Train Detection

There are a number of systems that try to read each locomotive by using short range detection, including the Uhlenbrock LISSY infrared system and the BARJUT barcode reader system.
All these involve placing a marker of some kind (a radio, or barcode sticker, or other identifier) on the locomotive.
As the locomotive passes over a sensor, the sensor not only knows that something is there, it knows exactly which train by reading the marker.
Train detection also gives locomotive address information. The sensor does not just send an OCCUPIED signal back to the Central Station, it sends the address of the device crossing it.
(Rocrail supports the Lissy receiver in combination with the LocoNet protocol.)
See for more info: Bi-Directional Communication

Sensors for 3-rail systems like Märklin

Switch or Circuit Track

A plastic toggle on the 3rd rail is activated (pressed to the left or right) by the pickup shoe on a locomotive. These tracks are usually bidirectional and have 2 outputs, one to show each direction. You will need to bridge the outputs for Rocrail, otherwise they look like two separate sensors, each of which is "one way only."


Contact Track

For 3 rail systems, one outer rail is isolated from another, and the axles on a loc or wagon shorts both rails. This is the most common of sensor tracks, and is easily fabricated with Märklin C or K track.

maerklincgleisblock.jpgMärklin C track with 74030 and 74995. The bridge between the outer rails can be easily cut without causing too much damage. You have to make sure, that there is no joint between the rails itself.

Sensors and Blocks

This section should provide an overview about how Rocrail uses sensor events. A detailed description to the possibilities of different combinations of sensors is found on the page Sensors and Blocks.

The number of sensors per block can vary between one and five, better results are typically achieved with an increasing number of sensors. Every sensor generates an event which is used by Rocrail for the decision what should happen as next to the concerning train.

The simplest solution is the one using one single sensor: enter2in. However, the disadvantage of this easy solution is the a little bit clumsy driving behaviour of the trains.

With two sensors the driving behaviour becomes more elegant. If the train passes the first sensor (enter) it is determined whether it can drive through or must be stopped. In the latter case the train slows down to the V_mid-speed set in Locomotive Properties. If the train then passes the second sensor (in) it is decelerated to a halt.

With a third sensor (exit) the correct halt of the train can be supervised. If the train does not stop between enter and in or is reacting too slowly an exception ("Ghosttrain") is generated and with it the whole arrangement will be stopped.

If the block is used in both directions, the enter-sensor of the respective direction has the in-function for the counter-direction and vice versa.

In automatic mode the starting block of a locomotive is not freed until Rocrail has received the in-event of the destination block: If a locomotive with the destination block B leaves block A the latter one is not freed until the locomotive reaches the in-sensor of block B.

A block can be locked only once it was freed before and no more sensor of the block indicates occupancy. Unused block sections can be combined electrically to signal block occupancy (occupied). If a locomotive leaves block A and triggers the in-event in block B block A is not freed if one ore more sensors are active.

This is very helpful to the recognition of lost cars as a result of accidental train separation. Such lost cars would trigger the occupied-sensor by which Rocrail is stopped from sending trains to the block in which the lost carriages are.

[Version: 2010-03-12]

sensors.txt · Last modified: 2021/11/21 00:29 by rainerk