PCA9685 PWM Servo Driver Example Zero servo movement

Re: PCA9685 PWM Servo Driver Example Zero servo movement :astonished:

Board Ardino Uno

Servos used : HS311, tested to be working

The Red LED on the PCA9685 is Lit. Board is Powered from ATX 5 Volts

If A4 and A5 are plugged in The Blink stops flashing, (any order)

Servo has Zero movement. (Sweep.ino works direct link to pin 9)

<
*
PCA9685 PWM Servo Driver Example

pca9685-servomotor-demo.ino

Demonstrates use of 16 channel I2C PWM driver board with 4 servo motors
Uses Adafruit PWM library
Uses 4 potentiometers for input ( Not used for testing )

I use default servo port >>. Board 0: Address = 0x40 Offset = binary 00000 (no jumpers required)
Board 1: Address = 0x41 Offset = binary 00001 (bridge A0 as in the photo above)
Board 2: Address = 0x42 Offset = binary 00010 (bridge A1)
Board 3: Address = 0x43 Offset = binary 00011 (bridge A0 & A1)
Board 4: Address = 0x44 Offset = binary 00100 (bridge A2)

Board Ardino Uno

Servos used : HS311, tested to be working

The Red LED on the PCA9685 is Lit. Board is Powered from ATX 5 Volts

If A4 and A5 are plugged in The Blink stops flashing, (any order)

Servo has Zero movement. (Sweep.ino works direct link to pin 9)
*/

// 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(0x41); // Initiates library.

// 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()
{
pinMode(LED_BUILTIN, OUTPUT);
// FAILS TO RUN WITH THIS

pwm.begin();
pwm.setPWMFreq(FREQUENCY);
}

void moveMotor(int controlIn, int motorOut)
{
int pulse_wide, pulse_width, potVal;

// Read values from potentiometer
//potVal = analogRead(controlIn);

for (potVal = 0; potVal < 128; potVal++) {

// Blink code to see if code is running; Yes the Board Ardino Uno LED Blinks

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(500);

// 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);
} // for loop end

}

void loop() {

//Control Motor A Only this Servo port used during testing)
moveMotor(controlA, motorA);

//Control Motor B
//moveMotor(controlB, motorB);

// //Control Motor C
// moveMotor(controlC, motorC);
//
// //Control Motor D
// moveMotor(controlD, motorD);
}
/>

Your code is using 0x41 NOT the default address of 0x40.

And on reasonably recent UNOs, R3 versions you should be using SDA, SCL not A4, A5.

When you say "the board is powered" do you mean Vcc on the PCA9685 board or V+ which is what provides power to the servos.

A schematic would help.

Steve

I got it working by plugging the Uno Board 5 volts into Vcc on the PCA9685 board

When plugging into V+ it failed to function

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.