Read PWM signal from receiver

hi guys,

right now i've been on collision avoidance drone project where i should read pwm signal from receiver to arduino. im still confuse about the code

any help is appriciated, thank you guys

Welcome to the forum

Where is the PWM signal coming from and what is it that you want to read ?

  • the fact that it is either present or not ?
  • its frequency ?
  • its ampltude/voltage ?
  • its duty cycle ?
  • something else ?

i need to read like throttle,pitch, roll value from receiver (FS-IA6B). there im put some example of throttle,pitch, roll. and yes it has to be present

You convert the PWM signal to PPM that is sent OTA where the receiver converts the signal back to PWM.


i found some example of the code, do you mean like this ?

a conventional RC signal is a series of pulses, each pulse is separately routed to a servo, the width of the pulse controls the servo (it's not PWM)

one approach for measuring the pulses and inferring the the control values is to capture a timestamp on the rising edge of the pulse and measuring the time until the falling edge. an interrupt could be used, capturing the times in an array for processing in loop()

there will be a longer delay before the initial pulse that can restart the sequence

Are you sure that is correct ?
What is a Pulse Width Modulation system if it is not controlled by the width of the pulse ?

My understanding is that the signal from the RC transmitter is sent as a series of pulses using strict timing for the pulse separations ie it uses Pulse Position Modulation (PPM).

A traditional RC receiver then time slices the PPM signal into individual pulses, each of which is a Pulse Width Modulated (PWM) signal that is used to control individual servos via an individual signal wire to each servo

For some years now there have also been bus based RC receiver systems, such as SBUS, that pass on a PPM signal to the servos using a single wire bus system

The Arduino Servo library uses the PWM system with a pulse width that varies between 1000 and 2000 microseconds although you can set your own limits. You cannot, however, use a normal analogue (PWM) output from an Arduino to control a servo because its frequency is wrong

The FS-IA6B provides a PPM output directly.

a6

i understand the ambiguity. wiki Servo Control describes it as PWM. i believe it can be described more accurately without being confusing

today, PWM is commonly associated with motor control. it is a pulse at a fixed frequency but with a varying pulse width such that the duty-cycle represents the desired average output voltage

and pico processors commonly have built in hardware to generate PWM signals. but such hardware may not be able to generate a pulse to a servo from 1-2 msec if the PWM hardware is running at 100s kHz

the pulse for a servo does not have any frequency requirements. it is used in the servo to drive the motor to a specific position.

it's sorta like describing a wide range of bipolar signals (e.g. ethernet, DCC, ...) as simply AC

my understanding is that there is simply a nominal delay between pulses. the servo value is certainly not represented by the position of the pulse

nor is it time sliced which would require strict timing between TX and RX. the receiver synchronizes to each received pulse, sequentially routing each pulse to a separate output pin

You are correct, but in the RC world, the typical servo expects a pulse every 20 ms or so (50 Hz). Much longer than that may lead to the servo amplifiers not keeping up. Not sure if this has been tested out or not.

so in RC, there's a need to maintain the position of the servo, but there is no requirement. and along you're line of thought, a single pulse may not push the motor far enough to reach the desired position, so several pulse could be sent quickly.

feedback could also be used to control when to send pulses to a servo

The only thing that I would withdraw from my description is the use of time slicing by the receiver. It is the position of the pulse in the stream that matters. I stand by the rest of what I said

I don't believe that I said it was
What is represented by the position of each pulse in the train of pulses is the channel that is being controlled by that pulse. Each pulse has a width and it is the width of this pulse that controls the position of the associated servo

In that case you could control a standard servo with the standard PWM output

Yes, these servos are designed to a certain price point, and going above the standard frequency (every 20 ms, or 50 Hz) doesn't help standard servos keep their position or respond faster.
There are some more expensive servos used in the RC world that do respond to 300 Hz and may be used in heli tail rotor control.

In building my own FPV drone, I ran across this, https://dronenodes.com/how-to-build-a-drone/, which gave me a functional overview of the DIY drone thingy.

I then picked this route, https://ardupilot.org/ for my drone project.

i agree that the position in the sequence determines the channel. but you said

my understanding of PPM is the exact position of a pulse convey the information. the pulse width may be irrelavent

a common servo pulse needs to be 1-2 msec. the PWM hardware would need to operate at < 40 Hz to be able to generate a pulse with that width. but common PWM hardware typically operates at much higher frequencies because such low frequencies can damage motors

hence the need to distinguish between common PWM hardware in the Arduino and the more generic use of PWM

these servos must not operate between 1-2 msec

Yes.

In PPM signaling, the values of each channel are represented by the delay between rising edges of positive pulses each having 400 uS fixed width.

At least someone sez.

The receiver @thaariq is using has a PPM output. There are software PPM decoders for the Arduino.

And please @ ev'yone, it's 2022. There has been some real progress in end-to-end radio control signalling in the the several decades since the turn of the century. There are very few absolute blanket statements that cannot be quibbled with, no matter the authority with which they are presented.

The software between a thumb on a joystick and a synthesized BLDC motor winding (voltage) is soething you can literally make a career out of knowing well enough.

google is really a friend you wanna bring to this.

a7

Not necessarily. It is just that the RC receiver can send signals to the servo at up to 300 Hz or whatever the max freq happens to be. They will do just fine with 50 Hz or less.

And as alto777 mentioned, there are no absolutes here, just a rough guide.

And to confuse it all, PPM is still an analog protocol, i.e. it involves measuring the time delay between the start of the frame and the channel pulse. Many manufacturers have gone to their own digital protocols.

Here is a nice, quick resource you might find helpful:

sounds like the newer transmitter/receivers are sending the position values using a form of PPM and the receiver is translating the values to the conventional RC servo pulse or possibly some newer type of servo.

I have already said that I was wrong about RC systems using strict timing but they do use PPM. As I said

Does not match

Can I suggest that we end our debate and declare it a draw. It seems to me that both of us are right and both of us are wrong and our interchanges are not helping @thaariq with his project