Servo just stutters

I’m trying out three new servos I just got, the TowerPro MG996R.This one
Suposed to run on 5- 7,2 V.

I hook the servos up to a 9 volt supply (6 AAA batteries in series) through a 5v output voltage regulator (L7805C), and run the “Sweep” example program from the Arduinos examples.

The first one I tested started making choppy sounds for about 20 seconds, then executed 2-3 sweeps, then started chopping again. The ones I tested after that just went for the choppy sounds.

Just to make sure it wasn’t the servos that was faulty I also tested one from a completely different batch, and it did the same thing.

This is the first time I try servos, and I’m sure I do some very basic mistake, but I’m at a loss.

This, by the way, is the “sweep” code:

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
}

Thankful for any ideas!

Your power supply is totally inadequate for those high torque servos.

4xAA batteries can handle at most two lightly loaded ordinary hobby servos, and the 7805 voltage regulator can handle at most one ordinary servo.

You will need a much beefier supply, say a 4.8-6 V NiMH C cell battery pack capable of several amperes.

I see. I figured as much, so I tried changing the battery for a 12 v transformator. Still through the same voltage regulator though. Didn't work. Same result. So now Ill just try finding a power source right for the job. I dont want to use batteries though, since the finished project will be for home automation.

Any suggestions on how to best solve the power supply through the AC 220 V in my home?

A 5-6V, 3-5 ampere power supply is what you need for those servos. Power bricks for LCD monitors can be found with those characteristics.

You might find something like a 19v laptop external power supply and use UBEC voltage regulators (which are made for use with servos).

I use this, pulls 4 servos OK.

(http://“http://“http://www.amazon.com/gp/product/B005T6UJBU?keywords=power supply mean””)

Thanks for the great replies guys.
How about this little bad boy right here:
LM338K

Would that work as a voltage reg?
Also, beeing a noob in the field of electronics and barely beeing able to remember my high- school-physics: is there a good and simple way to calculate the amount of current needed for servos like these, given the information on the web store?

Don't use linear regulators for power, its a waste and frankly a pain to cool. Use a 6V supply if possible, failing that get a DC-DC converter if you have no other option. 4A though a linear regulator dropping 12 to 6V means 24W to throw away...

is there a good and simple way to calculate the amount of current needed for servos like these, given the information on the web store?

Yes, check the data sheet. It lists the stall current as 2.5 amperes (and the servo will momentarily draw that when starting up) with [u]typical running current[/u] up to 0.9 amperes.

If all servos are be moving at the same time, with heavy loads, the power supply draw could go over 5 amperes. I would chose a power supply capable of at least 5 amperes, but you could probably get away with 3 amperes.

UBEC regulators:

http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&LH_BIN=1&_nkw=UBEC&_sop=15

MarkT: Use a 6V supply if possible,

6V would be great but 5V also works well. It might be easier to find a high current 5V supply than finding a similar 6V supply.

If you have to use a DC-DC converter, you might want to consider one of these.

I don't claim they're better than other switching regulator options but they seem to work well on my hexapod.

That is an impressive little beast!

Also the cheap LM2596 DC-DC converters claim to do 2A and might be enough (one per servo): http://www.ebay.co.uk/itm/5pcs-LM2596S-DC-DC-Buck-Converter-Adjustable-Power-Supply-Step-Down-Module-UK-/141210161794?hash=item20e0c81282:g:RFgAAOxyUylTTmY2

(Assuming they actually do work at the rated 2A ?!)

MarkT: Also the cheap LM2596 DC-DC converters claim to do 2A and might be enough (one per servo):

I have a bunch of these myself and they're usually good for two servos as long the servos aren't being taxed severely.

jremington: That is an impressive little beast!

I kept reading horror stories about voltage regulators going up in smoke when used to power servos on a hexapod. Apparently hexapods have been responsible for the death of many LM2896 regulators.

I decided to use two of those 15A regulators on my hexapod.

|481x500

I didn't think the MAX7219 drivers would tolerate 6V so I set the regulators to 5V (maybe 5.1V). I set both regulators to 5V so the servos would be uniformly powered.

I used the regulators I did because they were relatively inexpensive for the amount of current they could handle. I imagine there are more expensive options which wouldn't be so bulky.

This guy is using PTN78020WAH regulators with his hexapod. The regulators are about $26 each at DigiKey and can source 6A. The regulators are nice and small but they're too expensive for my hobby robotics budget.

In the now deleted Let's Make Robots thread (I hate RobotShop), I debated with Nemesis about the need for voltage regulators in his hexapod. The servos he's using are designed to be powered from a three cell LiPo/Li-Ion. Gordon McComb convinced me you're almost always better off not using a regulator to power motors and servos. If your servos can take the voltage of a direct connection to a battery, then so much the better. Gordon thought the servos I was using would tolerate a 2S LiPo but many of the servos would shake at the higher voltage. At least they didn't go up in smoke when powered from a 2S LiPo. I smoked a couple servos on my Popsicle stick hexapod trying to power the HXT900 servos with a 2S LiPo.

If someone finds inexpensive servos which work well from a 2S LiPo I hope they let us know about them.

Edit: While you generally don't want to have to use a DC-DC regulator with high current loads, there are times when these regulators are very useful. I was attempting to make an inexpensive robot perform a figure 8 but I couldn't get the speed and timing setting right because the battery voltage was constantly changing. Once I added a LM2896 regulator, the robot's speed became very consistent.

So if you're manually controlling the robot arm, you don't need to worry about the changing voltage levels as the batteries drain. If you want to program the arm to move in a repeatable manner, then using well regulated voltage is a good idea.

In the now deleted Let’s Make Robots thread (I hate RobotShop),

Just took a look at the Let’s Make Robots Forum. With 3 posts in the last 3 days, it seems to have died a rather complete death!