IR Sensor Project
Revised 05-23-07
|
The objective of this project is to design, construct and program a controller that will activate a relay whenever a train is detected by a reflective IR sensor. The length of time that the relay remains closed can be adjusted from 0 to 20+ seconds. An indicator LED will show when the relay is closed. A jumper can be set to put the unit into a test mode that does not activate the relay. This save wear on the relay when adjusting or aligning the sensor. |
| Schematic: Click on this thumbnail to see the schematic
|
| Program Logic: When the sensor sees reflected IR the control circuit waits to see if there are a number of consecutive "hits" before it confirms a detected train. When that happens the relay is closed and stays closed until the time set by the potentiometer has passed. It the test jumper is closed by shorting its pins the relay is removed from the circuit and the light alone indicates that something has been detected. |
|
Sensor The IR sensor is at the right end of the board. The IR emitter is in the black tube at the right.
Bottom view
|
|
Sensor Mount The sensor can be mounted on standard 1/2" CPVC fittings. Here is one way to mount it. The additional fittings allow the sensor head to be tilted and rotated so that it will only detect a train on a nearby track.
|
|
Control Board The microcontroller is in the lower left. The relay is the white object top center. The delay adjustment potentiometer is the black device to the right of the relay. The sensor unit plugs into the board on the left. The four pins at the bottom of the board are for programming. The blue and white wire at the bottom are for testing.
The test jumper is show installed in this photo. It is the black item just in front of the white relay. Remove it to activate the relay.
The sensor plug must be inserted as in the photo with the orange wire to the right. The heat shrink tape wrap is marked with a silver line as seen below. Please make sure this plug is properly inserted before applying power as inserting it incorrectly can destroy the sensor.
|
|
Relay Connection The DPDT relay contacts are accessed by the two sets of three leads coming from below the board. The brown wire is common. The yellow is normally open and the grey is normally closed.
|
|
Time Delay The potentiometer varies the time that the relay is held in from 0 seconds to 25.5 seconds. If the pot is turned all the way clockwise there is no delay. All the way counter clockwise is 25.5 seconds. The detent in the center is around 12.7 seconds. |
|
Software 'IR sensor system -
5-22-07 |