Interfacing with a "buddy box"
Commercially available joysticks like the Logitech Wingman tend to have non-linear responses, large dead-bands, and poor repeatability. These problems make them very difficult for use with precision controls, such as we require for controlling the helicopter. Luckily, most radios include a "buddy box" or training port that outputs the control positions.
Electrically interfacing with this is quite simple. Eriq Jaakkola has details on building a Futaba <--> TTL converter with pinouts for the training port. We use the transistor driver circuit, but don't connect it to the parallel port of our computer. Decoding the pulses is a real-time intensive activity, so we offload that to an embedded microcontroller.
The output is either PPM or PCM, depending on how the radio is configured. Decoding PCM is much more difficult, so we use the PPM format. Risto Koiva has written very informative details on the waveforms of the two formats. These were invaluable in decoding the signals without an oscilliscope to help visualize the format. The image on the left is an example of a PPM waveform from Risto's site.
wait_for_sync_pulse(); while( get_pulse() != sync_pulse ) push pulse_width; print pulse_widths;
According to Risto Koiva's details, the sync pulse is 10ms or longer. The data pulses are similar to the actual servo encoding format, which specifies the servo position as a PWM signal. Since the data pulses are a maximum of 2 ms, this makes detecting the sync pulse fairly easy.
Currently, the system provides an interface similar to our sim/joystick.c Linux kernel interface. The source code for mapping the output of our onboard program to 'struct js_event' values is in sim/trainer.c.
The IMU board is overkill for this small application. We plan to design
and build a smaller AVR based board that will provide the same interface
to the trainer port. This stand-alone board will be useful for both
data collection flights and flying in the simulator. A preliminary
version for the ATtiny12 written in assembly is in
and the software UART is in