# How to convert Pulse Position Modulation (PPM) to duty cycle?

I can convert PWM to duty cycle since each frame starts with a rising edge. Then I count the on time, off time and take the ratio to find duty cycle.

However, for PPM signal, there is no start of frame or end of frame so I am stuck. That is even with the assumption that frame length is known.

There are some modules that claim they can convert PPM to Analog. One of them is PT01A WingXine which can convert PPM to Analog AND vice verse, there is only 1 single IC on there so I was wondering how it functions.

• A little description what are the two devices that you want to interface would help. Position pulses are used for motors like steppers, BLDC, etc.. It isn't clear what you want to acheive. – Marko Buršič Sep 28 '16 at 8:34

According to Tech-FAQ you are correct.

Figure 1. Signal encoded with pulse amplitude, pulse density, pulse position and pulse code modulation.

From the Tech-FAQ article:

How Pulse Position Modulation Works

Pulse position modulation works by sending electrical, electromagnetic, or optical pulses to a computer or other device in order to communicate simple data. It requires both devices to be synchronized to the same clock so that when a series of pulses is sent, the device decodes the information based on when the pulses were broadcasted. Alternately, another form of pulse position modulation known as differential pulse position modulation, allows all signals to be encoded based on the difference between broadcast times. This means that a receiving device only has to observe the difference in arrival times in order to decode a transmission.

Further down the article they continue:

Pulse position modulation requires that both devices are synchronized or differential pulse position modulation is used. Also, pulse position modulation is highly sensitive to multi-pathway interference, such as echoing, that can disrupt a transmission by altering the difference in arrival times of each signal.

The Wikipedia article Pulse position modulation gives food for though (but not much else) when it states

Synchronization

One of the key difficulties of implementing this technique is that the receiver must be properly synchronized to align the local clock with the beginning of each symbol. Therefore, it is often implemented differentially as differential pulse-position modulation, whereby each pulse position is encoded relative to the previous, such that the receiver must only measure the difference in the arrival time of successive pulses. It is possible to limit the propagation of errors to adjacent symbols, so that an error in measuring the differential delay of one pulse will affect only two symbols, instead of affecting all successive measurements.

An article on PCB Heaven explains several different PPM schemes. The last one looks the simplest for analog signal transmission without a clock.

Figure 2. This simple analog PPM scheme can reconstruct the signal without the original clock but notice that the number of samples decreases for high voltages.

That complete article is worth a read.

Figure 3. The board and close-up of the setting jumpers.

The board does seem to support PPM but without a datasheet it's not certain.

In a radio-controlled airplane and similar RC hobby devices, traditionally the single "RC PPM" signal that comes out of the "radio" part of the radio receiver is fed into the "CLK" input of a 4017 decade counter or a 4015 shift register in the "output" part of the radio receiver. That same "RC PPM" signal is fed into a resistor+capacitor "sync detect" circuit that drives the "reset" input of that same chip. That chip decodes the "RC PPM" signal into several independent "RC PWM" output signals.

When the radios are working correctly, the "RC PPM" signal at the "buddy box connector" of a RC transmitter should be practically identical to the RC PPM signal coming out of the paired radio receiver tuned to listen to that transmitter.

"RC PPM signal"

Sync    1       2     3     4        5    6    7   8   Sync...
---+ +----+ +------+ +-+ +-------+ +--+ +--+ +--+ +-+ +----...
| |    | |      | | | |       | |  | |  | |  | | | |
| |    | |      | | | |       | |  | |  | |  | | | |
| |    | |      | | | |       | |  | |  | |  | | | |
+-+    +-+      +-+ +-+       +-+  +-+  +-+  +-+ +-+
*      *        *   *         *    *    *    *   *

* - low separator pulse, always 0.5 ms
1..8 - high "RC PWM pulse" for channels 1..8      0.5 – 1.5 ms
Sync: high frame separator pulse, typically 5 ms or longer.


Is decoded to:

    "RC PWM signal"
2
+--------+
|        |
|        |
|        |
---------+        +-------------------------------------...
3
+---+
|   |
|   |
|   |
------------------+   +--------------------------------...
2: - high "RC PWM pulse" as sent to servo 2.      1.0 – 2.0 ms
3: - high "RC PWM pulse" as sent to servo 3.      1.0 – 2.0 ms
etc. for all 8 channels.


The long "sync pulse" in a traditional RC PPM signal is the start-of-frame and end-of-frame indicator.

Standard RC servos directly plug in to those "RC PWM" outputs with a standard 3-pin connector with 0.1 inch spacing.

Standard RC electronic speed controllers designed to drive DC motors ("DC RC ESC") directly plug into those "RC PWM" outputs, and convert that signal to a duty cycle.

More details:

## Other PPM

Some people describe certain infrared remote control protocols as using a "pulse position modulation (PPM)" signal, even though those signals are different and incompatible from what I call "RC PPM" signals.

Some people describe some fiber optic systems as using "pulse position modulation (PPM)" signal, even though those signals are different and incompatible from what I call "RC PPM" signals or "IR PPM" signals.

PT01A WingXine which can convert PPM to Analog AND vice verse

According the manual it can, but their usage of the PPM acronym is unclear.

Pulse Position Modulation encodes an analog value in the time between the rising or falling edge of two pulses. This is typically used in hobby radio control systems to send multiple servo signals over a single wire or rf link.

The servos themselves accept a form of Pulse Width Modulation which has a nominal duration of 1~2ms with a cycle time of approximately 16~22ms (60~45Hz). Analog position is encoded in the 1~2ms pulse width only, so the time between pulses (cycle time) is not important as long as the servo can handle the repetition rate (warning:- 'analog' servos may become unstable or even burn out at rates above 60Hz!).

When the PT01A is set to "Analog Voltage to PPM signal" mode it accepts two analog voltages ranging from 0~5V on input channels 2 and 3, and converts them to 1~2ms servo pulses on output channels 2 and 3. So this is a conversion from analog voltage to PWM, not PPM.

In "PPM Signal to Analog Voltage" mode, a PPM input is shown being applied to channel 1 only. The input signal is described as '1ms to 2ms positive pulse width' which is PWM not PPM, however this may refer to the PWM pulses encoded in the PPM stream.

In this mode the outputs are described as being a 0~5V analog voltage on channel 1, and 0~100% PWM on channels 2 and 3. This implies that the input is a 3 channel PPM pulse stream (consisting of a start pulse followed by 3 channel duration pulses, then a synchronizing gap before the next start pulse). So in this case it appears they are using the PPM acronym correctly.

there is only 1 single IC on there so I was wondering how it functions.

It is probably a microcontroller (MCU) with an internal ADC and timer (and perhaps a DAC and/or PWM peripherals) running firmware that performs the various conversion functions.

With suitable code an Arduino could do the same job, though since it doesn't have a DAC the 0-5V analog output would have to be produced using PWM (which is what the Arduino's 'analog' output function actually does) passed through an RC filter to produce a (relatively) smooth DC voltage.