I have successfully used it by modifying it for PCA9685, but when the servos are moving they make noise (like a "grrrr") is there a solution to solve this problem?
same problem using the pin on the arduino nano like the link (using servo.write)
Often, a servo that just makes noise has the signal (yellow or white) wire connect to an Arduino pin but the Ground (black) wire is not connected to the Arduino Ground.
Or maybe you just need better servos. Can't tell much because you have provided no information about what Arduino or servos or code or power or wiring you're using.
hi
thanks at all
the scheme is the adafruit pca9685 connected to arduino nano with SCL, SDA, +5v and GND and the servos ar connected to PCA with 5V separate voltage (but common GND )
this is the code
i have tried both micro servo and standard servo
thanks again
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm0 = Adafruit_PWMServoDriver(0x40);
#define SERVOMIN 205 // This is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX 410 // This is the 'maximum' pulse length count (out of 4096)
#define SERVO_FREQ 50 // Analog servos run at ~50 Hz updates
int servoX_circle= 0;
int servoY_circle= 1;
void setup() {
Serial.begin(9600);
pwm0.begin();
pwm0.setOscillatorFrequency(27000000);
pwm0.setPWMFreq(SERVO_FREQ); // Analog servos run at ~50 Hz updates
delay(10);
}
void loop() {
for(int i=0; i<=360; i+=5){
int x = 40 * (cos ((3.14 * i)/180)) + 90;
int y = 40 * (sin ((3.14 * i)/180)) + 90;
int Pos_servoX_circle= map(x, 0, 180, SERVOMIN, SERVOMAX);
pwm0.setPWM(servoX_circle, 0, Pos_servoX_circle);
int Pos_servoY_circle= map(y, 0, 180, SERVOMIN, SERVOMAX);
pwm0.setPWM(servoY_circle, 0, Pos_servoY_circle);
Serial.println(Pos_servoX_circle);
delay(10);
}
}
hi
sorry, I thought it was enough to describe it.
I have a separate power supply with 5V 2A power supply for the PCA which then supplies power to the servos.
I hope the photo below goes well (i use the arduino nano using SDA SCL correct pin)
no, as I said above I have 2 separate power supplies: one for PCA (5V 2A) and one for arduino nano 5v 1A
about 27Mhz i dont know. i have used the setting found on adafruit site. I don't think it works without it, but tonight I can try.
I also tried at 10, 20, 50, 100, 200 and 1000ms, but (for ex. in 1000ms) for many positions it makes noise and in others it doesn't!
the weird thing is that if I use it without passing values FOR cycle, it works fine with no noise
in my opinion there are values that, when passed close to each other, are make noise
maybe I discovered the error
is it possible that the values go reversed?
pwm0.setPWM(servoX_circle, 0, Pos_servoX_circle);
into
pwm0.setPWM(servoX_circle, Pos_servoX_circle, 0);
setPWM(channel, on, off)
Description
This function sets the start (on) and end (off) of the high segment of the PWM pulse on a specific channel. You specify the 'tick' value between 0..4095 when the signal will turn on, and when it will turn off. Channel indicates which of the 16 PWM outputs should be updated with the new values.
Arguments
channel: The channel that should be updated with the new values (0..15)
on: The tick (between 0..4095) when the signal should transition from low to high
off:the tick (between 0..4095) when the signal should transition from high to low
That doesn't make much sense to me. Why would it go low at 0, before it has gone high Pos_servoX_circle ticks after 0? But then I'm not that good at PCA9685s nor do I understand how your values are supposed to work. What does it do when you try it?
hi
just tried to remove the line pwm0.setOscillatorFrequency (27000000);
and nothing changes without -> so it is useless -> I have removed definitively. thanks
I tried to swap the values by putting (Pos_servoX_circle, 0) but it doesn't work right. I thought that being the first value the saita front and the second value the falling down would go inverted. but I was wrong!
now I don't know what to do
Perhaps this comment in the servo.ino example is important:
/*
* 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 important 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
*/
in fact it could be due to inaccurate frequencies.
in fact I tried to send the values with 2000ms delay and I read them from the terminal. not all of them produce noise, but only some (e.g. 322 makes noise but 325 does not)
i have to see if you can adjust as in the comments of the servo.ino code
I have an old oscilloscope in the basement, I need to see if it still works!
thanks
hi
I recorded the audio of the servo, to make it clear what I'm talking about.
I specify that I have modified the code so as to make the servo go step by step with the above code, but when it arrives at the bottom it returns directly to the beginning.
As you can hear it grates when it goes slowly step by step, but it makes no noise when it quickly returns to the starting position (this noise is the classic servo sound)