Hello! Newbie here, and I'm trying to control a RDS3218 270 degrees with a Nano. I'm providing power to servo with a dedicated 3A 5V line, while the Nano is connected to the computer. I move the servo with the myservo.write(angle) commands.
I have two issues:
first one is that the servo is not reaching actual 270° but at most about 240 when I pass the myservo.write(180) command: is this a servo problem or am I doing something wrong?
second one is that the servo makes various noises, buzzing, clicking while not in operation: is it a servo problem or again I'm missing something or doing something wrong?
code is this:
#include <Servo.h>
Servo myServo;
int pos = 0;
void setup() {
myServo.attach(9);
}
void loop() {
// Move from 0 to 180 degrees
for (pos = 0; pos <= 180; pos++) {
myServo.write(pos);
delay(30);
}
for (pos = 180; pos >= 0; pos--) {
myServo.write(pos);
delay(30);
}
}
Try to adjust the pulses manually to find the whole turning range.
Full syntax for servo attach is:
servo.attach(pin, min, max)
where default min is 544 and max 2400.
Try for example: myServo.attach(9, 500, 2500);
You need to increase the max and reduce min until servo hits the mechanical limits and then adjust little bit back.
So update when you have tried.
If you find another power supply, try as well. Amp ratings of cheap supplies are sometimes "very optimistic"... Sometimes simply untrue.
It worked!!! the myServo.attach(9, 500, 2500) worked right out of the box and now the motor spins 270° flawlessly! Thanks kmin!!!
Is there any chance to write a driver to make it command via a computer app? Specifically it would act as an open / close panel to a telescope and it should be commanded by a computer program
That's nice. You are welcome.
I'm sure there is a way to make computer program, but I'm not familiar with the subject.
If I need control out of IDE, I use Esp32 and get wifi/bluetooth control.
Found that too! Tomorrow I'll try to put everything together and I hope nothing explodes!!! For feeding the servo, is it ok to use a 12v to 5v buck converter?