IR Train Lap Counter / Timer

Revised 12-17-14

The objective of this project is to design, construct and program a controller that will count the number of times that a train passes an infrared sensor.  The sensor uses reflective IR to detect objects.

 

 

Schematic:

 

Sensor

The sensor should be placed beside the track with the wires away from the train.  The sensitivity of the sensor can be adjusted with the small screw that is circled in yellow in this photo.  There is an adjustment screw, circled in yellow, that can be used to adjust the sensitivity of the unit.  Turning the screw  counterclockwise makes it less sensitive and turning it clockwise makes it more sensitive.  For most of our uses the screw should be turned five or ten times clockwise.  Note that there is no stop when you turn the screw to either extreme.  Just turn it clockwise enough to get maximum sensitivity.  You may be able to hear a faint clicking sound when you reach the maximum extreme. 

The red LED (circled in red) lights when the sensor is active.

 
The contrast on the display can be adjusted with the potentiometer shown hear circled in yellow.

The pause time that determines when a train has passed is shown here circled in yellow.  Its setting can be seen whenever a train passes and the flashing word "TRAIN" is replaced by a count from 1 to some maximum is seen.  This pot adjusts this maximum.  For most uses a setting of 10 to 20 is good.  For very slow moving trains it can be increased.

Here you can see the count going between 22 and 23 under the word STATUS