Following the Track

By following an edge it is possible to follow a line using just one analogue sensor, although that technique has its pitfalls. Our sensors are used in digital (ie on/off) mode, so two are necessary.

There is more than one strategy, and the two most obvious ones are to position both sensors over the track or to position them off to either side of the track. In the first case the system must detect when a sensor moves off the track; in the second it will detect when a sensor moves onto the track. Most learners opt for the second, though either can work equally well.

Either event represents an "error" which must be corrected by steering until the condition no longer exists. This is straightforward enough once the steering logic is sorted out, although a certain amount of fun will be had by those who get it wrong and whose buggies, when they deviate from the track, steer off in the wrong direction.

What learners often forget is that even while correcting its course the system must continue to monitor its other sensors. It would be completely unacceptable for a vehicle to run over an old lady, or refuse to stop on command, because it happened to be busy steering at the time.

The picture shows sensors set up either side of the track. Note that the third sensor, for trackside markers, is set well back, behind the other two.