This Embedded System is designed to control the train junction Gates automatically when train passes across this junction. Here we arrange two IR sensors before the junction ( distance > 500mtrs from Gate junction) and also two IR sensors after the junction (distance > 500mtrs from Gate junction). The IR sensors which are before the junction will indicate that the train is coming near to the junction and the IR sensors which are after the junction will indicate that the train has passed away the junction.
The pictorial arrangement of the system is shown here
when train comes in between the 2 IR sensors the output of both the photodetectors will become logic - '1'. Then the system will send logic high to the Siren, Red light will glow , green light will turn off and the Gate will close.
Here is the simple flow chart showing its operation
Case'1': When train is coming near to the junction
Case '2': When train passed away the junction
NOTE:
Here we connected single servo motor b'coz it is a prototype. but in real time we will use two servo motors, and also here the Siren is replaced by Yellow color LED and IR sensors are replaced by optocouplers.