I have several servos plugged into a PCA9685 board and controlling them with PCA9685.py, and at the end of the script at pwm.cancel() my SF3218MG (270 degree) and 6221MG (180 degree) servos turn off the PWM without any problem, but the DS3218MG (180 degree) servos stay locked in place. What is different about this servo that makes it continue to draw current? All of these servos are digital servos.

  • Well, my first troubleshooting trick is swap 6221 with 3218 and see if situations get vice versa. You might also list the pca9685.py for everybody to debug.
    – tlfong01
    Jun 10, 2020 at 5:47
  • 1
    Edited to link to the pca9685.py download, and regardless of channel it functions normally for the SF3218MG and 6221MG servos, but the DS3218MG servos still want to hold their position.
    – pinkie pAI
    Jun 10, 2020 at 7:52
  • Ah. if the other two servos behave well, but only the bad guy DS3218 gets stuck at the end of the program, then it is likely that the python program is also OK. I usually write a little "swing back and forth" program to test the servos. For example, if I say swing(servo1), swing(servo2) and they swing happily, but if I say swing(servo3), and the servo3 gets stuck at the end, then we can narrow down to servo3 at the end of the program. Usually when you clean up stuff, something does not do what you expected. Anyway, let me think harder and come back to you later.
    – tlfong01
    Jun 10, 2020 at 8:29
  • So I skimmed your pca9685.py but find it a bit higher level. Apparently you import pigpio.py which includes a module called pca9685.py. In other words, you are using two higher level modules which sets up I2C stuff and manipulate PCA9658 register etc. There is a possibility that the I2C level stuff is not compatible to your Rpi3B+/Rpi4B stretch/buster. I searched my old PCA9685 program to refresh my memory and found that I import smbus.py and write my own pca9685 functions. In other words, I only talk at I2C level. BTW, do you use any of the Rpi GPIO clock pins?
    – tlfong01
    Jun 10, 2020 at 8:59
  • 1
    Thanks for your suggestion, I'll look into using smbus! And the only pins I'm using on the RPi are SDA1, SCL1, power and ground. I think when Joan was writing PCA9685.py he intended the main function to be as an example, which explains why the function imports its own file, if that's what you're referring to when you say "two higher level modules".
    – pinkie pAI
    Jun 10, 2020 at 18:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.