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.