Arduino Servo Libary, how many usec are 1 degree

Hi,

does anybody know, how many microsecond correlate with one degree? I just know, that 90 degree correlate with 1500 ms. But what correlate with 180 or 0 degree? I am interested in the data of the servo libary, not in the data of any servo.

Thanks for your help

Robert

1000 microsec are 0 degree 2000 microsec are 180 degree

so 1000ms/180 =5,6 ms/degree

Thanks you, that means, if I am working with a servo, where 0 degree are equal 600us and 180 degrees are equal 2400us I should work with us and not with degrees?

Robert

yes writeMicroseconds()

instead of write()

It probably depends on the particular servo you are using. Some servo may have an almost 2000us range of operation.

Hi, You can learn a great deal very quickly by opening the library files and having a look around, in my case the libraries files are here -

C:\arduino-1.0-windows\arduino-1.0\libraries\Servo

Inside the directory you will generally find a .h file and a .cpp file, these are the source code files used to build the library.

Inside servo.h you will find the following limits have been set -

define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo

define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo

You could adjust these to give a wider range, but I would assume these are provided by the library creators to prevent damage to the vast majority of servos.

Inside the write function in servo.cpp you will find

value = map(value, 0, 180, SERVO_MIN(), SERVO_MAX());

So the range 0,180 is mapped to 544 to 2400 microseconds (unless you specifically set some other limits) which gives 10.31 uS per degree. I may have missed something so feel free to check and correct.

Duane B.

rcarduino.blogspot.com

Using a bamboo skewer like below as a pointer to detect small movements, I've found that a standard servo has a ~5us dead band between discrete movements. That equates to only ~425 discrete positions in ~190 deg rotation.

Hi Zoomkat,

Thats interesting and going slightly off topic, another reason why trying to measure an RC input to sub uS accuracy is something of a waste of time.

The other reason is this -

http://1.bp.blogspot.com/-Zi6qBbVC1WY/Tx2WLRS3jlI/AAAAAAAAAOA/i3sAqVLflvk/s1600/near.PNG

In my observation, the input signal varies by 40us for a constant input signal, the variation increases with distance and the nature of the built up environment around the transmitter receiver.

http://rcarduino.blogspot.com/2012/01/how-to-read-rc-receiver-with_20.html

Duane B.