User Tools

Site Tools


MGV133 Infra Red gate / reflector sensor


By Peter Giling

IR gate as easy as anything...

In some situations, it would be nice to sense trains and/or waggons on approach.

With power consuming items, like locs or waggons with illumination or tail lights, it is easy done by MGV93 current detector.

But on a cargo bay, not all waggons have this outfit.

There are IR sensor systems like Uhlenbrock Lissy, sending even an ID, but they also need power from the track, and are rather expensive.

MGV133 provides four solid and easy to build sensor gates, also useable for detection by reflection.

The prototype

How does it work ?

The processor PIC16F628 or alike,has a crystal of 9.216 MHz.

With that frequency it is easy to generate an exact 36 Khz 50% duty cycle pulse.

This pulse is available at U1(9).

The 4 IR Leds radiate the 36 kHz.

The receiver SFH5110-36 will detect the send 36 kHz.

Both IR Led and SFH5110-36 match in their IR wave lenght of 940-950 nM.

Each gate will work between 5 and 500 mm distance between Led and Ir sensor.

Also reflection is possible by mounting the two items side by side. That is very convenient to mount them under the rails, and sending and receiving signal throught the gaps between the rail-supports.

Almost anything that comes on top of will reflect the ir beam onto the sensor.

Some plastics might not be able to reflect IR-light. In that case glue a small peace of metal or metal tape inder the waggon.

It also might be necessary to fix a metal plate between transmitter and receiver, because they should not see each other directly.

For the longer distance , it helps to put a small tube over the IR led, to create a small bundle.

P1 to P4 will adjust the sensitivity.

Connector J1 is to be connected to GCA50. The connector also provides 5V supply through pin 1 & 2.

Outputs are to be bridged to either pin 3-6 OR 7-10 (see pcbaord).

Each individual gate also has an indication, and a jumper.

These jumpers , set to left(= inverse) OR right(= NOT inverse) give the option to select a active 0 or active 1 at the output.

The GCA50 like many other units prefer active 0, but the opposite is possible.

Also the choice of IR -obstruction or -reflection will need the jumpers.


* Easy single sided PCBoard, easy to build

* Only cheap parts used.

* Useable to a wide variety of distances.

* Simple adjustments to match sensitivity.

* Output capable of driving small relay like Omron GV5-1.

* Low power consumption.

* 4 ports on one board

Adjustments and setup

The output power of each IRled can be adjusted, to meet the required output power.

For many waggons, it might be necessary to fix a reflecting surface (best choice some metal)on the bottom of it.

Infra red is usually not very well (or not at all !) reflected by plastic materials.

Closed waggons can have a little metal plate fixed inside.

Some tests with the used trains and waggons need to be done, to get a satisfying result.

To connect sensor outputs to MGV50 input pins, there are two options for each sensor.

Small bridge wires have to be made on the board to connect the right input.

See table on pcboard parts placement.

The standard program has an internal delay of approx 100 mSec foe each switch.

This is done to make the sensor really insensitive for small errors in light obstructions (insects , etc).

A faster program is also available, see below.

Schematics, Layout and hardware list

Connection drawing contains important explanation how to connect sensors and IR leds.

The firmware

The used compiler is a very simple Basic compiler from

For fast counting (max +/- 50 Hz) the following program will do

mgv133-en.txt · Last modified: 2018/11/12 08:56 (external edit)