Powering Arduino uno and servo from same battery?

First off, I apologise if this has been asked before – I checked the forums as best I could before making a new topic and there were related questions, but I’m a total newbie and couldn’t work out if they were indeed asking the same question or what some of the answers meant! So please bear with me :slight_smile:

My project involves a little servo, and up to now I’ve been powering that separately from a battery, while powering my Arduino Uno via USB. Eventually, I want the project to be self contained and not linked to the computer, so I’m going to need a power source for the Arduino. Can I use the same battery? Putting the battery through Vin and powering the servo from the Arduino board is no good – it upsets other components in the project (like an LCD screen) when the servo moves, which is why I started powering the servo separately. If I connect the battery into Vin and the servo, connect all the grounds, but power the rest of the circuit from the Arduino’s 5v output, will that be okay? I’ve heard tell that the onboard voltage regulator for the Arduino does its business if the supply is between 7-12v, so I’d make sure the battery was appropriate.

I’ve included a Fritzing diagram in case my words don’t make sense… It’s the minimal representation of what I’m talking about: in the finished project I’d connect Arduino’s 5v to the top power rail on the breadboard and other components (potentiometer, LCD etc.) would connect to this.

(Also, the reason I’m keen to use the same battery for both is that space is a premium for the project, and it will be used infrequently for short periods, so I don’t need much juice :wink: Thanks!)

It may be sufficient to power the servo separately, eventually (not normally) also the LCD. Check the allowed servo voltage range! A low input voltage to the Arduino jack is preferable, i.e. 7V are better (produce less heat) than 12V.

DrDiettrich: It may be sufficient to power the servo separately, eventually (not normally) also the LCD. Check the allowed servo voltage range! A low input voltage to the Arduino jack is preferable, i.e. 7V are better (produce less heat) than 12V.

Thanks so much for your quick response!

I was using a 9V battery – and it seems to be in the allowed range for the servo according to the data sheet.

Is it alright to use the 9V battery to power both the servo and the Arduino board, as in my diagram? Or will I break something...

A typical 9V block battery will hardly power a servo, even a LCD display can drain it quickly. Get something more powerful instead (more mAh).

If e.g. a servo will draw 1A (1000mA) in action, it will drain a 1000mAh battery within 1 hour. Fortunately a servo draws less current while only holding a position, so the battery lifetime will depend on your application. Later on you will learn more about power saving techniques, if you want to power a project for a longer time from batteries.

DrDiettrich: A typical 9V block battery will hardly power a servo, even a LCD display can drain it quickly. Get something more powerful instead (more mAh).

If e.g. a servo will draw 1A (1000mA) in action, it will drain a 1000mAh battery within 1 hour. Fortunately a servo draws less current while only holding a position, so the battery lifetime will depend on your application. Later on you will learn more about power saving techniques, if you want to power a project for a longer time from batteries.

Thanks so much for your reply, that's great info and I'll definitely think about getting another kind of battery for future projects!

What I'd really like to know though is if it's okay to plug the same battery into the servo and the Arduino's Vin (like in my diagram). I'm just super scared of somehow frying parts of my Arduino if I connect it up wrong...!

If the voltage is within the acceptable range, you only risk to burn something with a reversed polarity (+/-). The Uno barrel jack (but not Vin!) has a diode, that prevents damage from such a failure, but the servo may not be protected this way.

If you connect one battery contact to Gnd, as is always required, you can measure the voltage of the other contact against Gnd. If that voltage is positive, everything is fine. But take care for the small '-' indicator on the DMM!

You also can put a LED and 1k resistor on your breadboard, so that it glows if its open end is connected to 5V. Then you can test the other power sources, after connecting one contact to the common Gnd. In an even more sophisticated approach you can add another LED in anti-parallel to the first LED, so that it glows when the polarity is negative. If both LEDs are on at the same time, the power source is AC. Neat, huh?

DrDiettrich: If the voltage is within the acceptable range, you only risk to burn something with a reversed polarity (+/-). The Uno barrel jack (but not Vin!) has a diode, that prevents damage from such a failure, but the servo may not be protected this way.

If you connect one battery contact to Gnd, as is always required, you can measure the voltage of the other contact against Gnd. If that voltage is positive, everything is fine. But take care for the small '-' indicator on the DMM!

You also can put a LED and 1k resistor on your breadboard, so that it glows if its open end is connected to 5V. Then you can test the other power sources, after connecting one contact to the common Gnd. In an even more sophisticated approach you can add another LED in anti-parallel to the first LED, so that it glows when the polarity is negative. If both LEDs are on at the same time, the power source is AC. Neat, huh?

That's really interesting, great tips! I'll have to try, thanks