Search This Blog

Tuesday, May 4, 2010

System override

Unlike some other domains, with robot software bugs can have expensive outcomes. In order to avoid unpleasant mishaps, I have decided to implement a hardware solution for preventing software originated problems that could cause a calm, boring robot to become a runaway beast hitting hard against walls, people, animals and anything that is in its way. To achieve this I have built a PWM control source multiplexer:



This board enables the user to select through an RC radio channel, the source of control. Up to 4 servo channels can be multiplexed, from 2 different control origins. In my setup, I can select if the input of 4 channels should come from the 41 MHz RC receiver, or from the MuIn (PIC18F2520) board.



In case the robot starts doing something that is not correct, the user can immediately toggle the source of control, and prevent a crash from occurring.

The solution simply consists of a salvaged servo control circuit, and two TTL 74 series IC's.



One is a 74LS157, which is a 4 bit 2 input multiplexer. The second one is a 74LS14, which is an hex inverter, with schmitt trigger inputs. It is intended to help clean the signals from the control pin, in order to avoid intermittent operation. As the TTL multiplexer cannot directly understand the PWM signal from the RC transmitter's channel dedicated to switching the source of control, it is necessary to have a circuit capable of getting the PWM signal and output 0 or 5 volts, depending on the length of the input signal. As I had (mechanically) broken servos, I took advantage of the control circuit of one, for doing this translation. In order to ensure a steady output (the output signal is a waveform between DC and a pulse width modulated signal that powers the motor) I have added a 22uF capacitor, sufficient to smooth out the signal. The schmitt trigger gates help to provide a clean signal to the multiplexer.

Sunday, May 2, 2010

Almost autonomous

With all the hardware prepared (except the quadrature encoder on the wheels, which is still to be implemented and installed), all conditions were met in order to be able to write some code and make the car finally move on its own.

I have first added the sonar module (the previously mentioned SRF02). This implied making a small aluminium support to fixate the sonar to the servo, while still being able to slightly adjust the tilt:



After installing it, made a quick check and read the ranging data directly through the MuIn original Windows application:



Every thing was fine. It was time to add more code to the MuIn PIC, implenting useful functions for the robot. A singe command returning both range data and the servo position would be useful, so I implemented it. It essentially consists of the following structure:


'@''F''S'I2C addrservo nr00'#'


Each element is 8 bytes long. The PIC responds with the following answer format:

'@''F''S'I2C addrservo nrRange HBRange LBServo HBServo LB'#'Checksum


This allows a measurement to be taken, while the servo is sweeping.

A small video of the car in action: