Issues with RDS3218 270 degrees

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.

Thank you! is the myServo.write(angle) the correct syntaxt to move the servo?

Yes, to see the turning range you can simply code:

myServo.write(0);
delay(2000);
myServo.write(180);
delay(2000);

When you find the correct min/max, step back little bit, servo doesn't like to hit the mechanical limits continuously.

do you have any idea why the servo makes buzzing and clicking?

Driven like on post#4 or 1deg steps with delays like on post#1?

like post #1, I couldn't try the #4 yet

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.

ok, I'll let you know! As power supply I'm using the usb transformer that came with raspberry pi, I thought it was a good one...

First try the code.
Capacitor on supply could be option as well.

which one? and how to wire? (I'm a total noob... :sweat_smile: )

First the code, don't try to resolve a problem before you have it :wink:

absolute truth!!! :joy:

Hi, @valeryo
Welcome to the forum.

Can you post some images of your project?
So we can see your component layout.

You do have the gnd of the Nano connected to the gnd of the servo power supply?

Tom.... :smiley: :+1: :coffee: :australia:

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!!! :rofl: For feeding the servo, is it ok to use a 12v to 5v buck converter?

If the buck is rated to >2A, it should be fine. Be aware of chinese ratings though...

I'll check with the multimeter, in that case can I be safe?

Do you have some plan how to do it?