PPM Controlled Arduino

by AllenP373 in Circuits > Arduino

762 Views, 1 Favorites, 0 Comments

PPM Controlled Arduino

20230518_234539.jpg
20230518_234600.jpg

This instructable follows the setting up of an arduino to recognize and interpret Pulse Position Modulated inputs from a receiver-transmitter system.

Supplies

  1. Arduino Uno R3 (or any other Arduino based board that supports Interrupts)
  2. Transmitter - Receiver module with PPM functionality enabled (I will be using the Flysky FS-iA6B for this example)

What Is PPM?

Pulse-Position-Modulation-Waveforms-1.jpg

Pulse Width Modulation is a common term heard when it comes to electronics. But Pulse Position Modulation (PPM) is not so common in everyday use due to its rather restrictive manner of signal propagation reliability in some use cases.

Pulse position modulation (PPM) is a digital modulation technique used in communication systems to transmit data or information over a carrier signal. It is a form of pulse modulation where the position of a pulse within a time interval carries the information, rather than the amplitude or width of the pulse.

In PPM, a series of pulses are transmitted, and the position of each pulse within a fixed time slot or interval represents the binary data. The time slot is divided into multiple equal intervals, and the position of the pulse within those intervals determines the value of the transmitted data. A pulse in the center of the interval may represent one binary value (e.g., 1), while a pulse at the beginning or end may represent another binary value (e.g., 0).

When compared with Pulse Amplitude Modulation (PAM) and Pulse Width Modulation (PWM), the advantages of PPM include its immunity to amplitude variations or noise since the amplitude of the pulse is not used to encode information. PPM also provides better timing accuracy compared to other modulation techniques. However, it requires a precise synchronization between the transmitter and receiver, as any timing mismatch can lead to errors in decoding the transmitted data. As the amplitude of the message signal increases, the pulse shifts within the given pulse duration accordingly to reference.

In our case, the advantaged outweigh the risks, as we only need one wire between the arduino and the receiver for signal transfer of all the channels (as opposed to having 6 wires for 6 channels). This way, we can save weight and avoid clutter (useful for projects like drones).

Setting Up Receiver for PPM Output

20230519_232214.jpg
20230519_232227.jpg
20230519_232236.jpg

The Receiver has two modes. One, where it outputs the channel values into corresponding output pins marked on the receiver, or two, it combines all the channels data into a single pulse and transmits it via the PPM port on the receiver. The receiver usually has a separate PPM port clearly labelled. If it doesn't, please refer to the user manual to check whether it has the capability of PPM.

1.In order to set it up in this specific model, switch on the transmitter, and hold the OK button.

The transmitter will go into a menu, where "System" and "Setup" are displayed. Move through the selections using the Up/Down buttons to the left of the LCD, and select "System" by clicking OK once.

2. Once in the System menu (see picture for confirmation), navigate down to RX Setup

3. Then go to PPM Output, and toggle it on by using the up and down buttons, and once ON is being displayed on the screen, hold the CANCEL button to save and exit (confirmed by a high pitched beep)

Your Receiver is now set up for PPM output.

Wiring the Receiver to the Arduino

Screenshot 2023-05-19 at 23-50-29 receiver module pinout flysky - Google Search.png
20230519_234917.jpg
20230519_234928.jpg
Screenshot 2023-05-19 at 23-57-20 interrupt pins on the arduino uno r3 - Google Search.png

A total of 3 wires will be connected between the receiver and the arduino. Positive (5V), Negative, and Data (connected to an interrupt pin on the Arduino.

  1. Refer to the image for the pinout of the receiver. The middle row is reserved for positive Vcc, while the row on the top is the Signal Pin. The last one on the bottom is used to connect negative. WRONG CONNECTIONS WILL BURN THE RECEIVER FOR GOOD.
  2. Connect a wire from the 5v pin on the Arduino to the positive pin (middle row) under the Battery port on the receiver (usually the first or last, denoted with a BATT or B). In my picture, Red Wire = Postive 5V, Brown = Negative. Connect the negative pin to any of the ground pins on the arduino.
  3. The Arduino Uno has two interrupt pins, Digital pin 2 and Digital Pin 3 (refer to image). Connect a wire to either of these, and connect it to the data pin (first row) under the PPM section of the receiver (usually shared by CH1), green wire in my case.

That is all you will need to receive all the channels data.

Code

Here is a Github link to my code.

https://github.com/AllenP3/PPM-Arduino-Car


However, i have included a file to demosntrate just reading in the data

Install both the libraries as given in the Readme in https://github.com/Nikkilae/PPM-reader, as we will be using these libraries to handle the interrupts.

Once the libraries have been added to your arduino library path, upload the test.ino code onto your arduino, and open up Serial Plotter. You should see a graph with all of your channel values being plotted in realtime.

The values of the channels are between 1000 and 2000. You can use these values to control all sorts of sensors/motors on your arduino with just a little bit of coding.

As an example, i implemented this code and built a very basic Arduino Car (which has rudimentary obstacle avoidance, line tracking and other basic things). The code for this can be found in the same Github repo (https://github.com/AllenP3/PPM-Arduino-Car) in the file main.ino. You can use to reference any project you would want to make using the arduino.


All Done!

Hopefully this has helped in a better understanding of Pulse Position Moduation and how interpreting it using the arduino works. Here's a video of a very basic car test model, after having used the derived channel values to control fun stuff using the setup mentioned in this Instructable.


🕊️🕊️