by Nicholas Robinson
This driver allows a JR (Japan Remote Control Co., Ltd.), Spektrum (Horizon Hobby, Inc.) or Futaba (Hobbico, Inc.) radio transmitter to communicate with a PC (Windows / OS X / Linux) and vice versa. It is written in ANSI C, leveraging the excellent PortAudio (Portable Cross-Platform Audio) I/O library, and facilitates one-way communication from the radio transmitter to the PC (or from PC to radio transmitter) via any available audio input/output device (headphone, microphone, line-in etc) and the transmitter's trainer port. It is capable of receiving PPM signals generated by a radio transmitter and simultaneously generating and sending its own PPM signals without a USB dongle.
The applications of this driver are threefold:
- Receive and decode PPM signals from a radio transmitter
- Encode and transmit PPM signals to a radio transmitter
- Receive and decode PPM signals from a radio transmitter, augment and re-transmit PPM signals to another radio transmitter
The first two applications are self explanatory (and likely the most useful), providing the possibility to use a radio transmitter as an input device on a PC (potentially for controlling a flight simulator) and conversely using other input mechanisms (GUI, gamepad, mouse, keyboard) to control a remote-control vehicle via a radio transmitter. The third application accommodates more creative applications - for example this driver could form part of a data logger between a student and teacher, logging all student commands for later analysis, whilst still permitting buddy box flight instruction. It could also allow for hybrid manual/computer control of a remote control vehicle, where primary control inputs are augmented by a computer program before being sent to the remote control vehicle.
- Make
- cc/gcc
- PortAudio
- JR / Spektrum / Futaba Radio Transmitter with Trainer Port
- Trainer Cable
- Sound card with headphone / microphone / line-in
$ git clone git://github.com/nicholasrobinson/BuddyBox-PPM.git
$ cd BuddyBox-PPM
$ make clean && make
$ ./BuddyBox-PPM [SAMPLE_RATE]
Initializing Buddy Box...
(Plug in your transmitter cable: Tx first, line-in / microphone-in second)
0.174167 ,0.503333 ,0.503333 ,0.503333 ,0.840000 ,0.369167 ,0.671667 ,0.503333 ,0.840000
0.174167 ,0.503333 ,0.503333 ,0.503333 ,0.840000 ,0.369167 ,0.671667 ,0.503333 ,0.840000
0.174167 ,0.503333 ,0.503333 ,0.503333 ,0.840000 ,0.375833 ,0.671667 ,0.510000 ,0.840000
0.167500 ,0.510000 ,0.510000 ,0.503333 ,0.833333 ,0.375833 ,0.678333 ,0.510000 ,0.840000
0.167500 ,0.510000 ,0.510000 ,0.510000 ,0.840000 ,0.375833 ,0.671667 ,0.503333 ,0.840000
0.167500 ,0.503333 ,0.503333 ,0.510000 ,0.840000 ,0.369167 ,0.671667 ,0.503333 ,0.840000
(ctrl-c pressed)
Program Halted...
The above output indicates the raw output of 9 channels from my JR PCM9xII Tx, represented by the first 9 columns.
- http://www.portaudio.com/
- http://spektrumrc.com/
- http://www.jrpropo.co.jp/
- http://www.futaba-rc.com/
- You may need to change the default input device via your operating system's control panel to suit your audio input device.
- You may need to tune "DEFAULT_SAMPLE_RATE" via command-line to suit your audio input device (defaults to 124kHz if not specified). A higher sample rate will yield a higher resolution on each channel's output. For example 44.1kHz sample rate -> resolution of ~36 per channel, whereas 192kHz sample rate -> resolution of ~154 per channel.
- Depending on your sound card's characteristics, you may need to tweak "BAD_PACKET_THRESHOLD" and "SAMPLE_NOISE_THRESHOLD" in "BuddyBox.h"
Please let me know if you find this useful or come up with any novel implementations.
Enjoy!
Nicholas Robinson