Go Down

Topic: Duty cycles on Arduino Due using PWM with Servo library. (Read 1 time) previous topic - next topic

Kyle_Sager

Jul 13, 2013, 06:55 am Last Edit: Jul 13, 2013, 07:20 am by Kyle_Sager Reason: 1
Hi -

I am posting this here in case anyone can answer crisply what the duty cycle for pulse width modulation (PWM) should be at the top end of the range of values for Servo control (via the Servo library) - say servo.write(180).

Everywhere I search, explanations of PWM draw into convoluted discussions of PWM frequency.  I am hoping someone can offer a crisp answer on duty cycle alone.  I am getting results
I believe are odd and wondering if this is normal, if this is a Due bug, or if my Due board is broken:

Whenever I use servo.write() via the servo library, if I use the top end of the value range (for example servo.write(180)), the highest duty cycle I get is around 13%.  To a voltmeter it looks like about 0.400 volts.  On an oscilloscope it shows up as a 3.3 volt square wave at 13.3% duty cycle, just as you would expect from the voltmeter readings.  

Is that normal for servo control?  As I adjust the value down from 180, I do see the duty cycle shrink.  And If I raise the value up above 180 it remains stuck at that 13.3% value.  I found one buried forum via Google that suggests typical servo controls range from around a 10% duty cycle on the low end to a 50% duty cycle or higher (around a 1.5 volt equivalent range).

I believe I have found a workaround for my needs elsewhere in this forum; but the workaround itself makes me highly suspicious that there might be a bug or failure to port functionality in Servo.h for the Due.  Basically people who seem to know what they are doing are using means other than Servo.h to get their needs accomplished in recent months; and my board otherwise seems to be functioning fine.  Vanilla PWM functionality seems perfect.  I am asking both because I want better understanding of PWM especially  as it relates to servo control standards, or if my board is not working properly I'd like to know, and if Servo.h needs to be updated I want to make clear duty cycle observations here because all of the other forum discussions seem focused on frequency (which is also important for Servo control - I understand).

AWOL

#1
Jul 13, 2013, 08:50 am Last Edit: Jul 13, 2013, 08:53 am by AWOL Reason: 1
Quote
to a 50% duty cycle or higher (

I've never heard of such a high duty-cycle in a standard R/C context, and it would make PPM multiplexing all but impossible.
Where did you get this figure?

Most discussions will give control pulses of from one to two milliseconds in a 20 millisecond frame, giving a five to ten percent duty-cycle.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Kyle_Sager

AWOL, Thanks so much for the kind reply.  Exactly what I needed to understand.  My own claim of a 50% duty cycle was based on my misreading of someone else's post expecting a typical high range of around 1.5 Volts....but the post was mixing a comparison of 3.3 volt and 5 volt boards (1.5 would still seem high based on your reply so you helped  my understanding a lot).  Now it all begins to make sense...and I haven't blown anything up in my Due (yet) - whew!  Thanks for kindness to newbs!

AWOL

I wouldn't place too much emphasis on apparent voltage - that's going to depend on the meter as much as it depends on the duty-cycle.
A mechanical needle may give consistent results, but most budget digital meters will not.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up