Powering arduino through power jack

Hello

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?

Should I use a 12V batter instead?

Are you also using the same battery to power the two motors? What type of 9 volt battery?

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.

You MUST use an external power supply for the motors (every kind of motors) because Arduino can not provide enough power for them.

The USB port, as alka said, is able to provide a little more current but still not enough.