I'm trying to control 4 servo motors with a PCA 9685 driver board, as shown in this video.
However, the motors I have connected don't move.
I'm using the same circuit and code as given there.
Circuit -
Code -
// Include Wire Library for I2C Communications
#include <Wire.h>
// Include Adafruit PWM Library
#include <Adafruit_PWMServoDriver.h>
#define MIN_PULSE_WIDTH 650
#define MAX_PULSE_WIDTH 2350
#define FREQUENCY 50
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// Define Potentiometer Inputs
int controlA = A0;
int controlB = A1;
int controlC = A2;
int controlD = A3;
// Define Motor Outputs on PCA9685 board
int motorA = 0;
int motorB = 4;
int motorC = 8;
int motorD = 12;
void setup()
{
pwm.begin();
pwm.setPWMFreq(FREQUENCY);
}
void moveMotor(int controlIn, int motorOut)
{
int pulse_wide, pulse_width, potVal;
// Read values from potentiometer
potVal = analogRead(controlIn);
// Convert to pulse width
pulse_wide = map(potVal, 0, 1023, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
pulse_width = int(float(pulse_wide) / 1000000 * FREQUENCY * 4096);
//Control Motor
pwm.setPWM(motorOut, 0, pulse_width);
}
void loop() {
moveMotor(controlA, motorA);
moveMotor(controlB, motorB);
moveMotor(controlC, motorC);
moveMotor(controlD, motorD);
}
The power supply I am using is a Li-Po battery giving me 7V that I have connected to the PCA 9685. The power supply is probably adequate since I have used it to drive all 4 motors without the PCA 9685 driver. I have also tried connecting the SCL and SDA pins of the PCA 9685 to the SCL and SDA pins on my Uno as well as the A5 and A4 pins on my Uno but no luck.
I have observed that, even though the power LED on the driver board lights up when I connect everything up, I get 0V between the V+ and GND pins of all 16 channels of the PCA 9685. Is my driver board itself faulty? What else could I be doing wrong?