BOD4-RLY Infra-Red Train Detector with 1.5A Relay

BLOCKsignalling BOD4-RLY Block Occupancy Detector

Detects trains and operates a built-in relay.

  • Quick and easy way to detect trains anywhere on your layout, even in tunnels

  • Detects passing trains using its in-built infra-red sensor

  • Very easy to connect up to simple indications on a control panel, operate motors, electromagnets, or to add as inputs to computer systems

  • Operates from 12V DC

  • Low current output (+5V DC) to feed leds, signals or small relays

  • No programming necessary (but you can adjust all settings if you wish)

 

 

This module came about after a customer asked for a module to operate a stop solenoid on his Faller model car layout.  It is based on out BOD2-RLY train detector, but with a larger relay to handle the current for the electromagnet.

It is just at home on a model railway, to detect trains and operate led or filament signals, motorised features, or any other action you can envisage.

The relay van handle up to 1.5A current at 24V DC.

 

Operation

The following describes the basic operation.  Many settings can be changed if required to tailor the operation to a particular requirement if desired.

 

When a train crosses the infra-red sensor, the relay coil is energised and the relay common contact (labelled COM) moves from the normally-closed (NC) position to the normally-open position (NO).

After the train clears the sensor, the module de-energises the relay and the relay contact moves back to the normally-open position.

A delay can be set before this occurs to allow a train indication to remain present for a period, or the indication can immediately reset. The module can also be set to ignore the gaps between carriages. With a delay, the module can operate a two aspect signal, switching to red when a train crosses the sensor, and back to green a preset time after the sensor is cleared.

There are several programming options available (see later), including some new randomising options to make actions more realistic, and also some settings so that the module does not respond to every trigger which could be useful to stop only a proportion of passing trains for instance.

The module requires a 12V DC supply and has a low current +5V DC output, which is ideal to drive leds or signal lamps.

 

Power Supply

The module requires a power supply 12V DC and draws a maximum current of 80mA.

When connecting a DC supply, connect the negative to the GND terminal and the positive to the Vin terminal. If the connections are accidentally reversed, the module will not function, but no damage will result.

 

Connecting up

The relay outputs are available on the normally-open (NO), common (COM) and normally-closed (NC) contacts. When the power is turned off, the relay de-energises and the connection is made between the NC and COM connections.

Shown below is an example wiring diagram to connect a 2-aspect signal or control panel leds to the BOD4-RLY.

A 1k resistor is necessary to limit the current through the leds.

wiring diagram BLOCKsignalling BOD2-RLY

The relay output can be used to connect to leds, filament bulbs, relays, electromagnets or computer systems. There are no volts on the contacts (they are "volt free").

 

Terminals

The module has six terminals.

Vin Positive feed of the DC supply

GND Negative feed of the DC supply

Vout This is a regulated +5V DC output which can be used to feed leds, small relays, or bulbs (maximum 100mA).

NO The terminal is the normally-open contact of the relay.

COM The terminal common terminal of the relay.

NC The terminal is normally-closed contact of the relay.

 

Sensor Installation

Simply drill an 8mm hole through the baseboard between the sleepers and insert the sensor from below.

Train Detector

If required, the sensor can be held in place using a small amount of blutack, expanded polystyrene or similar.

The led diameter is 2.2mm, so on smaller scales the leds can still have a clear view between the sleepers.

Train Detector

LED Connection

When using leds it is important to connect them the right way around.

The negative lead (cathode) is identified by a flat on the side of the led body, and by having a shorter lead.
led anode and cathode connections

Programming

The default program is to operate in the instantaneous mode, so if you want one of the other modes, or to change timings for instance, you will need to reprogram the module.

Programming is performed holding down the Push Button when switching on the power.

Red Green 2 Aspect Signal Controller

The red led on the PCB flashes at 1 second intervals. When the required number of flashes is seen (see later for the list of possible choices) the button is released to store the first value. At this point the led comes on for five seconds to confirm the value is stored.

The led then starts flashing again, and this time the button needs to be pressed to store the second value.

Once the two values to be stored are entered, the led flashes 10 times rapidly, and the module starts operating.

To select the program function of the module, first you should see 2 flashes, then the number of flashes to select the program you want. 

To change individual settings for the programs, the number of flashes that should be see first varies from 3 to 14, and the second number of led flashes represents the new setting you want.  This is described below, and also shown int he programming diagram at the end of this text.

Most values entered can range between 1 and 255 (see below for limits). If more flashes are seen, or the programming is aborted by switching off, then the programming must be repeated.

Factory Reset

To reset the module back to factory settings, switch off the power to the module and hold down the Push Button. Apply the power and continue holding the push button until 1 flash of the led is seen. At this point, release the button. You will see a long flash of five seconds.

The led will begin flashing again. When you have seen 1 flash press the button. You will see a long flash of five seconds and then 10 rapid flashes. The reset procedure is then complete and the module will restart with factory settings, and run in instantaneous mode. If you make a mistake programming, simply repeat the process.

