Go Down

### Topic: Servo library alternative (Read 664 times)previous topic - next topic

#### alka

#15
##### Mar 12, 2018, 01:57 pmLast Edit: Mar 12, 2018, 02:02 pm by alka
And what range of pulse widths does it expect?

Is it the normal servo range of 1000 to 2000 microsecs?

...R
That was in my first answer although i was a bit off.. To allow for a higher refresh rate the firmware uses a lower max pulse duration.

from the tgy.asm file

.equ   STOP_RC_PULS   = 1060
.equ   FULL_RC_PULS   = 1860

So the analogWrite(127) to analogWrite(240) is about the same pulse widths. ( on a 500hz output pin).

#### Robin2

#16
##### Mar 12, 2018, 06:22 pmLast Edit: Mar 12, 2018, 06:27 pm by Robin2
My maths (which is often faulty) tells me that at 500Hz a cycle takes 2000 µsecs. As analogWrite() takes values from 0 to 255 the granularity will be about 7.84µsecs. That suggests that 135 gives 1060 and 240 gives 1881.

However the control would be very coarse - just 240 - 135 = 105 steps between min and max. Doesn't that negate the purpose of the high refresh rate? Using Servo.writeMicroseconds() you would have 821 steps over the full range.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### alka

#17
##### Mar 12, 2018, 07:32 pm
I think your maths look spot on ( I just guessed at my numbers)

Yes it granularity is horrible. But hey.. the thread title was "servo library alternative".

Go Up