Schalte Sprache zu: German
Arduino PWM Remote Control
There is also a video on YouTube for this article: Arduino PulseIn - How to read and evaluate analog PWM signals from an RC remote control (German)
Most remote controllers for drones, boats or airplanes work with analog PWM signals. There are also digital transmissions like PCM that already supported by many remote controllers. PWM is still used very often. With an Arduino board these signals can be read in via digital inputs. This makes it possible that the Arduino board can also be used in model making as a central control unit. In our example, we read three PWM signals from a remote control. For the Arduino board, it is no problem to read several PWM signals in succession on different pins.
Receiver and Arduino
Most receivers work with 5 volts. This has the advantage that the receiver can be powered directly from the Arduino. In addition to the two lines for the power supply still another line for the PWM signal is required. One cable must be connected per channel. The Arduino can only generate PWM signals on certain digital pins, but it can read the signals on all pins.
The PWM (Pulse Width Modulation) signal is just under 1000 at the lowest value and just under 2000 at the highest value. A mathematical formula could be used to convert the value into a percentage value, for example, to control the speed of an engine from 0-100%. The following graphic from the Serial Plotter shows how a controller is moved from bottom to top on the remote control and then positioned in the middle.
The code sample is very simple and works like the analog inputs. First, the I/O pins and their function must be defined. The PWM signal is then read in via PulseIn and displayed in the Serial Monitor. The PWM signal is always read in the code at certain times. If it is necessary to detect a change in the signal at any time, you can also work with interrupts that can not be blocked by a delay or other operation. The following screenshot shows the output of three PWM channels in Serial Monitor.