[SOLVED] Arduino Uno with PCA9685 not detected on I2C bus

Hello

I'm new to Arduino and I am building a system to replace a Pololu Maestro Servo Controller. I'm using an Arduino Uno and a PCA9685 Servo Driver. I have two Pulse Width Meters connected to the PCA9685 to monitor the signals.

My sketch provides for a button press on Pin2 to start my program.

The program runs on button press as I see the progress as the messages are logged in the serial console.

There is no output on the PCA9685 servo channels however. The PCA9685 is at its base address. To try to isolate, I loaded an I2C_scan sketch and when I run the loop, there are no I2C devices detected. I'm rather certain that my wiring is correct, but here's a photo of the connections. SCL is connected to A5 and SDA is connected to A4.

My sketch is below, I am wondering if I am not loading the library properly...

Peter

/*************************************************** 
  This is an example for our Adafruit 16-channel PWM & Servo driver
  Servo test - this will drive 8 servos, one after the other on the
  first 8 pins of the PCA9685

  Pick one up today in the adafruit shop!
  ------> http://www.adafruit.com/products/815
  
  These drivers use I2C to communicate, 2 pins are required to  
  interface.

  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// you can also call it with a different address and I2C interface
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40, &Wire);

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN  600  // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  2400 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

const int buttonPin = 2; //push button attached to this pin

int buttonState = LOW; //this variable tracks the state of the button, low if not pressed, high if pressed

long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers

void setup() {
  Serial.begin(9600);
  Serial.println("Servo Sequence");

  pinMode(buttonPin, INPUT);
  pwm.begin();
  
  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates

  delay(10);
}

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000000;  // convert to us
  pulse /= pulselength;
  Serial.println(pulse);
  pwm.setPWM(n, 0, pulse);
}

void driveServos() {
  Serial.println("Sequence Started");
  // Drive each servo one at a time
    //Start Frame0 Y+
  Serial.println("Starting with Y+");
  pwm.setPWM(0, 0, 2244);
  pwm.setPWM(1, 0, 1491);
  delay(1000);
  Serial.println("Pause While Measuring");
    //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(5000);
    //Frame1 X-
  Serial.println("Moving to X- Position");
  pwm.setPWM(0, 0, 1857);
  pwm.setPWM(1, 0, 1491);
  delay(4500);
  Serial.println("Pause While Measuring");
    //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(8000);
  Serial.println("Moving to Y- Position");
    //Frame2 Y-
  pwm.setPWM(0, 0, 1463);
  pwm.setPWM(1, 0, 1491);
  delay(4500);
  Serial.println("Pause While Measuring");
   //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(8000);
    //Frame3 X+
  Serial.println("Moving to X+ Position");
  pwm.setPWM(0, 0, 1053);
  pwm.setPWM(1, 0, 1491);
  delay(4500);
  Serial.println("Pause While Measuring");
    //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(8000);
    //Frame4 Z+
  Serial.println("Moving to Z+ Position");
  pwm.setPWM(0, 0, 1074);
  pwm.setPWM(1, 0, 1116);
  delay(4500);
  Serial.println("Pause While Measuring");
    //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(9500);
    //Frame5 Z-
  Serial.println("Moving to Z- Position");
  pwm.setPWM(0, 0, 1074);
  pwm.setPWM(1, 0, 1898);
  delay(6500);
  Serial.println("Pause While Measuring");
    //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(8000);
    //Return to Start
  Serial.println("Returning to Start Position");
  pwm.setPWM(0, 0, 2244);
  pwm.setPWM(1, 0, 1491);
  delay(10000);
  Serial.println("Sequence Complete");
    //Stop Servos
  pwm.setPWM(0, 0, 0);
  pwm.setPWM(1, 0, 0);
  delay(6500);
  Serial.println("Ready to Start");
}

void loop() {
    //sample the state of the button - is it pressed or not?
  buttonState = digitalRead(buttonPin);

  //filter out any noise by setting a time buffer
  if ( (millis() - lastDebounceTime) > debounceDelay) {

    //if the button has been pressed, drive the servos
    if ( ((buttonState == HIGH)) ) {
      driveServos();
      lastDebounceTime = millis(); //set the current time
    }
  }
}

Yeeeesh. The SDA jumper was defective. Open Wire.