I use my Arduino with Adafruit PCA9685 servo controller. To set PWM signals I use the provided library: https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library

It allows easily set PMM signal and works good. But how can I "unset" PWM signal for a certain pin?

If a PWM siganl is active, the servo stucks on the current position and can't be moved by hand, but only by setting other pulse length. So I need to move servo and then "free" it.

  • I'm not really into servos... do they "release" when just the duty cycle is 0% or 100% (this can easily be done with your PCA9685)? If not, the only way is switching off the power supply for that servo. – mic Jun 9 '17 at 8:45
  • Did you find a solution? I'm having the same problem. – Miguel Jun 25 at 10:05

You could try changing the corresponding pin from output to input. To be sure not to disturb other comfigurations you could do direct port manipulation.

void servo_off() {
  DDRD &= ~(1<<PD5);

void servo_on() {
  DDRD |= (1<<PD5);

This assumes you use pin PD5 for the pwm signal. Adjust the "D" in DDRD and PD5 so it matches the port in use as well as the pin number.

Of course, you need some additional user input like a button to trigger calls to those functions.

| improve this answer | |

Unluckily, AFAIK, the servo powers the motor even when the PWM signal is not applied. So "removing" the PWM is useless.

You will have to "turn off" the servo by removing the power. To do this, use a transistor (usually servos are more current-hungry than arduino can bear). When you want to "free" the servo, remove the power and it will be "free".

| improve this answer | |
  • you are wrong if I connect servo to my assembly it is "free" until I havent PWM set aslo I can free all servos by sending reset command to PCA9685 but my task is to "free" just one particular servo: there is the problem – Sergey Kravchenko Jun 9 '17 at 21:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.