Knowing where Trains are
There are a number of IR detectors available commercially specifically intended to indicate when a train passes them. With the number that we wanted this would have been quite an expemsive solution. So we tried our own method using tiny “Hall probes” that are easily small enough to fit between the sleepers and are cheap.
Each probe was connected to a separate digital input on an Arduino mega – which has lots of input pins. The main controller an then talk to this Arduino to knows when a train passes over a Hall probe. Also which Hall probe it is.
To make the Hall probes work a very tiny magnet is attached to the underside of the train. It is small enough not to interfere with the way the train works.
We made a number of probes each of which looks like the image below on the left. The Hall probe signal is analog and it is much much easier to process if it is converted to a digital signal. This was done with comparators which create a digital output when the analog voltage from the probe exceeds a certain value. Each comparators can handle four inputs and the circuit board to do this is shown on the right.
We wanted more than four probes, so four such interfaces were created and mounted as shown below. This gives a total possible of 16 Hall probes. They are connected via this interface to 16 digital inputs on the Arduino. These in turn fee data to the main controller.
Knowing where trains are can be used to pre-set points and allow the creation of pre-determined routes and tours.
Before all this was done we did a small test by fitting two Hall probes to our test track to see if they correctly fed back information when the train passed over. They are just visible in the video below. Can you spot them?