Sensitivity Setting

The module is supplied with the sensitivity preset to suit most installations and should not need adjustment.

The sensitivity is factory set to 5, and can be adjusted from 1 to 10 (with 1 being the most sensitive and 10 being the least sensitive).

To change the sensitivity, switch off the power to the module and hold down the Push Button. Apply the power and continue holding the Push Button until 9 flashes of the led are seen. At this point, release the button. You will see a long flash of five seconds.

The led will begin flashing again. When you have reached the desired number of flashes to set the new sensitivity, press the button. You will see a long flash of five seconds and then 10 rapid flashes. The programming is then complete and the module will restart. If you make a mistake programming, simply repeat the process.

Performing a factory reset will reset the sensitivity setting back to 5.

Built-in Programs

In order to set-up the module with minimum effort, there are several programs built-in.

Selecting one of these programs will perform a factory reset on the module (losing any previously made changes), and then make a number of setting adjustments automatically.

If you want to further refine the settings of these programs, follow the instructions in the section after selecting the required program.

 

Program 1 - Test Mode

In this mode, the relay is energised for 1 second, and then denergised for 2 seconds.

This is repeated until another mode is selected.

Program 2 - Instantaneous Mode (DEFAULT)

When the infra-red sensor is triggered by a train, the module immediately activates the relay.

The module checks to see if the train has cleared the sensor.

If the train has cleared the sensor for at least 1 second, the relay is denergised.

The module then restarts and awaits the next train.

The 1 second delay is fixed.

Program 3 - Signal Mode (Delayed Mode)

When the infra-red sensor is triggered by a train, the module immediately activates the relay.

The module checks to see if the train has cleared the sensor.

If the train has cleared the sensor for at least 4 seconds (the holdover delay), the module waits 10 seconds, and then the relay is denergised.

The module then restarts and awaits the next train.

This program could be used to control a 2-aspect led signal.

The holdover setting means that gaps between carriages are ignored, and the final delay allows the signal to remain at red for a realistic period.

It is possible to change the holdover delay by programing memory 3.

Program 4 - Short Pulse Mode

This program energises the relay briefly when the sensor is covered by a train.

The relay pulse duration is in steps of 100ms, with a default value of 2 (=200ms).

The duration is set in multiples of 100ms steps using setting 5 (the PULSE ON TIME).

The train must clear the sensor, before the train can be detected again, and so generate another pulse.

Typically this program would be used to connect to a computer control system, to notify it that a train has arrived at a certain point on the layout.

Program 5 - Long Pulse Mode

This program energises the relay for a number of seconds when the sensor is covered by a train.

The relay pulse duration is in steps of 1 second, with a default value of 2 (=2 seconds).

The duration is set in 1 second steps using setting 5 (the PULSE ON TIME).

The train must clear the sensor, before the train can be detected again, and so generate another pulse.

The pulse time can be randomised to between 25% and 100% of the set time.  To choose this function, set the relay pulse duration to 4 seconds or greater, and enable the randomise function (see later).  For example, if a time period of 40 seconds is set, each time the relay will operate for between 10 and 40 seconds.

Typically this program could be used to halt a train at a certain point on the layout for a number of seconds. When the train crosses the sensor, the relay will energise for a period, cutting the power to the track section. When the power is re-applied after the pulse delay, the train will clear the sensor without the module being retriggered.

Program 6 - Recurring Short Pulse Mode

This program energises the relay briefly when the sensor is covered by a train.

If the sensor remains covered, the relay will continue to energise and de-energise.

The pulse duration is in steps of 100ms, with a default value of 2 (=200ms).

The duration is set in 100ms steps using setting 5 (the PULSE ON TIME).

The relay is denergised for the time it takes for the module to detect the trains presence again (default is 1 second).

Typically this program could be used flash an led at a fast rate when the train is over the sensor (perhaps to convey an urgent indication).

Program 7 - Recurring Long Pulse Mode

This program energises the relay for a number of seconds when the sensor is covered by a train.

The pulse duration is in steps of 1 second, with a default value of 2 (=2 seconds).

The puse on duration is set in 1 second steps using setting 5 (the PULSE ON TIME).

The pulse off duration is set in 1 second steps using setting 6 (the PULSE OFF TIME).

Typically this program could be used flash an led at a slow rate when the train is over the sensor.

 

Adjustable Settings

There are a number of settings which can be adjusted to change the operation of the module.  The diagram at the bottom of this document summarises the settings.

 

Memory 3 - Holdover time

This is the time after the object clears the sensor, before the module decides it is absent.  As a train passes the sensor, there will be gaps between each carriage which need to be ignored.  The default value is 4, which allows 4 seconds for the gap between carriages.  Any gap of less than 4 seconds is ignored.  If single locos or vehicles are being detected, this value can be set to a minimum (1 second).

Memory 4 - Final Delay

