Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servo motors are not disabling/releasing after setting angle to None #65

Open
scprotz opened this issue Dec 1, 2022 · 8 comments
Open

Comments

@scprotz
Copy link

scprotz commented Dec 1, 2022

I'm using a Raspberry Pi 4 to control the PCA9685. I have generic MG996R-style servos connected (2 different brands). When I set the servo.angle = None, the servos just hold their current position without releasing.

I'm using servokit 1.3.13, pca9685 3.4.6, and motor 3.4.5

(I do have a version on a different raspberry pi that is running servokit 1.3.6, pca9685 3.39 and motor 3.3.2 that does work correctly, though it uses a different brand of servo).

I am not quite sure if this is due to a regression or certain brands of servos not recognizing the angle = None.

Any insight would be appreciated. I may try to upgrade the second raspberry pi and see if those servos get the issue. That would help narrow down if this is a per-servo-brand bug or a regression.

@Recelis
Copy link

Recelis commented Dec 30, 2022

I have the same issue too. My micro servo motors are disabling correctly but it seems like the bigger servos 1501MG https://www.pololu.com/product/1057 aren't being disabled.

@ladyada
Copy link
Member

ladyada commented Dec 30, 2022

do you know that the motors will 'release' when not receiving a 50hz signal because thats the only way to release motors - if your servo doesnt do that, it has nothing to do with this firmware

@scprotz
Copy link
Author

scprotz commented Dec 30, 2022

How can we programmatically tell it not to send the 50hz signal then. I would have thought setting angle = None should do something like that. Is there another command?

@scprotz
Copy link
Author

scprotz commented Jan 1, 2023

So just a note. It appears I can set the duty_cycle to nothing and it turns off this type of servo.

There are two ways (which are effectively the same based on the source code in github):

either
kit.servo[0]._pwm_out.duty_cycle = 0

or
kit.servo[0].fraction = None

Both of these turn off duty cycle 'release' the motor.

@scprotz
Copy link
Author

scprotz commented Jan 1, 2023

I misspoke. This does not release the motor. It just stops the duty cycle. I'll play around and see if there is another way to cut power completely to the servo.

@arnaudbore
Copy link

@scprotz do you have any update on this? It feels like you've been working with this for quite some time. If you have some time can you answer #73 ? Thank you in advance

@scprotz
Copy link
Author

scprotz commented Apr 3, 2023

Just wanted to add another comment. I have tried a number of things and still certain brands of motors will not disconnect/release when I set fraction = None, nor Angle = None. It appears there is a way to turn off the servo pins on the PCA9685. On this page: https://learn.adafruit.com/16-channel-pwm-servo-driver/library-reference
It states that (using an Arduino), I can setPWM(1, 0, 4096) to disable the servo pins (and I hope turn off the servo).

Is there a way to do the same with CircuitPython_Motor (or one of the lower level APIs)?

@scprotz
Copy link
Author

scprotz commented Apr 3, 2023

Extra notes: https://forums.adafruit.com/viewtopic.php?f=22&t=178641 says that setting the PWM duty_cycle to 0 should shut off the PCA9685 pins, but again, this does not seem to be the case as some servos continue to 'hold' even after setting the duty cycle to 0 for those servo's pins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants