adafruit / Adafruit_CircuitPython_ServoKit

CircuitPython helper library for the PWM/Servo FeatherWing, Shield and Pi HAT kits.
MIT License
69 stars 29 forks source link

can't release servo's after using them #30

Closed high-solutions closed 2 years ago

high-solutions commented 3 years ago

What ever I tried, i can't find a way to release the servo's once they have been used without pulling the power of the PCA9585 board. But after pulling power and putting it back the servo's keep release until they are activated again.

ladyada commented 3 years ago

Try setting the angle to None

n8atnite commented 2 years ago

This does not work for me. Servos remain locked even after setting all channels' angle to None.

high-solutions commented 2 years ago

Yep, i solved the issue by connecting the extra pin but that enables/disables all servo's instead of only one. Haven't found the reall solution yet

dattasaurabh82 commented 2 years ago

Any solution implementation to this planned in the near future yet?

caternuson commented 2 years ago

Using the OE pin is always an option. That'd be the hardware way to disable all the outputs. But should be able to disable per channel via software as well. Just need to set duty cycle to 0 to essentially flat line the PWM signal, which should cause the servo to be released. And as suggested above, that should be possible by setting the angle to None.

Just tested this with a PCA breakout (the PCA9685 is what all the servo HATs, Bonnets, etc. use):

Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit QT Py M0 with samd21e18
>>> from adafruit_servokit import ServoKit
>>> kit = ServoKit(channels=8)
>>> kit.servo[0].angle = 0
>>> kit.servo[0].angle = 90
>>> kit.servo[0].angle = 180
>>> kit.servo[0].angle = None
>>>  

and it did release the servo after setting None. There was a small delay before the servo actually released, but it eventually (1 second-ish) became free and was turnable by hand.

If you try the above same code snippet, the servo still does not release on your setup?

dattasaurabh82 commented 2 years ago

@caternuson None works

caternuson commented 2 years ago

OK. gonna close this then. Original poster found another solution. And otherwise can not recreate the issue. Setting angle to None is how this should be done.

Additional background info for reference. The ability to release a servo by setting angle to None was added in this PR: https://github.com/adafruit/Adafruit_CircuitPython_Motor/pull/27 This ServoKit library is just a thin wrapper layer over the Motor library to make the Servo use case easier for some specific products. But it generally calls directly into the Motor library.

ananasn commented 2 years ago

Hello!

I recently got the same issue as the topic starter. Still can't get around with it.

I got the Adafruit PCA9685 16-Channel Servo Driver connected to Raspberry Pi 4.

On my RPI following packages are installed in venv:

Adafruit-Blinka==7.3.0
adafruit-circuitpython-busdevice==5.1.8
adafruit-circuitpython-motor==3.3.5
adafruit-circuitpython-pca9685==3.4.1
adafruit-circuitpython-register==1.9.8
adafruit-circuitpython-servokit==1.3.8
adafruit-circuitpython-typing==1.7.0
Adafruit-PlatformDetect==3.22.1
Adafruit-PureIO==1.1.9
install==1.3.5
pkg-resources==0.0.0
pyftdi==0.54.0
pyserial==3.5
pyusb==1.2.1
rpi-ws281x==4.3.4
RPi.GPIO==0.7.1
sysv-ipc==1.1.0
typing-extensions==4.2.0

My python code is following:

from adafruit_servokit import ServoKit
import time

kit = ServoKit(channels=16)
kit.servo[0].angle = None
time.sleep(10)

During code execution and after it finish my servo keeps blocked.