This is the time after the sensor has been cleared of any object in front of it, and the holdover time has elapsed, before the module de-energises the relay.  This is used when signals are connected, where after the whole train has cleared the sensor, it is desired that a period elapses before the relay is de-energised to change the state of the signal.

Memory 5 - Relay On Time

This is the setting for the time which the relay is energised.  It may be in second, or 0.1 second steps (depending on the program).   The default value is 2, which represents 2 seconds, or 0.2 seconds depending on the program in use.

Memory 6 - Relay Off Time

This is the setting for the time which the relay is denergised in programs where the relay is pulsed on and off.  It may be in second, or 0.1 second steps (depending on the program).   The default value is 2, which represents 2 seconds, or 0.2 seconds depending on the program in use.

Memory 7 - Trigger Delay Type

This setting has three possible values.

When set to value 1, the Trigger Delay is not used, and so as soon as an object is detected, the relay is energised (default value).

When set to 2, the Trigger Delay is used.  When an object is detected, after a delay set (Memory 8 - Trigger Delay) the relay is energised.

When set to 3, the Trigger Delay is randomised to between 25% and 100% of the set time (Memory 8 - Trigger Delay).  To choose this function, set the Trigger Delay to 4 seconds or greater.  For example, if an Trigger Delay of 40 seconds is set, each time the module is triggered, the operation of the relay will be delayed by between 10 and 40 seconds.

Memory 8 - Trigger Delay Time

This is the duration (in seconds) from when the detector first sees an object to the relay being energised.  The time can be set to between 1 and 254 seconds.  To use this delay, it must be turned on using Memory 7 (Trigger Delay Enable).

Memory 9 - Infra-Red Sensor Sensitivity

The infra-red sensor sensitivity can be adjusted from 1 to 10 (with 1 being the most sensitive and 10 being the least sensitive).  The default is 5.

Memory 10 - Relay On Time Randomised

This setting has three possible values.

When set to value 1, the relay is energised for a fixed time set by the Pulse On Time (default).

When set to 2, the Pulse On Time is randomised to between 25% and 100% of the set time.  To choose this function, set the on Pulse On Time duration to 4 seconds or greater.  For example, if a Pulse On Time of 40 seconds is set, each time the module is triggered, the relay will operate for between 10 and 40 seconds.

Memory 11 - Triggering Proportion

This memory has three possible settings.

If this memory is set to 1, then proportional settings are not used (default).

If this memory is set to 2, then the relay will only operate then the module will keep count of the number of times it has been triggered, and will only operate the relay each time the appropriate number of triggers has taken place.  So for instance, if the proportion is set to 4, the only every fourth trigger will result in the relay operating (1 in 4 successful).

If this memory is set to 3, then each time the module is triggered, it will decide whether the relay should operate.  So for instance, if the proportion is set to 4, the only 25% of triggers will result in the relay operating.

Memory 12 - Proportion Setting

If the module is programmed for fixed proportion, then this setting determines how many triggers need to occur before the relay operates.

Set value=1, relay operates every trigger (default).
Set value=2, relay operates every other trigger.
Set value=3, relay operates every third trigger.
Set value=3, relay operates every fourth trigger.

etc (maximum value 16)

If the module is programmed for random proportion, then this setting determines the proportion of triggers that cause the relay to operate.

Set value=1, relay operates every trigger (default).
Set value=2, relay operates on 50% of triggers.
Set value=3, relay operates every 33% of triggers.
Set value=3, relay operates every 25% of triggers.

etc (maximum value 16)

Memory 13 - Invert Proportion

This setting can be used to reverse the set proportion.

A setting of 1, leaves the operation as described.

A setting of 2 inverts the function, so every time the relay would have operated, it no longer does, and every time it would not have operated, it now does.  For example, this can be used where the relay was set to operate 1 in every 4 triggers to instead operate for 3 in every 4 (ie ignore 1 in 4 triggers).

Memory 14 - Invert Relay Action

This setting can be used to reverse the operation of the relay when the module operating.

A setting of 1, leaves the operation as described.

A setting of 2 inverts the relay function, so that when a train is not detected, the relay is energised.  When a train is detected, it is de-energised.

 

Program Flow Diagram

The diagram below shows all the programming options.

Programming is performed by holding down the Push Button when switching on the power.

The red led on the PCB flashes at 1 second intervals. When the required number of flashes is seen (see later for the list of possible choices) the button is released to store the first value. At this point the led comes on for five seconds to confirm the value is stored.

The led then starts flashing again, and this time the button needs to be pressed to store the second value.

Once the two values to be stored are entered, the led flashes 10 times rapidly, and the module starts operating.

The led will now flicker whilst the module searches for trains.

Most values entered can range between 1 and 255 (see below for limits). If more flashes are seen, or the programming is aborted by switching off, then the programming must be repeated.

Following the diagram is a detailed explanation of all the settings.

Any additional components shown in diagrams and photos are only to illustrate connections and are not included with the module.  Supplied with one sensor.