Servo Won't Work While The Arduino Is Powered By A Battery Pack

I don't know if this is a problem with the hardware or my code but the servo works while it is powered by the usb port but is i move the power over to a batter pack and power the board with the vin and ground pin the servo stops or spazes. In both instances the servo is powered with the 5v pin on the arduino. Here is the code i have been using. my battery pack is 6 rechargeable AA.

Servo_Controle.ino (336 Bytes)

I don't know if this is a problem with the hardware or my code

It is your hardware.
More specifically your battery, it just is not up to the job.

spazes.

Please do not use that word, it is offensive in certain parts of the world.

In the UK "spastic" is considered by the general population as an offensive way to directly refer to disabled people.

From Spastic - Wikipedia

sorry for that and how can it not work on a 7.2v 1900mah battery pack but it can run on a 5v usb

MR-Turtle:
sorry for that and how can it not work on a 7.2v 1900mah battery pack but it can run on a 5v usb

Your servo is a very demanding load, requiring peak currents to move and hold position.
The USB 5V is sufficient for your purpose to supply the Arduino and servo directly.
BUT when you use Vin you are using a linear regulator on the Arduino board to obtain the regulated 5V. This regulator is not rated to supply the currents required by the servo, causing the Arduino to continually reset and get very little done.
You need a separate 5V regulated supply for the servo.
Tom... :slight_smile:

ok thanks

You could try a capacitor of about 100 to 470uF across the servo's supply pins, but I would not be surprised if it didn't work.