Anyone who has played around with Remote Control (RC) toys is familiar with the concept of wireless servo control. A hand held transmitter broadcasts the positions of a couple of thumb joysticks and some switches to a receiver which tells some small motors (servos) what position to move to. These commercially available RC systems are perfectly well suited to controlling everything from small toys right up to massive scale models. Unfortunately, for a lot of robotics projects they are not ideal. Here are a few reasons why:
- Data transmission is usually one way, meaning you can't get any data back from your vehicle. Modern systems do offer limited telemetry capability but it is far from perfect.
- Only a small number of servos can be controlled. 12 channel systems are available but are fairly costly.
- Almost all systems work on the 2.4GHz band. Using Wifi at the same time (for example, to stream video), can cause catastrophic interference.
- The transmitter is a human interface device, sending commands from a computer requires 3rd party hardware/software which doesn't always work reliably.
The OpenLRS project goes some way to solve these issues. It replaces the radio unit inside a conventional RC transmitter and shifts the frequency to 433MHz (which can be nudged to 459MHz in the UK). This is primarily to increase the range of the system (lower frequencies go further for the same power), but it has the added advantage of removing the interference potential with Wifi. OpenLRS is also based on an Arduino core and features bidirectional transceivers, so it can be reprogrammed to offer telemetry and a serial port interface to a computer.
After using OpenLRS for a while to control a small Unmanned Aircraft System (UAS), a thought occurred to me. Most of our UAS operation requires a computer on both ends of the link, wouldn't it be nice if this computer could handle the communication itself, rather than having to connect to OpenLRS?
Those of you with some experience in wireless telemetry may ask what is wrong with ZigBee systems such as XBee. Being based in the UK means means only the 2.4GHz XBee's are any use (900MHz isn't allowed), so whilst they solve most of the problems the interference issue still exists.
Taking inspiration from OpenLRS, I got hold of a pair of HopeRF RFM22B radio modules and hooked them up to a pair of BeagleBone Blacks (BBBs) via SPI. After a couple of weeks of coding and tweaking I have successfully achieved wireless servo control, here's a (poorly filmed) video to prove it
(The USB cables connected to the BBBs are just so I can control them from the PC, no servo control signals are sent down these I promise! And I've no idea why the audio and video are out of sync)
Over the next few days I'll be posting the details of this project, but here's the highlights. The potentiometer from an old (broken) servo is used to drive one of the BBBs ADCs. This ADC voltage is read by the first BBB and transmitted from one RFM22B to the other. The second BBB receives the voltage and commands the servos appropriately. The PWM signals for servo control are achieved with the BBBs Programmable Realtime Units (PRUs) so as to obtain 8 high resolution channels.
Part 2 of this guide covers hooking up the RFM22Bs to the BBBs and sending a basic "Hello World!" message.