Microsecond resolution when using M280 for servo control
hbang last edited by hbang
(Using the Duet Wifi 1.0.4 board with 2.02 firmware)
I'm currently using the servo command M280 with the "S" argument using the microsecond timing option, giving values between 600 and 2400 microseconds to control a set of servos for a camera gimbal. However, I'm having trouble getting the level of accuracy I was hoping to achieve in pointing the camera.
It's not clear to me if this is a limitation of the servos, or whether the timing resolution of the pulse being sent by the Duet is small enough to allow the servo to move a very small distance. Right now the minimum change it takes approaches 20 microseconds. Changes less than that won't cause a movement.
I was hoping to get approximately 1 degree of resolution in movement. The servos are made to rotate nearly 400 degrees over the range of 600us to 2400us, so let's say each approximate degree of movement would require a change in pulse timing of 5us. However it appears I need a value change in the M280 S parameter of about 20us to see any movement, but this results in a movement of about 4 degrees.
What is the smallest resolution step possible with the M280 command using the microsecond pulse option? I'm currently using the P3, P4, and P5 options to control the servos through the heater outputs on the expansion board.
Thank you for any insight as to what I don't understand here.
The S value is converted to a PWM signal with a frequency of 50Hz. The resolution depends on whether the output pin you are using is controlled by a PWM channel or a TC channel. On the Duet WiFi/Ethernet, the TC channels have higher resolution than the PWM channels. So if you are using a PWM channel, changing to an output pin that uses a TC channel may help. You can use the chart at https://duet3d.dozuki.com/Wiki/Duet_2_Pinout_table to determine which outputs are PWM (those with PWMLx highlighted) and which are TC (those with TIOAx highlighted).
hbang last edited by
Thank you! I'll give this a try and let you know how it turns out.