Documentation > nControl > Getting Started
Configuring Train Detection Sensors
For nControl™ 2017.4 or higher
This article explains how the train detection sensor works and how to chose correct values for the configuration parameters.
How does the sensor detect trains?
Fig 1. presents the basic layout of the train detection sensor. The sensor has an infra-red (IR) light emitting diode (LED) that beams out IR light and an IR receiving diode that detects the amount of infra-red light coming towards the sensor.
Fig. 1: The components of the train detection sensor.
If there is an object in front of the sensor, the IR light that is emitted by the LED of the train detection sensor will be reflected back to the IR receiving diode that will detect it. This situation is shown below in Fig 2a. If there is nothing in front of the train detection sensor, the emitted IR light will not be bounced back to the sensor and the IR receiving diode will not detect it; see Fig 2b. So the amount of IR light detected by the receiving diode indicates whether there is a train in front of the sensor or not.
    
Fig. 2a: Object in front of sensor. Fig. 2b: No object in front of sensor.
Making sure the sensor works
Start by making sure the sensor is connected and working well. The green intensity bar at the bottom of the tile indicates the amount of IR light detected by the sensor. When there is nothing in front of the sensor you should have a small green bar, like shown on Fig 3a. When you put something in front of the sensor the green bar should increase and move to the right. It should look like Fig 3b. If the green bar doesn't change when putting something in front of the sensor, the sensor is not working. Check the cables and connectors; verify the channel and controller settings and try again.
    
Fig. 3a: Nothing in front of sensor. Fig. 3b: Object in front of sensor.
If the sensor detects a high amount of IR light even when there is nothing in front of it then there might be an ambient IR light source. Note that sunlight and most artificial light contains an amount of IR light. Cover the sensor with a opaque box or cup. If the green intensity bar drops then the sensor is indeed detecting ambient IR light. If intensity bar does not drop then there is a connection or configuration problem that has to be fixed before you can continue.
Setting the threshold value
The amount of detected IR light indicates whether there is an train in front of the sensor or not: a small amount of detected IR indicated there is nothing and a high amount of detected IR light indicates there is a train. A threshold value is used to separate these two domains. So if the amount of detected IR light is higher than the threshold value nControl considers it has detected a train. The threshold level is indicated on the sensor tile by the vertical gray line on the intensity bar, see Fig 4.
Fig. 4: The threshold value on the sensor tile.
The value of the intensity bar has to be well below the threshold when there is nothing in front of the sensor. So if there is a reasonable amount of ambient IR light you might have to increase the threshold to make sure there are no false train detections.
The amount of reflected IR light by the train depends on the surface that is reflecting it. Dark and irregular surfaces reflect less IR than light colored and smooth surfaces. So if you are using dark trains you might have to lower the threshold value to make the intensity bar crosses the threshold value when the train passes in front of the sensor, otherwise you won't detect the train.
The threshold value is a compromise between keeping it high enough to make sure you don't have any false detections; and low enough to make sure you're not missing any passing trains.
Setting the idle time
When the amount of detected IR light crosses the threshold level, nControl considers it detected a train and executes the trigger event script. However, the amount of reflected light will not be the same for every part of the train. For example, the space in between two cars will reflect much less light than the sides of the cars. As such the level of detected IR light might drop below the threshold level and each car might trigger the event script.
Fig. 5: Idle time required for a 3 car train.
To avoid that one train would cause multiple triggers, nControl will deactivate the sensor after the first trigger. The idle time defines how long nControl will wait before trying to reactivating the sensor. The idle time has to be long enough for the complete train to pass by. When the sensor is deactivated the icon on the sensor tile is red. Two conditions have to be fulfilled before nControl reactivates the sensor:
  • The idle time must have passed
  • The amount of detected IR light has to be below the threshold value
When the sensor is reactivated the icon turns green and the reactivate event script is executed.