UNO - servo not working when uno is powered by barrel connector

This is my circuit - I am simply trying to power an SG90 servo from the uno. When connected to my computer via USB, everything works as expected. When I replace that with a 9V battery connected via the barrel connector and a 9V-1A adaptor cord, the servo acts weirdly.

When I use a program which should make it turn 90 degrees one way, then the other and repeat, it instead rotates continually in one direction (weird since the SG90 should only be able to rotate 180 degrees). When I use a program which tells it to do a certain movement upon receiving a signal, it just kind of twitches in the direction it should move then back to 0.

I've measured some voltages. The USB gives about 4.6V out of the 5V pin. Using the barrel connector with battery gives about 3.9V out of the 5V pin. The battery itself, although it's a 9V battery and new, gives 7.3V. I thought this may be the reason but I also tried running it from the Vin pin - here I got still about 4.6V with the USB (and it still worked) and about 5.2V with the battery.

I don't think the code itself is relevant but I can post it if anyone wants. Thanks for any help.

Let me guess

You are using a PP3 9V battery designed to power a smoke detector with low current that cannot supply enough current to drive the servo and the Uno

To make it worse you are powering the servo directly from the Uno rather than from an external power supply. The Uno is not designed to power external devices beyond sensors and the odd LED or two

Two errors:

  • the 9V battery is too weak for the servo
  • the on-board 5V regulator is overloaded by the voltage difference and servo current.

Use a suitable power supply for the servo. It can be used to power the Arduino as well, but not the servo from the Arduino.

The battery I'm using is the one provided with the elegoo super starter kit. But thank you for your advice about powering it from a separate source, I hadn't realised that was something I needed to do.

Thank you appreciate your advice. Best off ordering a separate 5V battery then?

What do you mean that the 9V battery is too weak if the servo only requires 4.5V? And can't the 5V regulator handle 8-20V inputs?

Apologies if these are stupid questions, very new to this as I'm sure you can tell.

A power source has to supply not only voltage but also current. Power = voltage * current.

Which is a PP3

image

and totally unsuitable for the purpose

power = (V^2)/R. With the same circuit and ignoring internal resistance, power is solely dependent on voltage.

So what would be suitable for the purpose?

I've also tried running the servo from a USB - I can confirm the USB is outputting 5.2V, yet when I run the servo from it (with the arduino still powered by the computer) it doesn't behave at all as expected. I've read that the servo has input voltage of either 4.8V or 6V - does this mean a voltage in between these levels will not work?

Did you forget to connect the grounds of the USB power thingy to the Arduino Uno ground?

Also, the Uno is not a proper power supply for motor power.

and somewhat dependent upon the batteries ability to store a sufficient charge to run a motor.

What? P = V^2/R, simple as. Current is simply a function of voltage and resistance. 9V is 9V, regardless of the source.

The only thing that would make a difference is the internal resistance of the battery - if the servo runs at low resistance and high current, it's may drain enough volts to move the servo out of the operating range

OK. Well let us know how you fare with using a 9V battery. Best of luck.

Power also is I²*R. Math games do not help here.

Total battery energy is typically measured in mAh, regardless of their voltage. The power in your project also means the heat generated and dissipated by the voltage regulators that makes them overheat and turn off.

Powering the Uno with 5V through the USB connector sure looks pretty good right about now. It works and it also takes advantage of the 500mA resettable fuse.

You are ignoring the internal resistance of the battery. I don't know what it is for a typical 9V battery but I do know it is significant in relation to the current drawn by your motors. The EMF from the battery might well be 9V, but the voltage at its terminals will not be while attempting to power your motors. Try measuring the voltage while your motors are powered.

mAh is a measure of charge, not power. Power is I^2 * R but I is purely a function of input voltage and resistance - v^2/r is the useful equation. If I can't get enough power for a 5V component out of a 9V battery, it's because of internal resistance.

High current does explain why the voltage regulators were failing at lower than rated voltage though so thank you for that.

Yeah this is the conclusion I've come to, thank you very much. I'm powering the servo with a 5v USB from a power bank now, works great.

I've been told you should generally attempt to keep power source separate from arduino, what do you reckon to that?