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:
-
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?
-
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);
}