Problems with arduino power input & servo motors

Hey people,

This is my first post on here so bear with me...

I have two (continuous rotation) hobby servo motors connected in parallel on a breadboard, and these are powered using the regulated 5v from the arduino.

The problem I'm having is simple but I'm not sure how to correct it...

  1. When i supply the Vin pin on the arduino with 5v (using the green wire) from a lego nxt brick port, the servo motors start to move on their own accord even if the arduino program hasn't told them to.

  2. When I supply the arduino with 9v from a lego nxt brick port, the servo's remain in position like they are supposed to, but one of them doesn't work when the arduino program tells it to move.

  3. When I supply the arduino with 5v via the usb connection port, everything works with no problems... the motors stay in position until the arduino program tells them to move.

However I do not want the robot tethered to the computer hence I would prefer if I could get it to work using either the 5v or 9v supply from the nxt brick, could anyone help with this?

Here are videos of the robot working as it should (using usb power to the arduino).

Thanks a lot for any help you can give.

It's more than the Arduino onboard 5V can provide, you're kicking its butt.
Make a separate supply for the servos to run from.

I agree with Runaway Pancake, but to be more specific, the Arduino 5v regulator can only supply 800ma (according to the datasheet). Many servos can pull 1.5A or more. You should also use a better 5v supply, as well as a fairly nice size capacitor on the power rails of the 5v supply (servos can be extremely noisy).

I'm curious though, how are you getting the 9v supply from the NXT? Did you wire directly into the battery compartment?

mattallen37:
I'm curious though, how are you getting the 9v supply from the NXT? Did you wire directly into the battery compartment?

you have to use the white wire from the nxt port. However in the nxc code you also have to configure the port for sending 9v power i.e. just use setsensorlowspeed command like you would for the ultrasonic. The arduino will only come on when you run the program though.

And thanks for your replies.

I just looked at the data for the motors; they draw between 120mA at no load and 800mA (stall current). Hence in my application I'm probably only drawing about 150 to 200mA. So I could probably just manage using a regular 9v battery for the motors which can supply about 200mA to 300mA... seems like running more than 1 or 2 servo motors is going a bit of a hassle... :-s

Quick question though; is there any reason why it works fine when being powered by usb?

Well, that makes sense then. The NXT sensor port pin 1 can only provide about 20ma, so you are way over-loading it. Hopefully you didn't burn out the transistor.

And about it working with USB... USB devices are usually allowed to pull 500 ma (IIRC), and up to 1A if properly configured.

I'm confusing myself a bit now...... anyways.... I don't think its the data wire of the motor that draws 120mA.. I'm pretty sure they meant the power wires... so now that I think about it... now that I think about it, runaway pancake mentioned the arduino can supply 800mA, hence if both the motors are only drawing about 150 to 200mA, the arduino should be comfortable assuming the current is shared equally between the motors...

Although I suppose all this is guess work at the moment.... I may need to get some ammeters to measure the current or something.... or maybe I'll try using a resistor between the arduino and motors and measure the output voltage with the arduino's adc then calculate the current...

besides the data pin to which the data wire from the motors is connected configured as an output so that's not even an issue...

anyone have a link to the data sheet which says the arduino 5v pin can supply 800mA? I have the data sheets n' the arduino board information but there's nothing about 800mA in any of them, or at least I cant find it :-s

lol sorry it was mattallen who said about the 800mA.....

before I confuse myself anymore....

Summary:

According to mattallen... the 5v regulator can supply up to 800mA.

The servo motors I'm using can draw.... erm... they actually state 2 different sets of values for some reason:
120mA at no load and 800mA at stall, and the second set of value states 110mA at no load and 415mA at stall. So not really sure which one to go with :-s

http://www.active-robots.com/motors-wheels/servo-motors/springrc-standard-continuous-rotation-servo.html

I don't think this applies to the data wire but if it does it would indeed be overloading the data pins on the arduino as mattallen stated earlier... I doubt this though as they would have burnt out long ago since I've been using it as it is for quite a while.

So... I guess for now the easiest thing to try would be to power the motors from a separate supply e.g. a 9v battery.

Here is the datasheet. Scroll down to the 5v one (1117 5.0).

Did you read my second to last reply? I said that the NXT can only supply 20 ma the way you are getting it. That is no where near enough!

Yes, a separate supply should solve the problem.

ohh I see.... thanks matt.

Hi,

Check out the two links in my signature for an idea of whats happening in your project, why you need extra power and how to supply it.

Duane B

rcarduino.blogspot.com

thanks duane, very useful!