This is an old revision of the document!
Published 6 Feb 2018
Arduino controller for Cybot
I have received a discarded Cybot robot which is mostly complete and decided to replace its control chips with an Arduino, which will require writing software to control the motors and receive inputs from the ultrasonic and LDR sensors.
Surprisingly the Cybot was in basic working order, although the front caster wheel was missing. Fortunately the batteries hadn't leaked, and after replacing them it fired up ok. But as an autonomous robot it doesn't perform brilliantly, and could do with a bit more sophistication.
The Cybot was originally built in stages from kitset parts supplied with a magazine. It is built on a three wheeled platform, with two independent driving wheels and one caster wheel to balance the front. There is a 6 volt battery holder for the wheels and a separate 9V battery to drive the electronics. Interface and controller boards are modular and plug together as more features are added. There were a number of stages, developing eventually to a remote controlled beast. But the one I have was just at the end of the first stage, it has two powered wheels with an H-bridge control circuit made of discrete components, two Light Dependant Resistors (LDRs) for detecting light sources, a line following module, and two pairs of ultrasonic transmitter/receivers for detecting its environment.
Using the ultrasonic sensors appears to be the most difficult part. They have a fairly minimal interface, but from 3rd party documentation should produce 40kHz pulses when something reflects the signal, perhaps an interrupt driven routine will be useful. There are a few other projects on the Internet that have made these types of modifications, but all seem to have skipped the ultrasonic sensors, some even add other more sophisticated ultrasonic range finding hardware instead.
There appears to be a requirement for 14 I/O pins from the controller.
The Light I/O board:
Direction | Label | Description |
I | L_F | line follower input |
O | buzzer 1 | buzzer driver output |
O | buzzer 2 | not sure why there are two pins, maybe like the ultrasonics it needs 10V p-p |
I/O | LDR left | light dependent resistor input/discharge |
I/O | LDR right | light dependent resistor input/discharge |
O | LED | antenna LEDs on/off |
O | motor 2a | motor forward/reverse drivers, PWM lines? |
O | motor 2b | can't let both go low together as forms a short circuit |
O | motor 1a | motor forward/reverse drivers, PWM lines? |
O | motor 1b | can't let both go low together as forms a short circuit |
Direction | Label | Description |
O | PZQ1 | outputs to drive ultrasonic transmitters |
O | PZQ2 | drive one high and one low at the same time, gives 10V across transducer |
O | gate 1 | select left/right receivers |
O | gate 2 | |
I | output | received echo signal |
The most difficult controller function to replace appears to me to be the ultrasonic sensors. The hardware is fairly minimal and a lot of the work has to be done in software.
The Arduino has to generate the 40kHz, 10V p-p, driving signal for the two transmitters, then check for a received echo on the right and left receivers. The echo signal should provide range information as well as just presence/absence of obstructions. The sensors face forward on an angle so don't actually tell you whether the detected object is forward or to the sides of the Cybot. If an object is directly ahead, and flat, both sensors should receive an equal signal that decreases in distance as the Cybot advances, but two converging walls on either side would produce a similar result.
I decided that the software echo detector should be interrupt driven, so that the Cybot can continue to maneuver etc, and have the sensors update independently. The output of the Cybot sonar board is a negative going pulse for each echo received. Looking at an oscilloscope I see many more echo pulses than wave cycles transmitted, I expect that the Cybot's pings are bouncing back and forth between the Cybot and the target, generating multiple echoes. The transmitter produces a broad pulse, so there are also multiple echoes from different direction and distances so there are groups of echoes returned. Difficult to interpret all the echoes, so we'll ignore all but the first pulse seen after sending our ping - that will give us the distance to the nearest object.
On the left is one of the sonar driver outputs (top trace) with the multiple echoes (bottom trace). On the right, on a longer time base, is again the sonar pulse (top trace), and multiple groups of echo from different objects (bottom trace)
Tested by connecting the Arduino directly to the sonar board, supplying power to the Arduino and Sonar board via the USB connector.
Arduino Pin | Direction | Cybot Sonar Pin | Description |
2 | I | 4 output | received echo signal, to generate an interrupt |
4 | I/O | 3 gate-1 | select left/right receivers |
5 | I/O | 2 gate-2 | disable by pulling low, enable by letting float (switch to input mode) |
6 | O | 6 PZQ1 | outputs to drive ultrasonic transmitters |
7 | O | 5 PZQ2 | drive one high and one low at the same time, gives 10V across transducer |
+5V | - | 11 +5V | power |
GND | - | 13 GND | ground |
This is a stand alone piece of code to test drive the sonar, it expects an ANSI serial terminal program is present to display the results. Cybot-sonar-test.ino, sketch to test drive the Cybots sonar board.
Library
.
If any referenced page no longer exists, try looking for its URL on http://archive.org.