Arduino How To Install An IR Sensor Under Track

How to install an IR sensor under HO And  OO scale track.

This pages presents a solution to problems that occur when you install IR sensors under track.

The problems that you face are:

The 5 mm emitters and sensor LEDs that come with the IR sensors as you buy them do not fit between the rails.

To install a sensor under the track it requires a that you cut a large hole and even then it is difficult to adjust for a proper fit.

When the sensor is under the track, it is difficult to adjust the sensitivity.

The solution starts with removing the 5 mm LEDs from the sensor body and replacing them with 3mm leds soldered to a measured length of telephone wire.

The result is:

you install only the emitter and sensor LEDs under the track.  They fit in small holes between the rails,

the emitters and sensors are connected  by long wires to the sensor body that is mounted at a convenient remote place,

because the sensor body is conveniently located, sensitivity can be adjusted without working under the track.


To better hide the emitters and sensors, sand their tops flat.

Fit each sensor and emitter inside black shrink tube. Extend the tube beyond the sensor face.  This will better hide and focus them.  Adjust sensor sensitivity as necessary.


Sand the tops of the 3mm  emitters and sensors flat.

Solder the 3 mm replacements to telephone wire. Be sure to add shrink tube. I cover each of the legs and then cover those with a larger diameter piece. Extend the larger diameter piece beyond the end of the LED.Be sure to somehow identify the cathode wire for each.

Use something to hold the sensor body firmly, melt the soldered pins and pull the 5mm detectors out.

Use a solder sucker to empty the holes of any remaining solder.

In the holes left in the sensor body after removing the 5 mm versions, solder female mechanical pin headers.

You will mount the sensor body on a control board of some sort.

Cut the telephone wires to the length between detector placement and the control board. (Leave a bit extra to CYA).

Put one end of the wires in a drill, hold the emitters and twist the wire. You now have a spagehtiless wire run.

Normally the cathode wire goes on the center most pin joints.

Adjust wire length as necessary.

Solder the wire ends to female mechanical pin headers. Plug them into the sensor body.

With the sensor body on a control board and the detectors at a distance and under the track, you can easily adjust sensitivity without having to go under the track.

Roll a wagon over the detectors and conveniently adjust sensitivity.


We hope that you found the information in this page useful. The internet is all about getting and giving. And giving back is the best. Please donate $1 or more to aid us in our continuing quest to add to and polish the information in our site.

Scroll to top