Sometimes there is a need instead of manually control a normal proportional channel in the transmitter via a joystick,
slider or rotary potentiometer, but to automate this with a microprocessor. One might want to automate a process such as a door sequencer for the orderly opening of landing gear
doors and extension of a retractable landing gear, etc. Or one would like to use alternative input devices such as voice control, motion and acceleration sensors, ultrasonic sensors, etc., which
will then control the servo provide by the receiver accordingly.
The following two videos illustrate both. In Demo1, the Arduino simply sends an arbitrarily programmed sequence of control commands to the transmitter's input channel. A test connected servo on the receiver follows these commands.
In the second demo, the Arduino uses an ultrasonic sensor to determine the distance to the next obstacle and adjusts the transmitter's input channel in proportion to that value.
The implementation is basically very simple. You simply replace the classic input
device (potentiometer, joystick ...) with a digital-to-analog converter (DAC) that can be controlled by the Arduino. In my examples here I use an MCP4725 on a small breakout board.
The Arduino communicates with this DAC via the I²C interface, which consists of only two physical lines. The operating voltage for the DAC can be 2.7 to 5.5 volts and comes directly from the port of the transmitter.
The prerequisite for this, of course, is that the potentiometers in the transmitter are operated with a voltage in this range. At least with computer transmitters this should always be the case, since the processors run usually with 3.3 or 5 volts. On the output of the DAC, a voltage is output, which can be linearly controlled by the Arduino from 0 volts to the full operating voltage. This corresponds exactly to the wiper of a linear pot.
The MCP4725 is a 12-bit DAC. This means that the DAC can set the output voltage with a resolution of 4096 steps. For our purposes, this is more than enough.
The picture on the left shows the wiring of the DAC module.
The I²C lines run from SCL to port A5 and from SDA to port A4.
OUT, GND and VCC are connected directly to the transmitter as described above. For this purpose, it is of course necessary to first measure the slot in the transmitter with a measuring device in order to determine the operating voltage and the assignment of the PINs.
To use the DAC
out of an Arduino, you first need a suitable library. I have used the library "MyMCP4725" by
Retian from Austria, which you can download here on his very good homepage. If you want to know more about the DAC
and how to use it, you will find an excellent and very comprehensible written guide on this page.
In the sketch you first have to specify the correct I²C address of the DAC so that it can be communicated with it. The address used depends on the module. My modules use the address 0x60, which can be changed to 0x61 if necessary by a solder bridge.
Since the communication over the I²C bus means a loss of time, you should set the speed of the bus as fast as possible (here 400 KHz).
Further details on the DAC such as writing the EEPROM for changing the default value (50% on delivery) will not be discussed further here.
For setting the output value, it is recommended to use the map command, with the help of which each value range can easily be mapped to the 12-bit resolution of the DAC.
In the download area below, you can download the two demo programs that are working in the videos, which you are welcome to use as a starting point for your own projects.