Go Down

Topic: Due + PCA9685 Servo board: it makes no servo work at all (Read 344 times) previous topic - next topic


I have issues with my 2 Dues + PCA9685 Servo board: it makes no servo work at all!

Instead, trying the same Sketch with a Mega2560, it's all fine though.
With my Feather M4 the code is also working fine, by 3.3V Vc.

The PCA is designed for 3-5V Vc and signal levels, but even if I supply it from the Due by 5V Vc it still don't work.

This is the code, what's wrong with the Due?

Code: [Select]
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define MIN_PULSE_WIDTH 650
#define MAX_PULSE_WIDTH 2350
#define FREQUENCY 50
uint8_t servonum = 0;

void setup() {
   Serial.println("16 channel Servo test!");

int pulseWidth(int angle) {
   int pulse_wide, analog_value;
   pulse_wide = map(angle, 0, 180, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
   analog_value = int(float(pulse_wide) / 1000000 * FREQUENCY * 4096);
   return analog_value;

void loop() {
   pwm.setPWM(0, 0, pulseWidth(0));
   pwm.setPWM(0, 0, pulseWidth(120));
   pwm.setPWM(0, 0, pulseWidth(90));


There is this thread, however I don't understand why they add resistors to SDA/SCL since there is already a 1K resistor:



thank you, I added the pullups but still no success, no servo movement at all.
The serial monitor claims it's moving the servos, erroneously.

OTOH, the i2c scanner program finds the PCA at Due  at x40 (and 2nd at x70) either way though.

Just tested: on M4 it works also even without any added pullups (just to mention, the Mega has built-in ones like the Due, the M4 neither)

Go Up