Train Detection
A means of train detection is required detect trains entering and leaving a track section. This means of train detection is only for simulation purposes of this model. In a real life application the train detection would be done using the effect of electromagnetic induction. A transmitted coil is placed on one side of the rail and a receiver coil is placed on the other side of the rail. The transmitter coil is supplied with a oscillating voltage which induces a voltage in the receiver coil. As the wheel passes over the detector it induces a high voltage in the receiver coil by increasing the electromagnet field strength.
For this model a train detection system is required to simulate the real-world electromagnetic train detection system. The following methods of train detection are considered:
Optical train detection
Hall effect train detection
Mechanical train detection
Each of these methods will be discussed.
Optical Train Detection
The principle of optical train detection is that the train is used to cut an optical beam of light in the infra-red region. The optical detector will switch its output voltage level when the beam is cut. It is required that each wheel of the train is counted and so needs to be detected. An infra-red diode can placed on one side of the rail and an infra-red transistor placed on the other side of the rail. As the wheels pass the detector, the beam is broken and the transistor switches off.

Figure 1
Figure 1 above shows that circuit design of how a opto-switch detector could be implemented. The photo diode is supplied with current. The infra-red light that it produces switches on the photo-transistor. The output is then given as high. If the beam is broken, the photo-transistor will be off and the output is low. The output is feed into a microcontroller to cause it to interrupt when the beam is broken. Correct biasing of the resistors is required to switch the output between the threshold levels of the microcontroller.
Hall Effect Detection
The hall effect occurs when in the presence of a magnetic field, when a current is passed through a conductor, a hall voltage in generated perpendicular to the current and a magnetic field. A hall switch will switch its output low in the presence of a magnetic field below the threshold field, Bop. When the magnetic field increases to above Bop the output is switched to high.
This type of device could be used to detect trains. A magnet can be fixed to the train at various points. As this train passes the hall effect switch the it will cause the output to switch. This output can be linked a microcontroller and cause it to interrupt and count the train.
Mechanical Detection
A mechanical switch can be used to detect wheels. A possible implementation could be to place a push button switch in a gap in the rail. As the wheel passes over the switch the output will be switched and cause the microcontroller to interrupt and count the wheels.
A mechanical system is not a suitable option since it will disrupt the trains propagation and the reliability of a mechanical switch is not as good as a non-contact switch. The mechanical switch will be subject to physical wear.
The switch chosen to implement the model is a set of opto-switches.