hi, i bought a PCA9685. When i hook it up with my Arduino uno r3 and thepower indicating led lights up but when I connect 4.3 v batteries to the external power plug thingy the power led doesn't light up, i checked the connection and with a multimeter and it showed that the battery is supplying power. Any suggestions on what to do? I have no idea on what's causing it. Another problem related to it is that when i try to verify the example code included in the pca library file this mssg shows up-
In file included from C:\Users\ADMIN\AppData\Local\Temp\arduino_modified_sketch_688686\servo.ino:21:0:
C:\Users\ADMIN\OneDrive\Documents\Arduino\libraries\Adafruit-PWM-Servo-Driver-Library-master/Adafruit_PWMServoDriver.h:26:10: fatal error: Adafruit_I2CDevice.h: No such file or directory
#include <Adafruit_I2CDevice.h>
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any idea on why this is happening and how to fix this. I really need this thing to work for a project I'm making, don't have much time to fiddle around with errors, so please, any kind of help and feedback is appreciated. This is how i connected them, withe only change that i also connected a SG90 servo to pwm port 1
If you mean you are trying to power an Arduino with 4.3V to the barrel jack then it won't work. That input is for 7V plus. If you want to power at 4.3V connect the power to the 5V pin.
No, I was trying to power the PCA9685 board with separate power supply with a 4.5v battery. Arduino was powered from my pc's usb port via Arduino's usb port
Ow so that's why the power LED wasn't lighting up, I thought i burned it or something. Thank you. Btw, I'm planning on using 15 tower pro SG90 micro servos for my bionic hand project, any suggestions on which capacitor i should use with pca9685? Also will a 5.3v 2a dc Samsung charger be enough to provide power for all 15 servos? Any suggestion on that will help a lot, as I'm very much new to these stuffs
No. There is a chance that all 15 might be moving at once and the stall current of a single servo could be as much as 1 amp which could occur if the hand grips an object, for example
I actually don't plan on making it grip something on the event day, only plan on showing it moving like and showing some grip positions as a human hand can. Tho i might need to make it grip something if the judges want. So what kind of power supply should i use without risking damaging the electronic components?
Any power supply that can provide enough current at the required voltage. The fact that a power supply could supply say 20A does not mean that it will supply that much current.
The device that is being powered will take as much current as it needs
SG-90 servos have a stall curent of ~650mA@5volt.
The supply should be able to deliver the total stall current of the 15 servos...
If the supply and/or wiring is not up to that task, then the servos could start twitching.
Leo..
> /***************************************************
> 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 150 // This is the 'minimum' pulse length count (out of 4096)
> #define SERVOMAX 600 // This is the 'maximum' pulse length count (out of 4096)
> #define USMIN 600 // This is the rounded 'minimum' microsecond length based on the minimum pulse of 150
> #define USMAX 2400 // This is the rounded 'maximum' microsecond length based on the maximum pulse of 600
> #define SERVO_FREQ 50 // Analog servos run at ~50 Hz updates
>
> // our servo # counter
> uint8_t servonum = 0;
>
> void setup() {
> Serial.begin(9600);
> Serial.println("8 channel Servo test!");
>
> pwm.begin();
> /*
> * In theory the internal oscillator (clock) is 25MHz but it really isn't
> * that precise. You can 'calibrate' this by tweaking this number until
> * you get the PWM update frequency you're expecting!
> * The int.osc. for the PCA9685 chip is a range between about 23-27MHz and
> * is used for calculating things like writeMicroseconds()
> * Analog servos run at ~50 Hz updates, It is importaint to use an
> * oscilloscope in setting the int.osc frequency for the I2C PCA9685 chip.
> * 1) Attach the oscilloscope to one of the PWM signal pins and ground on
> * the I2C PCA9685 chip you are setting the value for.
> * 2) Adjust setOscillatorFrequency() until the PWM update frequency is the
> * expected value (50Hz for most ESCs)
> * Setting the value here is specific to each individual I2C PCA9685 chip and
> * affects the calculations for the PWM update frequency.
> * Failure to correctly set the int.osc value will cause unexpected PWM results
> */
> pwm.setOscillatorFrequency(27000000);
> pwm.setPWMFreq(SERVO_FREQ); // Analog servos run at ~50 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. It's not precise!
> void setServoPulse(uint8_t n, double pulse) {
> double pulselength;
>
> pulselength = 1000000; // 1,000,000 us per second
> pulselength /= SERVO_FREQ; // Analog servos run at ~60 Hz updates
> 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 input seconds to us
> pulse /= pulselength;
> Serial.println(pulse);
> pwm.setPWM(n, 0, pulse);
> }
>
> void loop() {
> // Drive each servo one at a time using setPWM()
> Serial.println(servonum);
> for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
> pwm.setPWM(servonum, 0, pulselen);
> }
>
> delay(500);
> for (uint16_t pulselen = SERVOMAX; pulselen > SERVOMIN; pulselen--) {
> pwm.setPWM(servonum, 0, pulselen);
> }
>
> delay(500);
>
> // Drive each servo one at a time using writeMicroseconds(), it's not precise due to calculation rounding!
> // The writeMicroseconds() function is used to mimic the Arduino Servo library writeMicroseconds() behavior.
> for (uint16_t microsec = USMIN; microsec < USMAX; microsec++) {
> pwm.writeMicroseconds(servonum, microsec);
> }
>
> delay(500);
> for (uint16_t microsec = USMAX; microsec > USMIN; microsec--) {
> pwm.writeMicroseconds(servonum, microsec);
> }
>
> delay(500);
>
> servonum++;
> if (servonum > 7) servonum = 0; // Testing the first 8 servo channels
> }
The library manager is your first call.
If the library isn't in there, only then you download it manually.
Eliminates the problem that the library ends up in the wrong place, so the IDE can't find it.
Leo..