0

Servo speed on 16 channel servo bonnet
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Please be positive and constructive with your questions and comments.

Servo speed on 16 channel servo bonnet

by Kingbob on Sun May 29, 2022 2:18 am

I have the 16 channel Servo/PWN Bonnet for a Pi, and its working controlling the servos, but i need to slow some of them down. They're just moving way too fast.

Can the speed of movement be altered?
Rather than telling it to move direct from 0deg to 180deg for example, i tried a loop moving it in increments with a small delay, but that just ends up being really jerky movement. I need a nice slow movement.

Thanks

Kingbob
 
Posts: 40
Joined: Tue Jul 08, 2014 11:47 pm

Re: Servo speed on 16 channel servo bonnet

by adafruit_support_bill on Sun May 29, 2022 6:09 am

Servo seek speed is controlled by the internal circuitry of the servo. Some of the more expensive digital servos allow you to tune that behavior. But on most hobby-grade RC servos it is fixed. In order to control seek speed on common RC servos, you need to use incremental moves.

adafruit_support_bill
 
Posts: 84023
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo speed on 16 channel servo bonnet

by Kingbob on Mon May 30, 2022 6:25 am

OK, so i cant directly control the speed, but i should be able to control the PWM waveform, similar to how James Bruton does it in this video:
https://youtu.be/jsXolwJskKM?t=314

Or another example in python on a pi using the pwm pin here:
https://youtu.be/_fdwE4EznYo?t=691

This gives a slow start/stop to the movement, which will do what i want. I believe i can repproduce this in python on the pi, but how do i address the PWM port on the bonnet over i2c?

Basically this will control the aplitude of the pwn signal, at the moment the adafruit servo library only controls the length of the pulse, not the amplitude.

Thanks

Kingbob
 
Posts: 40
Joined: Tue Jul 08, 2014 11:47 pm

Re: Servo speed on 16 channel servo bonnet

by adafruit_support_bill on Mon May 30, 2022 8:29 am

James Bruton is not modifying the PWM waveform. He is adding some smoothing to the incremental moves so that the servos decelerate as they approach the final position.

James Bruton's code is a refinement of the servo code from my Arduino multitasking tutorial:
https://learn.adafruit.com/multi-taskin ... lean-sweep

There is a CircuitPython version of the servo multitasking code here:
https://learn.adafruit.com/multi-taskin ... hon/servos

adafruit_support_bill
 
Posts: 84023
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo speed on 16 channel servo bonnet

by Kingbob on Tue May 31, 2022 9:14 am

I think that will give me the effect i'm looking for. But how do i address the PWM port on the bonnet over i2c?
The examples use a PWM pin on the GPIO.

Kingbob
 
Posts: 40
Joined: Tue Jul 08, 2014 11:47 pm

Re: Servo speed on 16 channel servo bonnet

by adafruit_support_bill on Tue May 31, 2022 10:29 am

The CircuitPython ServoKit library can be used to address the PWM ports on the bonnet:
https://learn.adafruit.com/adafruit-16- ... on-library

adafruit_support_bill
 
Posts: 84023
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.