This page presents information on infrared - Above The Track and Across The Track train position detection circuits. The circuits are designed around the LM339 quad comparator chip and can use a wide assortment of matched infrared - emitter / detector pairs.
The circuit bellow is the basic voltage comparator based detector circuit using the LM339 Quad or LM393 Dual comparator ICs.
The LED will turn on when the infrared beam is broken. The value of the resistor R1 determines the sensitivity of the phototransistor Q1. In most cases a value of 1 Meg or 470K ohm with good results but every situation is different and some experimentation might be needed.
Circuit Operation - When a train breaks the infrared beam the phototransistor will conduct less current. The voltage at the MINUS input of the comparator will rise above the reference voltage at the PLUS as determined by R3 and R4. The output of the comparator to turn ON and the LED will be lit.
The method shown below has been tested with sensor gaps as wide as 12 inches but a distance of 8 inches or less is more practical.
There is also a method that can be used for longer range across track detection that could be used for yard throats. A detector circuit of this type is in use at the London Model Railroad Group's club layout and spans seven "O" Scale tracks using one infrared LED and a lensed phototransistor.
For general information about Voltage Comparators please see the Voltage Comparator Information page at this site.
Good alignment of the emitter and detector is important for good operation, especially if the gap is large. This can be done with a piece of string stretched between and in line with LED and phototransistor. A length of dowel or stiff wire could be used to set the alignment. Another method that can be used for longer distances is a laser pointer shone through one of the mounting holes.
The next diagram shows two methods of aligning the emitter and detector mountings. For best results the height of the "beam" should be at coupler height and at an angle across the tracks.
The emitter could also be mounted above the track with the phototransistor placed between the rails in locations such as hidden yards. Placing the emitter and detector at an angle would again be helpful.
Most infrared phototransistors are also sensitive to visible light and therefore will need to be shielded in someway to prevent the device from being swamped by the rooms lighting. This can be done by hiding the phototransistor inside a lineside structure or placing it inside a short piece of opaque tubing as shown below. The back of the phototransistor can be painted black to prevent room light from entering if it is in the open.
The longer the length of tubing the narrower the entrance angle to the phototransistor. The tubing can be clamped in place or mounted through a hole drilled in a small block of wood or plastic.
The emitter does not need to be shielded unless its beam can affect another phototransistor nearby.
The following schematic shows how the LM339 can be used to build a multiple detector unit.
In order to reduce on the total current needed for the circuit the infrared LED's can be wired in series and the value of the series resistor adjusted to supply the needed current. In this way the LED's use the same 17 milliamps instead of needing 17 milliamps each.
The parts values shown on the schematic are guidelines that should work in most situations but may have to be adjusted for your particular needs.
Because these circuits can be affected by room light, achieving good results may require some testing. It may take several tries to get reliable train detection.
There is a wide variety of Infrared LED's and phototransistors available that will work with this circuit. When choosing devices try to select ones with the same wavelength sensitivity (Matched Pairs). Next decide what case style will be needed, small devices are easier to hide but may be more difficult to work with. Some emitters and transistors have the leads placed so that the lens points to the side when the device is mounted vertically. Consult component catalogues for the various case styles.
In the circuits on this page the LED turns on when the infrared beam is broken. The LED can be made to turn OFF when a train is detected if the PLUS and MINUS inputs of the comparator are reversed.
If you want to use this type of detector, do some experimenting with mounting and alignment methods at the work bench first. This will be of great help later when installing the sensors on your layout.
Infrared light is not visible to the naked eye, however, a digital camera can be used to view the IR light if it does not have an IR blocking filter on the lens.
The image may not be very bright but close-up or in a darkened area the light should be visible on the camera's display screen.
For information on Voltage Comparators please see the Voltage Comparator Information page at this site.
This High Impedance Test Voltmeter circuit can also be used for testing phototransistors installations.
Method of mounting LEDs above the track. See lower portion of page.
The explanations for the circuits on these pages cannot hope to cover every situation on every layout. For this reason be prepared to do some experimenting to get the results you want. This is especially true of circuits such as the "Across Track Infrared Detection" circuits and any other circuit that relies on other than direct electronic inputs, such as switches.
If you use any of these circuit ideas, ask your parts supplier for a copy of the manufacturers data sheets for any components that you have not used before. These sheets contain a wealth of data and circuit design information that no electronic or print article could approach and will save time and perhaps damage to the components themselves. These data sheets can often be found on the web site of the device manufacturers.
Although the circuits are functional the pages are not meant to be full descriptions of each circuit but rather as guides for adapting them for use by others. If you have any questions or comments please send them to the email address on the Circuit Index page.
18 May, 2012