South Africa
Login / Register

Day / Night Infrared Detection

Day /Night Infrared Detection

The following is a method to allow day and night detection using Infrared/Visible light sensitive phototransistors and a simple LM339 voltage comparator circuit.

A phototransistor is mounted between the rails so that it is covered by the train as it passes. A system widely used in model railroading.

For daytime operation the room lights would be on and when the train blocks this light the train is detected. However when the room lights are dimmed or turned off for night operation, under normal conditions the phototransistor would go dark and act as if it was covered by a train and give a false detection.

To prevent the phototransistor from going dark when the lights are dimmed, mounted above the detector at ceiling height is one or more infrared light emitting diodes.

With the room darkened the phototransistor will see the infrared light and remain in an ‘ON’ or conducting state. As far as the phototransistor is concerned it is always illuminated by visible or infrared light.


Day and Night Detector Schematic

The next diagram shows the relationship between the diameter of the infrared beam and the distance from the emitter for a beam angle of 20 degrees. The farther the detector is from the emitter the light falling on it is proportionally weaker and this is the reason for the use of multiple emitters.

Because the beam of the emitter widens as the distance increases, one emitter group could cover several tracks. For example a double track main or a yard throat would only need one set of emitters for a group of detectors that are close together.


An emitter with a 30 degree beam angle would cover a proportionally wider area but the light intensity would also be lower.

Day and Night Phototransistor Detection Notes

  •   The information provided on this page is very general and if used by others some experimentation will be required to determine the number of emitters required, the best positioning of the phototransistor detectors for a given installation.
  •   Care must be taken when mounting the emitters near a room ceiling so that no potential fire hazards are created, whether by excessive currents or faulty wiring.
  •   For testing, four infrared LED’s connected in series were used for the emitter portion of the circuit. Initial testing showed that with four LED’s an emitter to detector distance of at least seven feet could be achieved. At the shorter distances that would be encountered on most layouts one to three emitters could be used.
  •   The current through the LED’s for the tests was 30 milliamps. The LED’s were wired in series in order keep the total current as low as possible (The four emitters share the same 30 milliamps). This would be important in an installation with numerous emitter groups.
  •   The emitter and detector should be a matched pair for maximum sensitivity. Emitter diodes are commonly available with 20 or 30 degree beam angles and with current ratings up to 50 milliamps. Ask your supplier for for a copy of the component specification sheets for the emitter and detector that you plan to use.
  •   A weighted string line is the simplest method to line up the emitter and detector.
  •   If more than one track is to be protected by phototransistor sensors only one emitter group would be required so long as the beam covers all of the tracks involved. In this case the group would be mounted over the center of the multiple tracks. In the case of a yard the emitters could be placed in a line across the tracks to maximize coverage.
  •   Certain cars such as tank cars may give detection difficulties due to the open nature of their underframes. This will be a problem with just about any above the track visible light detection system.
  •   If the layout room has a finished ceiling it might be difficult to mount and wire the infrared emitter diodes without disturbing the ceiling. Conversely, if the room has valanced lighting it would not be difficult to install them.
  •   It is possible that the emitter LED’s could be disguised by mounting them in a decorative trim. They are low power devices and generate very little heat, approximately 30 milliwatts each at 30 milliamps. The current limiting resistor should be mounted in an area with good air circulation.

Is The IR LED Working?

  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.

Circuit Credit: Rob Paisley

Black and White Premium WordPress Theme