Help with PCA9685 and vibration motors

Hey all! So prefacing this in that I am pretty new to both the hardware and the software sides of this thing.

Ultimately my goal on this project is to have 20 vibration motors controllable by a single Arduino in a way that I can vary their intensity separately and make them work in sync. But for now I'm just testing it with a single one to make sure I have things working at base, and of course it isn't.

I'm having two core problems:

  1. I plug the 5V 2A power supply into the barrel jack first, and then plug the PCA9685's 5v into the Arduino. As soon as I do that, the Arduino disconnects from USB, and sometimes I smell a slight burning (but not every time, and I can't actually pinpoint where). I'm guessing this is a wiring problem? Or maybe USB is not powerful enough to power the PCA9685 and I should actually have it plugged in to test?

  2. I am not even sure if this code will work. I know usually you'd use digitalWrite, but since I'm running through PWM with the PCA9685, I'm trying to translate that to the setPWM, and I'm not sure if this is even correct. I know I should probably be using haptic breakouts for this, but I'm really not looking forward to the idea of buying 20 of these at 7 bucks a pop when I feel like the PCA9685 should be able to take care of it?

Here is the wiring setup I have currently, as well as my extra basic test code for this single motor.

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

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
#define ERM_FREQ 50

int ermnum = 0;

void setup() {
  Serial.begin(9600);
  pwm1.begin();
  pwm1.setPWMFreq(ERM_FREQ);

  delay(10);
}

void loop() {
  for(int i; i < 4095; i++) {
    pwm1.setPWM(ermnum, 0, i);
  }
  delay(500);

  for(int i = 4095; i > 0; i--) {
    pwm1.setPWM(ermnum, 0, i);
  }
  delay(500);
}

If you mean the barrel jack on the Uno then it needs at least 7V to work because the input passes through a 5V regulator on the Uno

Use the 5 volt pin instead.

Sorry, I should have clarified; the Uno is being powered only through USB, I'm plugging the power supply into the separate barrel jack that I have wired into the breadboard, which as far as I can tell through my wiring, should only be powering the single ERM coin. Doing it this way because eventually there will eventually be 20 of these coins, so I'm only using the Uno's 5v pin to power the PCA9685, and the 5v2a to power, in this case a single coin, but eventually 20 coins.

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