Hello,
I've built a robot arm that uses four 20kg PWM servos to power each axis. I was using analog servos and everything was working fine, but then I switched to digital servos and now the movement, which was very smooth before, isn't anymore.
The axis, especially the ones with more load, don't rotate smoothly, they rotate just a little bit jerky, and the motor makes kind of a whirring noise, as if it were going through cycles. It kinda ruined the project.
These new digital servos have inside capacitors very close to the circuit. They are more expensive than the analog ones I was using before, so I'd expect them to perform better.
-
I'm powering the servos with an external 5V 8A power supply, so I think enough power isn't the problem.
-
I've run them using the PCA9685 module and the problem's still there. I also believe enough power isn't the problem because with this module there were no soldering or other made connections involved.
-
I've also tweaked the code, running with both faster and slow sample rates, and the problem persists. I'm using writeMicroseconds() in my code. If I put the analog servos back in, they work perfectly, as before.
I'm out of ideas on what could be the problem. Could it be just that these servos are bad? They are the DS3120 270° (https://www.aliexpress.com/item/32482130083.html?spm=a2g0o.detail.1000023.1.5d574f43b9O4Y9)
Below is how I'm powering them. I'm only showing one servo because even when I disconnect the other 3 the problem's still there, so I don't wanna add to it. Couldn't find anything related with a solution on the forum.
I can provide more details and images/videos as needed. Thanks in advance.
EDIT:
I've reduced the problem to something simpler instead of posting the whole project, which has thousands of lines of code. This way it'll be easier to isolate the source.
This is the circuit that I'm using now, and it's running only ONE servo, not four.
This is the code:
(I'm only using the PCA9685 in order to have a solderless connection so we can be sure that's not the problem. In my original project I use the standard Servo library with writeMicroseconds() and the same issue is there)
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define USMIN 700
#define USMAX 2300
#define SERVO_FREQ 50
#define SERVO_NUM 0
void setup() {
Serial.begin(9600);
pwm.begin();
pwm.setOscillatorFrequency(27000000);
pwm.setPWMFreq(SERVO_FREQ);
delay(10);
}
void loop() {
for (uint16_t microsec = USMIN; microsec < USMAX; microsec++)
{
pwm.writeMicroseconds(SERVO_NUM, microsec);
delay(1);
}
delay(500);
for (uint16_t microsec = USMAX; microsec > USMIN; microsec--)
{
pwm.writeMicroseconds(SERVO_NUM, microsec);
delay(1);
}
delay(500);
}
And a video showing the problem:
(Notice how the motion isn't smooth and the motor kinda whines)
Any help is greatly appreciated!
Digital Servo Specs: