The arduino is hooked up to 2 servo motors and an ultrasonic sensor. When I power the arduino uno r3 through the power jack using a 9v battery it behaves incorrectly. It still works but doesn't follow the code. But when I power it through usb using my computer it works correctly. Hence I was wondering why is it different when powered through power jack?
I am powering the arduino with the 9V Rayovac battery through the power jack. The arduino's 5V pin is powering the motors. Everything works fine why I am plugged into my laptop. But arduino's behavior changes when I use the battery.
I wouldn't even suggest running one servo from the arduino 5 volt pin.
Unfortunately both the 9 volt battery and the little voltage regulator on the arduino are not up to the task of
powering servos. You should power the servos with a separate supply (4.8 to 6 volt). The arduino will probably be unstable, reset or have other unpredictable behavior otherwise.
The servos are most likely pushing the limits of the usb port too but this can deliver a bit more current than a standard rectangle 9 volt battery.