Our school club is building a robot, controlling 12 continuous micro servos by a 2012 raspberry pi and a PCA9685 controller board. We have imported the adafruit servo kit library to python but the servos are not under our command. some seem to spin aimlessly, others change direction randomly etc.
Is this an issue with a capacitor, the code or a component?
Raspberry Pi, PCA9685 and continuous micro servo refuse to communicate
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Lord_Richer
- Posts: 2
- Joined: Wed Feb 01, 2023 12:18 pm
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Raspberry Pi, PCA9685 and continuous micro servo refuse to communicate
My first thought is code.
Do you want to post it here?
What PCA9685 controller board are you using?
Dave
Do you want to post it here?
What PCA9685 controller board are you using?
Dave
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Raspberry Pi, PCA9685 and continuous micro servo refuse to communicate
Have you set the "zero point" yet? The servos are not really calibrated and you need to set the resistor inside so they are still at a setting.
Halfway between those extremes, a 1.5 millisecond pulse should cause the motor to stop. Most CR servos have an adjustment screw or trimpot that allows you to fine tune the point at which it stops, a calibration procedure often called nulling. With the CR Servo Trigger, the stop point can be adjusted on the board, but if it behaves unexpectedly, double check that the trim on the servo itself isn't the root of the problem.
( https://learn.sparkfun.com/tutorials/co ... -guide/all )
Halfway between those extremes, a 1.5 millisecond pulse should cause the motor to stop. Most CR servos have an adjustment screw or trimpot that allows you to fine tune the point at which it stops, a calibration procedure often called nulling. With the CR Servo Trigger, the stop point can be adjusted on the board, but if it behaves unexpectedly, double check that the trim on the servo itself isn't the root of the problem.
( https://learn.sparkfun.com/tutorials/co ... -guide/all )
- Lord_Richer
- Posts: 2
- Joined: Wed Feb 01, 2023 12:18 pm
Re: Raspberry Pi, PCA9685 and continuous micro servo refuse to communicate
Thanks all, I am still stuck though. Articles i read often talk about Circuit Python to interact with components - is that needed on a pi since it is more of a single board computer than a micro-controller? I have not touched anything to do with Circuit Python and am running standard python 3.9.2, importing ServoKit from adafruit_servokit. The Pi i am now using is a 4b with the latest operating system.
Secondly does setting the Zero point refer to the point at which the servo is "angle zero", or the pulse at which the servo will stop.
Also I know for CR servos i should use throttle and not angle, as that is for a position, but doesn't it work the same way where 90 is stopped, 180 is full speeed clockwise and 0 is full speed counter clockwise? I have tried both unsuccesfully.
Here is my code:
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16)
kit.servo[0].angle=180
Secondly does setting the Zero point refer to the point at which the servo is "angle zero", or the pulse at which the servo will stop.
Also I know for CR servos i should use throttle and not angle, as that is for a position, but doesn't it work the same way where 90 is stopped, 180 is full speeed clockwise and 0 is full speed counter clockwise? I have tried both unsuccesfully.
Here is my code:
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16)
kit.servo[0].angle=180
- adafruit_support_bill
- Posts: 88145
- Joined: Sat Feb 07, 2009 10:11 am
Re: Raspberry Pi, PCA9685 and continuous micro servo refuse to communicate
The "zero point" for a CR servo is typically close to the same theoretical pulse width as 90 degrees. But this needs to be calibrated for each servo. Some CR servos have a zero-adjustment pot which can be tuned with a small screwdriver. If yours do not have them, you will need to tweak the zero point in your code until the servo stops moving.but doesn't it work the same way where 90 is stopped, 180 is full speeed clockwise and 0 is full speed counter clockwise?
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Raspberry Pi, PCA9685 and continuous micro servo refuse to communicate
See https://learn.adafruit.com/circuitpytho ... rypi-linuxThanks all, I am still stuck though. Articles i read often talk about Circuit Python to interact with components - is that needed on a pi since it is more of a single board computer than a micro-controller?
Dave
Please be positive and constructive with your questions and comments.