I want to use analog RC control to do stuff wirelessly with an Arduino
My method up until now for controlling penguins that flap their wings and tell jokes, rude Bender robots, and the Tin Man has been to use WiFi. This works but I thought I would try something different. I'm not breaking new ground here but thought I'd document what I'm doing anyway.
Why RC Control?
One of my complaints with the animatronics I've made has been the wonky eye movement. The main issues are mechanical and I had a look at how RC model control is done as it requires some degree of precision. That is a separate issue but it got me interested in RC transmitters and receivers. They are relatively inexpensive (the T8S-BT I'm using cost ~$50), have long range, and are simple to set up. But they aren't digital and the inexpensive models are one-directional.
RadioLink T8S(BT) Transmitter
This is an 8-channel transmitter in the shape of a gamepad with left and right 2-axis joysticks. There are also two 3-way switches, a button switch, and a continuously variable wheel. The eight buttons on top with arrowheads (< and >) are used to trim servos attached to the joystick channels. It has an internal LiPo battery and charger for power.
The primary radio operates at 2.4GHz on the ISM band with GFSK modulation but only works with RadioLink receivers. The advertising says it works up to 2000 meters line of sight. There is also a BLE radio that can connect to a phone, tablet, or PC and be used to refine settings and save them for future use. The BLE App is available for iOS, Android, and PCs.
It occurred to me that it might be possible to modify the transmitter to transmit digital information so I took it apart. The case comes apart easily with 6 self-tappers into the plastic case holding it together.
There isn't much inside. The joysticks, switches, and knobs are all connected neatly to the main PCB along with the battery. The BLE radio and antenna are on a separate PCB to the left in the photograph. The transmitter blob has its PCB attached to the main PCB center-middle with an antenna hanging off below it. It is nice and tidy with a fair amount of room inside of the right handle. As will be seen shortly though I don't think adding digital logic on the transmitter side is a good idea.
RadioLink R8EF Receiver
The receiver has eight channels and came packaged with the transmitter. The operating voltage is 4.8V to 10V DC. In addition to PWM operation, it is capable of SBUS and PPM protocols which allow servos to be with a single wire. I'm only interested in PWM which is brought out on 8 sets of pins with the standard signal, positive, and negative arrangement for a servo.
As a first step, the output from the receiver was looked at with an oscilloscope. We expect pulses around 50Hz with a duration between 1 and 2 milliseconds with 1.5 milliseconds being centered for the joysticks.
We get pulses at 55Hz with close to the expected duration. The video starts with one axis of the joystick displayed on the oscilloscope and then the second added. By playing with it a bit I found that it was possible to manually control the output and get perhaps 7-bit resolution. The output is not linear and has offset.
Of interest, even though the receiver is being powered with 5V, the output is 3V3 which means it is safe with 3V3 microcontrollers. This might not be the case will all receivers and should be checked. In any event, a 5V Arduino Uno will be used in the next experiment.
Why isn't transmitting digital with this radio a good idea?
One of my original thoughts was to modulate output on one of the channels of the transmitter with a microcontroller by pulsing one of the buttons. While possible, it isn't practically useful because the pulses are only occurring at 55 Hz. It is possible to get faster although perhaps not a practically higher resolution by reading the analog signal as it comes out of the receiver.
Inserting an Arduino in the loop
It might not be immediately obvious why an Arduino might be inserted. Why not just send the receiver output to the servo? Reasons might include "massaging" the output remove or adding an offset, removing or adding non-linearity, adding a filter to the output, and so on. For animatronics, vocals might be attached to the buttons or even to the joystick.
It is easy enough to intercept the pulses and read their duration with a microcontroller. It turns out of course that there is an Arduino library (ServoInput) for that. I'll be using one of the examples and examining the output with the Serial monitor on my computer.
It would be easy to interpret the input from a spare joystick and get 9 digital readings - top left, top center, top right, middle left, and so on. The library works with interrupts and isn't blocking so at 50 Hz the microcontroller has plenty of time to do other stuff. The buttons and switches are also available to an Arduino.
Conclusion
I'm not sure I'll be using this with my animatronics but it is worth trying if not too many vocalizations are required. Thanks for reading. Comments and suggestions are always welcome.