Sonar I/O Board

The Sonar I/O board is used to connect the ultrasonic sensors to the microprocessor on the Processor 2 board. Ultrasonic receivers give a very low output, and require amplification and filtering to be of any use, this is done in a fairly crude manner, using just a single transistor amplifier for each side (Q1 & Q2), with barely any filtering - just a 120pF capacitor (C2 & C7) to provide a little HF 'roll off'. The chip used on the board is an LM393, a 'Dual Differential Comparator', and the two outputs (left and right sides) are summed together with a common pull-up resistor (R6), and fed to the processor. The transmit transducers are both connected in parallel, and fed from two output pins on Processor 2, this are fed in a bridged configuration to give 10v p-p across the transducers from the 5v supply (the piezo speaker is fed in an identical fashion). In order to check each side individually, the comparators are gated by the processor, fed in via pins 2 & 3, by selecting each side in turn Cybot can detect obstacles to the left, right, or directly ahead, and take action accordingly. The sensitivity of the sensor system is adjustable with VR-L and VR-R, giving independent adjustments for each side. The sonar system won't work until both pairs of transducers are fitted, but as they come in matched transmit and receive pairs, you can use the sensors from a second copy of issue 15, rather than wait for issue 16 to come out - as I have two subscriptions, it will be fully working as soon as the other one arrives!.

I've been studying how it actually works, as it's a little obscure!. A comparator works by comparing the voltage on the two inputs, if the +ve input is more positive than the -ve input, the output will be high, but if the +ve input is more negative than the -ve input the output will be low. Now the Q1 & Q2 amplifier stages are the crudest possible transistor configuration, the gain of the stage is highly dependent on the actual gain of the transistor, and the collector voltage will also vary with it's gain. So taking the left hand channel as an example - without any input to the amplifier the collector of Q2 will be a steady DC voltage (around 2v on my particular board), and this is fed directly to the +ve input of the comparator. This same voltage on the collector is also fed through VR-L and R8 to the -ve input of the comparator, but R9 down to ground makes this network function as a potential divider (reducing the voltage), so the voltage on the -ve input is slightly lower than the +ve input, and the output is high - this is the 'no obstacle state'. When an echo is received back, an amplified version of the signal appears on the collector of Q2, and this is fed to the +ve input as before (which now goes both higher and lower than before, as the AC signal is super-imposed on the original DC voltage). However, the -ve input is fed through the resistor network, and has C8 down to ground, this makes a low-pass filter, removing all the signal, maintaining the same DC voltage as before - so, if the received signal on the +ve input should go lower than the voltage on the -ve input the comparator output will go low, and the output of the comparator is a series of 40KHz negative going pulses. By adjusting VR-L you vary the voltage difference between the +ve and -ve inputs, and make it more or less sensitive. This somewhat complicated design overcomes the problems from the crude amplifiers, and makes it pretty well self adjusting, as it will automatically compensate for gain variations in the amplifier transistors. To select the right or left hand channels, the -ve inputs are shorted to ground via an open-collector output from the processor, once it's down at 0v the +ve input can't possibly go lower than that and that channel is disabled.

Mode SW1 SW2 SW3 SW4
Fast light seek Up Up Up Up
Slow light seek Down Up Up Up
Fast avoid objects Up Down Up Up
Slow avoid objects Down Down Up Up
No response Up Up Down Up
Line follow Down Up Down Up
Follow objects Up Down Down Up
Line follow Down Down Down Up
The other function of the Sonar I/O board is to contain the 'mode switch', this is a simple DIP switch which feeds back through this board to the Processor 2 board, inputting on pins 1, 2, 17, and 18 of the processor (all of port P5), they are active low, and pulled high by 4 x 47K resistors on the Processor 2 board, this allows you to set the operating mode of Cybot to a maximum of 16 possible values (although only 7 seem to be used). I've redrawn the mode table from the Processor 2 page, showing the actual switch positions, rather than the binary values as before - looking from the rear SW1 is the left hand switch, and they are labeled just below the levers.

The ultrasonic transducers plug into four sockets on the Sonar I/O, two transmitters and two receivers, basically these are like tiny loudspeakers and microphones, but working above the range of human hearing. They also are designed to work at one specific frequency (called the resonant frequency), around 40KHz, and for this reason they usually come in matched pairs - the Cybot ones are supplied as transmitter/receiver pairs, so for this reason, and shouldn't be split from their pairs. Sonar  works very simply, you transmit a burst of audio from the transmitter, wait a short while, then start looking for an echo picked up by the receiver. The time taken for the echo to return is a direct measure of how far away the detected object is, sound travels just over 1100 feet per second (at sea level), so an object one foot away will take about 2mS (1mS each way) for the echo to return. The reason for the short delay after sending the pulse is to allow the receiver to settle down, as the transmitter is very close to the receiver it will be swamped with directly received signal during the transmitter pulse. Cybot uses two pairs of transducers, one pair on each side, so it can detect obstacles to left, right, or in front - the sensors are carefully mounted to optimise it's detection pattern.

Cybot graphics used by kind permission of Eaglemoss
Last Updated 18/02/02 You can reach me by email at: nigelg@lpilsley.co.uk