Reading PWM from External Servo

Hello

My problem is i want to read a servo PWN signal via analog pin on arduino. The servo is in completely different RC CB and operate independently from the arduino . in short i want to trigger events in my arduino once PWM signal received, is there a way to day that?

Both arduino circuit and RC circuit have common ground.

Any suggestion will help.

Thank you.

haggar11:
i want to trigger events in my arduino once PWM signal received

If the signal is ‘PWM’ meant for a standard servo, you probably don’t want to read it via analogRead()

You can read the width of the pulse (usually from 1 to 2 milliseconds) using pulseIn()

Yours,
TonyWilk

TonyWilk:
If the signal is ‘PWM’ meant for a standard servo, you probably don’t want to read it via analogRead()

You can read the width of the pulse (usually from 1 to 2 milliseconds) using pulseIn()

Yours,
TonyWilk

Thanks a lot tony for your suggestion. I read around and i am confused, some references refer to signal from RC to servo as pWM signal other claimed its PPM signal. As well as using pulsein() claimed to stop other processes in arduino, my aim is to read status of couple of pins in order to operate turning signal. as such pulsein() might be not the favourite choice.

Thanks :slight_smile:

haggar11:
I read around and i am confused, some references refer to signal from RC to servo as pWM signal other claimed its PPM signal.

Here's a picture I ripped off this pi forum page:


The servo pulse is Pulse Width Modulated, but with a gap (the gap is where other servo's will get their signal). Pulse Position Modulation is actually something different (the gap changes).

The other use of the term Pulse Width Modulation refers to a signal which goes from completely low, thru wider and wider pulses until, when full on, it is 100% high. This is the sort of signal used to control the speed of motors and is used by the Arduino for the analogWrite() function.

... using pulsein() claimed to stop other processes in arduino snip

That is true to an extent.
Once pulseIn() is called it waits for a pulse, measures it and then returns its length - during which time your program is 'stopped' waiting for it to finish.

However, since the servo signal repeats every 20 milliseconds or so (if it is there), then you can give pulseIn() a timeout value, so this...

  duration = pulseIn(pin, HIGH, 30000 );  // read pulse, timeout in 30,000uS (30mS)

...will only 'hold up' your program for 30 milliseconds maximum. The return value will be zero (no pulse found) or a value representing the length of the pulse.

Yours,
TonyWilk

Thank a lot Tony, that is really helpful. I have learnt a lot from it. Still reading around i will keep you updated.

Hi there,

I’m planning to do something like this as well, and I have some questions.

  1. so the -ve output of drone controller is connected to the ground of Arduino, and where does the signal pin gets connected to? Analog or Digital? and what happens to the +ve (Vcc) output, wedon’t need to connect it to Arduino right, as it is giving voltage out.

  2. What type of code did you use? pulseIn returns the , but I wanted to do something like when the knob on RC is turned to the max position,a water pump will be turned ON and when the knob is at min position, the pump is OFF . So, how do I proceed?

Hope someone can help me.

Yes -ve to ground, signal to a digital pin.

pulseIn() returns a pulse length. The pulse length tells you the position of the knob. Roughly speaking 1ms or less is hard one way, 2ms or more is hard the other way (see #3).

That's all true for conventional RC receivers but not everything called a "drone controller" uses that same type of servo signal.

Steve