---
title: "Comment by Pascal on \"Control 16 servos with Raspberry Pi + PCA9685 Driver\" | Hashnode"
description: "Very nice tutorial, thanks! I followed your steps above and it has thrown this exception on run: /bin/python /home/pi/rover/Adafruit_Python_PCA9685/examples/sim"
url: "https://hashnode.com/posts/control-16-servos-with-raspberry-pi-pca9685-driver/615f4248b945c81a907cf1a0/comment/61a4f5319ac0d611876b215e"
---

[Discussion](https://hashnode.com/posts/control-16-servos-with-raspberry-pi-pca9685-driver/615f4248b945c81a907cf1a0)

Comment [Control 16 servos with Raspberry Pi + PCA9685 Driver](https://hashnode.com/posts/control-16-servos-with-raspberry-pi-pca9685-driver/615f4248b945c81a907cf1a0)

[Pascal](https://hashnode.com/@metrowizard)

[Nov 29, 2021](https://hashnode.com/posts/control-16-servos-with-raspberry-pi-pca9685-driver/615f4248b945c81a907cf1a0/comment/61a4f5319ac0d611876b215e)

Very nice tutorial, thanks! I followed your steps above and it has thrown this exception on run:

```
/bin/python /home/pi/rover/Adafruit_Python_PCA9685/examples/simpletest.py

Traceback (most recent call last):
  File "/home/pi/rover/Adafruit_Python_PCA9685/examples/simpletest.py", line 56, in <module>
    kit.servo[7].angle = 175
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_servokit.py", line 147, in __getitem__
    servo = adafruit_motor.servo.Servo(self.kit._pca.channels[servo_channel])
  File "/usr/local/lib/python3.7/dist-packages/adafruit_motor/servo.py", line 89, in __init__
    super().__init__(pwm_out, min_pulse=min_pulse, max_pulse=max_pulse)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_motor/servo.py", line 29, in __init__
    self.set_pulse_width_range(min_pulse, max_pulse)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_motor/servo.py", line 33, in set_pulse_width_range
    self._min_duty = int((min_pulse * self._pwm_out.frequency) / 1000000 * 0xFFFF)
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_pca9685.py", line 56, in frequency
    return self._pca.frequency
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_pca9685.py", line 134, in frequency
    return self.reference_clock_speed / 4096 / self.prescale_reg
ZeroDivisionError: float division by zero
```

Could you help me? Thanks a lot in advance Metrowizard

[Gary Vladimir Núñez López](https://hashnode.com/@yragi-san117)

[Dec 2, 2021](https://hashnode.com/posts/control-16-servos-with-raspberry-pi-pca9685-driver/615f4248b945c81a907cf1a0/comment/61a4f5319ac0d611876b215e#reply-61a82767be456923c52bc57e)

Hi!, I'm glad you found the article useful, the error shown above has nothing to do with the adafruit library or hardware, the problem it's clear in the last line:

```
zeroDivisionError: float division by zero
```

that means that the code it's performing a division by zero which is not possible.

Have you changed the simplest.py file? in your code, I'm seeing lines that are not found in the original one.

Edit: I've checked the library and it says that it's' deprecated, maybe that has to do with the problem, either way, I recommend you skip that test and work with the second library I showed in the post, it's simpler and works better.

Hope this helps, let me know how you do.

[Pascal](https://hashnode.com/@metrowizard)

[Dec 2, 2021](https://hashnode.com/posts/control-16-servos-with-raspberry-pi-pca9685-driver/615f4248b945c81a907cf1a0/comment/61a4f5319ac0d611876b215e#reply-61a8c3bb723c3a712ae10db4)

[Gary Vladimir Núñez López](https://hashnode.com/@yragi-san117)

Hi! Thanks for your answer. I just repeated the tutorial with the second library (--> Adafruit\_CircuitPython\_ServoKit).

The same kind of error:

```
Traceback (most recent call last):
  File "/home/pi/rover/Main.py", line 35, in <module>
    test.test()
  File "/home/pi/rover/Controllers/ServoController.py", line 12, in test
    kit.servo[7].angle = 175
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_servokit.py", line 147, in __getitem__
    servo = adafruit_motor.servo.Servo(self.kit._pca.channels[servo_channel])
  File "/usr/local/lib/python3.7/dist-packages/adafruit_motor/servo.py", line 89, in __init__
    super().__init__(pwm_out, min_pulse=min_pulse, max_pulse=max_pulse)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_motor/servo.py", line 29, in __init__
    self.set_pulse_width_range(min_pulse, max_pulse)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_motor/servo.py", line 33, in set_pulse_width_range
    self._min_duty = int((min_pulse * self._pwm_out.frequency) / 1000000 * 0xFFFF)
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_pca9685.py", line 56, in frequency
    return self._pca.frequency
  File "/home/pi/.local/lib/python3.7/site-packages/adafruit_pca9685.py", line 134, in frequency
    return self.reference_clock_speed / 4096 / self.prescale_reg
ZeroDivisionError: float division by zero
```

I expect you have nothing different running than the stock Raspian? What version of python do you use? Python3.10? I have Python3.7 on the Raspberry Pi, and I do not know how to upgrade it to 3.10...

Your help would be VERY appreciated!
