Servo moving extremely erratically

For my project I'm trying to power a generic 4.8-6V RC servo (link here) through a 5V buck regulator (link here), itself powered by a 12V wallwart.

I've ensured the following:

  • The servo and Uno i'm using to control it share common ground.
  • A 44uF cap is between Vin and GND on the 5V reg to prevent LC spikes
  • A 100uF cap is between Vout and GND on the reg to stabilize output voltage
  • The reg pushes a max of 1A while the servo was tested to draw only 300mA peak at 5V.
  • The 12V wallwart outputs max 1.2A.

I tried running a simple turn and return code as below:

#include <Servo.h>

Servo thisServo;

void setup() {
  thisServo.attach(10);
}

void loop() {
  thisServo.writeMicroseconds(900);
  delay(3000);
  thisServo.writeMicroseconds(1800);
  delay(3000);
}

this resulted in extremely erratic motion. From what I can observe the servo will hit the 900us position and immediately and rapidly oscillate between 900us and 600us for 3 sec, then move to 1800us and oscillate between 1800us and 600us for 3 sec, and continues looping like that. 600us is roughly the position of the clockwise stop for this servo, and telling the servo to hold any value seems to make it oscillate between that and 600us.

I tried two suboptimal workarounds that appeared to work:

  • Plugging the servo directly to a 5V wallwart works perfectly.
  • Curiously, extending the positive lead of the servo via a 60cm crocodile wire seems to work as well. I discovered this when testing the current draw with a multimeter.

I feel like i'm missing something frustratingly obvious here, but i don't know what. Is this caused by noise from the buck reg? If how how do I mitigate this? Any advice will be welcome.

  • The 12V wallwart outputs max 1.2A.

But not at 12V.

Most likely, the wall wart and regulator combined cannot provide the servo stall current, which the substandard data sheet does not provide.

Use a higher current wall wart, and a buck regulator with higher current capability.

jremington:
But not at 12V.

Most likely, the wall wart and regulator combined cannot provide the servo stall current, which the substandard data sheet does not provide.

Use a higher current wall wart, and a buck regulator with higher current capability.

The wallwart is rated 12V 1.2A max and the regulator at 5V 1A max. A servo drawing 300mA peak at 5V should fall well within their capabilities no? And like I said, a 5V 0.5A wall wart directly connected to the servo works just fine.

I've tried with a 24V wallwart regulated by the same buck reg, the servo is still erratic.

A servo drawing 300mA peak at 5V should fall well within their capabilities no

Of course. But your servos draw more than that. Guaranteed.

a 5V 0.5A wall wart directly connected to the servo works just fine

Problem solved!

jremington:
Of course. But your servos draw more than that. Guaranteed.

I've already shown that the servo works well with a much less powerful power supply than what i'm using. Unless you are trying to tell me the manufacturer falsified the specs, i'm not convinced that current draw is the issue.

And using a 5V source is NOT the solution; it doesn't have enough juice for the other components I'm adding.

Thanks anyway for your help. I'm hooking my setup to an oscilloscope and i'll post back once I (hopefully) figure out the problem.

Unless you are trying to tell me the manufacturer falsified the specs

No one but the manufacturer knows for sure what the specs you quote actually mean, and yes, manufacturers do very often inflate their specifications. Part sellers are worse than the manufacturers, and frequently lie outright about their offerings, especially on eBay.

Nearly every day someone on the forum complains about servo jitter and at least 95% of the time, it is solved by using an adequate power supply.

The answer to your problem is to use an adequate power supply. In this case, that means to use a power supply that is capable of providing TWICE the current that you estimate the parts to draw.

Put 470uf or little bigger after regulators output cap and retest.

jremington:
No one but the manufacturer knows for sure what the specs you quote actually mean, and yes, manufacturers do very often inflate their specifications. Part sellers are worse than the manufacturers, and frequently lie outright about their offerings, especially on eBay.

Nearly every day someone on the forum complains about servo jitter and at least 95% of the time, it is solved by using an adequate power supply.

The answer to your problem is to use an adequate power supply. In this case, that means to use a power supply that is capable of providing TWICE the current that you estimate the parts to draw.

I'm skeptical but I'll take your advice and order a 5V 2.5A buck regulator to try out.

surepic:
Put 470uf or little bigger after regulators output cap and retest.

I'm using a 100uF output cap, but I've tried 470uF and larger caps, no dice.

I ran an oscilloscope test between Vout and GND while the regulator operates. This time I got the servo to hold a constant 900us position (even then it constanly oscillates around the position at about 2Hz).

It would appear I was wrong about the buck regulator being up to task as it has difficulty maintaining the necessary 5V.

Very confused why a regulator rated at 1A is having such a hard time powering a single servo.

The maximum current for a power supply may be a lot more than its maximum load fluctuation tolerance. This is one of several reasons to be conservative in choosing a power supply rating.