D. OPTICAL SENSOR
Slotted couplers or optical sensors consist of an infrared emitting diode facing a photodetector in a molded plastic housing. A slot in the housing between the emitter and the detector provides a means of interrupting the signal.
The above figure shows how the LED light falls on the photodiode.
Referring to the above circuit diagram, when the LED light falls on the photodetector,it gets a base curreent and becomes ON and we get 5 volts i.e. logic 1 as output. As stated earlier our train has been provided with two obstracles both at front and back of the train. When these obstracles comes in between the LED and photodetector of the optical sensor,they interrupt the photo signal and as a result we get a output of 0 volts i.e. logic 0.
The logic outputs from the optical sensor are given as input to the microcontroller. The microcontroller in turn produces the set and reset signals for the posts.
Total 8 number of optical sensors are attached in our system which provide set and reset signals to 4 number of posts respectively.