Newb Servo woes...

Heya :slight_smile: I'm new to Arduino (and incidentally to this forum - hi everyone!), and I picked up a Duemilanove and a heaping box of different electronic components to play with over the weekend, in order to teach myself how to interface with various types of parts.

When I started playing around with the servo I picked up - a Tower-Pro 5010 - I had less than successful results. I'm hoping to describe my situation here, and try to validate my suspicions about the problem, and find a solution.

I tried using the 'Knob' example that comes with Arduino, and although the servo seemed to respond to the potentiometer input, it seemed to begin moving, stall, and then resume chasing the potentiometer position... repeatedly. I noticed after a while that the LEDs on the Arduino would flash when this occured.

Based on this, I suspect that the servo was drawing too much power from the Arduino and causing a reset. I'm surprised at this, given the fact that I've seen more than one functional video example of people powering a single servo from the Arduino without issues, but the behaviour of the Arduino seems to match that described by people experiencing accidental power-drain related resets on this forum.

From what I've read, the solution to this problem is to provide a separate power supply for the servo. I attempted this last night with a 9v power supply, which (unsurprisingly) fried my servo, but not before the servo went completely nuts, even though the control pin wasn't connected at the time.

This morning I bought another servo, and explained my problems to the guy at the store, who sold me a 5v power regulator chip that should handle up to 1amp of current, claiming that it should allow me to step down the voltage from my 9v power supply in order to feed the Servo. Additionally, he asserted that I'll need to make sure that the ground from the 2nd psu and the servo are all tied to the common ground on the Arduino. I'd really like to confirm these two points in particular, in order to avoid any more blown servos (I can't afford to chew through too many of these things at $15 a pop...!!!)

Am I on the right track here? Is there anything else that I'm missing?

Thanks in advance for any advice!

-T

Well, a single servo should be fine, considering you're pulsing out. So it's not taking more power than like 20 ma every 10 milliseconds (or whatever your delays set to)
With the regulator, Yes it will work. 1amp is plenty enough for the Servo.

But tying the grounds together is one of the most important factors, you can't complete a circuit without a ground. The servo won't receive the right information, or .. act whack, like you're experiencing.

It should work directly off the power of your arduino without any problems, unless it's a huge servo/motor. Never hurts to make sure. If you do use another power supply, that ground has to be connected to the Arduinos as well.

Also, unless it's a continuous rotating servo, the "general" max degrees they move is 180, and I believe you use PWM (analogWrite) to work this out. But I've yet to use any servos.. gonna have to order some offline, the hobby shops here are... an hour drive, and overpriced.
Best of luck, let us know how it works out.

The SG5010 is a fairly hefty servo, and will draw a lot more current than smaller ones. So it could be overloading the voltage regulator.

But it's also a motor, so it dumps a fair amount of electrical noise back into the power supply. Possibly enough to make the CPU operation erratic.

It's always a good idea to run motors off separate power supplies.

Ran

Well, a single servo should be fine, considering you're pulsing out. So it's not taking more power
than like 20 ma every 10 milliseconds (or whatever your delays set to)
The control pin on a servo takes very little current, a few ma at most – no problem for an Arduino pin to drive. It is the servo power line that draws lots of current and even a single standard sized servo can draw more current then the Arduino board can provide.

But tying the grounds together is one of the most important factors,
I second that – forgetting to connect the grounds is one of the most common causes of problems with servos.

It should work directly off the power of your arduino without any problems, unless it's a huge Servo/motor.
As explained above, don't be surprised if a single servo does not work without a separate power supply

Also, unless it's a continuous rotating servo, the "general" max degrees they move is 180, and I >believe you use PWM (analogWrite) to work this out.
No – don't use analogWrite to drive a servo. Continuous rotation servos are driven the same as normal servos using one of the Arduino servo libraries.

timichango - I think you are good to go with that external power source.

hve fun!

Hey all, thanks for all of the replies - very, very much appreciated!!!

Here's my distillation of the advice so far:

  • Separate PSU seems to be the way to go.
  • Could be a noise issue, if it doesn't turn out to be a voltage issue
  • Need to ensure common ground for the external PSU / Arduino

SOooOoOo... I ended up breadboarding up another test using the 'Knob' test, but with the new-and-improved setup: external PSU through the voltage regulator IC, both the GND from the IC and from the Servo going to the common ground rail on the breadboard, which is grounded to the Arduino.

No joy - the servo doesn't even twitch; there's no indication that there's power.

Hooking up the multimeter to the output pin on the voltage regulator, and to the common ground, I get a reading of 4.3 volts. >:( ...looks like it's not spitting out enough juice to 'wake up' the servo, who's specs indicate an operating v range of 4.8v-6.0v. Gah!

Looking up the part number on the IC, it's an L9705CV - which turns out to be a 'negative voltage regulator'. I'm going to go way out on a limb and assume that this means that the regulator is flipping the polarity, but that leaves me utterly confused - if you flip the polarity on the output, wouldn't you end up with two grounds? If someone could clarify this for me, I'd be much obliged!

Furthermore, the wiring diagram on the spec sheet ( here: http://bit.ly/6G49g ) indicates that the pin order is GND/INPUT/ OUTPUT (which is contrary to the instructions given to me by the dude at the electronics shop), but connecting the PSU in that order immediately generates an unreasonable amount of heat, and the output voltage fluctuates wildly. This suggests that the dude at the shop was right, since INPUT/GND/OUTPUT actually gives me a stable voltage at the output, even if it's the wrong voltage.

LOL - and here I was under the misapprehension that servos were supposed to be the easiest motors to deal with... I can't even get mine powered properly ;D

Sounds like you were given the wrong part, the L7905CV is the negative version of the L7805CV voltage regulator.

Can you get it exchanged for the L7805CV ?

Yep, I'm going to try to get it exchanged. If not, it's no big deal - it's only $1 for the part, assuming they have the correct one in stock.

Sooo.... what would someone use a negative power regulator for?!

To produce a regulated negative voltage. Components such as analog amplifiers can require both positive and negative voltages. Figure 5 in the datasheet you linked gives an example of a supply that provides positive and negative regulated voltages

I'm realizing that I shouldn't have skipped highschool as much as I did... I'm feeling pretty confused! What's a 'negative voltage'? I was under the (probably wrong) impression that 'negative' was the same as 'ground'?

I have a feeling that this is turning into polarity 101... ;D

Ground is just really some locally-agreed reference for zero volts.
Relative to another reference, "your" ground could be at hundreds, or even thousands of volts relative to some other circuit.

This is often explained in terms of electron flow or potential difference. You can find many of these explanations on the web. But here is a simplified example:

if you have a battery pack with say two 1.5 volt AA cells and a voltmeter you can see this for yourself. Your pack will have one cell with a positive side sticking out and one side with the negative end, let's refer to the place where the two batteries connect as the 'center tap'.

If you connect the red (positive) lead of the voltmeter to the positive side of the battery and the black (negative) lead to the negative side you should read around + 3 volts . (the batteries are connected together in series)

If you connect the red (positive) lead of the voltmeter to the battery positive side and the black (negative) lead to the center tap you should read around + 1.5 volts.

But if you now keep the black voltmeter lead connected to the center tap and touch the red lead to the negative end of the battery, you will read minus 1.5 volts. This is because the voltage on the negative end of the battery is at a negative potential to the center tap.

Current flowing from the positive side to the center tap will be flowing in the opposite direction to current flowing from the negative side to the center tap.

Say you used this battery to power a small amplifier chip, visualize connecting the positive side of the battery to the chips positive power pin, the center tap to earth, and the negative side of the battery to the chips negative power pin. The battery is providing a positive and negative power source, similar to the regulator circuit in figure 5 referred to in an earlier post.

I hope that helps.

Gotcha - that's some helpful stuff!

I managed to get the L7905CV swapped for the L7805CV, and picked up an L7806CV as well for good measure - hopefully this should sort out the servo... I'll keep you posted!

Servo's working wonderfully with the L7806 - thanks for all the help!

Onwards and upwards...!