Servo Motor not working when used with a 9v battery

I have been making a Arduino door locking system with the Uno R3 set, and I seem to have it all right when the model is plugged in with the USB port but when I remove it and plug in the battery, the motor doesn't work but everything else does.

If you mean the small PP3 style smoke alarm 9v battery then they are completely unsuitable - they can't provide enough current. Try a pack of 6 x AA alkaline cells.

If your servo will work with 4.5v then you could use a pack of 3 x AA cells connected to the servo and to the Arduino's 5v pin (assuming you are using a 5v Arduino). This would save wasting battery power in the Arduino's voltage regulator. It also means that the servo draws its power directly from the batter rather than from the Arduino. Powering motors from the Arduino's 5v pin is a not a good idea as it can overload the Arduino's voltage regulator.

...R

I found that when I used a different brand of 9v battery it worked. I think that since I had so many components to my system the bad battery could only power everything except for the motor. Thanks for the help Robin2.

Arduinoan:
I found that when I used a different brand of 9v battery it worked.

Trust us, it didn't work. The 9V would be falling to 6V or lower as the battery quickly depolarized and self-heated. You might get 10% capacity out of a battery abusing it like that, 9V alkaline batteries are best loaded at 50mA or less, NiMH one's probably good for 200mA.

Servos, even small ones, can pull 1A each.

Would you expect a donkey to pull a truck? Same thing really :slight_smile: