Raspberry Pi RC Transmitter Introduction

Advertisements

I have decided to have a go at making my own RC transmitter. There are a couple of reasons why. My kids have asked me several times if they can use their Xbox controller to control their robots. The reason they ask this is because they are used to the feel of the Xbox controller and the traditional RC aircraft transmitters are typically quite large and awkward to hold even for my big hands. Another reason why I wanted to make my own transmitter is because I really wanted to be able to program my own mixes and preset settings.

When I say that I am making my own “transmitter” I am only referring to the micro-controller in the transmitter and not the actual radio transmitter itself. That is a lot more work than I am willing to do. So I am going to use a off the shelf RC transmitter module and program a controller to output a signal to the transmitter module. My RC protocol of choice is FrSky ACCST as it is reliable, fast and the parts are cheap and easy to source. The transmitter module I am using for this project is the FrSky DHT 8ch DIY Telemetry Transmitter Module.

I needed some way of interfacing an Xbox (or other USB) controller to the transmitter module. So I need a board that acts as a USB host and can take commands from a USB game controller and output the PPM stream for the transmitter module. A PPM signal is widely used in the model RC industry and is a standard input for transmitter modules. A PPM stream is basically a series of 8 1-2ms pulses where each pulse represents 1 channel and the width of the pulse is the value. More info on PPM here.

I started having a look around the internet to see what other people have done to accomplish what I wanted to do. I was surprised that there is not a lot out there. I found a couple of projects that consist of a PC app that interfaces with a transmitter over an audio jack. Another used an Arduino interface between the PC and transmitter module. Another used an Android phone instead of the PC but still had an external interface board. There was finally one that consisted solely of an Arduino board. The difficulty of the problem is that a PC does not have a IO port to output a PPM signal and an Arduino board doesn’t have a USB host to connect to the game controller. But I don’t want to walk up to a robot arena with a robot, Xbox controller, laptop and other PCBs and several meters of wiring. The obvious answer is a Raspberry Pi computer which has the USB host and GPIO pins for connecting custom peripherals so can be all mounted in a tight little package.

So I had a look around for Raspberry Pi based RC controllers and have so far found only one on GitHub. The FlyStick project by Jsa does the basics of what I wanted. It is written in Python and uses the PyGame repositories to read the values from the game controller and outputs a PPM signal for the transmitter module. However the project seems to be incomplete. It was written for a Joystick rather than a gamepad and while it has an option to adjust trim on the roll axis there is no trim adjustment for the other axis. There is also a lot of code to output current channel values to a scrolling LED display called a Scroll pHAT which I don’t like the look of.

So I have decided to teach myself some Python and have a go at writing my own program. And when I say “write my own” program I really mean cut-and-paste other people’s programs into my own and then try and work our why it doesn’t work. That can be found on the next page.

Leave a Reply