# Powering Arduino and Servo from same 12VDC battery

**URL:** <https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800>\
**Category:** Motors, Mechanics, Power and CNC\
**Created:** [May 5, 2019, 1:54am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800 "2019-05-05T01:54:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brendo311](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@Brendo311](https://forum.arduino.cc/u/Brendo311)\
**Post date:** [May 5, 2019, 1:54am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/1 "2019-05-05T01:54:34Z")

</div>

_ **Solved:** _ see below reply

Issue:  
I'd like to power the following setup with a single 12V battery. Currently this setup only responds to switch inputs when the Arduino is connected through usb. When connected to 12V and pressing a switch. A light onboard comes on but does not change servo position.

Components  
Arduino: Uno R3  
Power Supply: 12V DC 90AH battery  
Voltage Regulator to Servo: Pololu 6V 15A Step-Down Voltage Regulator D24V150F6  
Servo: Power HD 1235MG  
Servo Power Rating: 6.0v@35kg-cm, 7.4v@40kg-cm  
Digital Inputs: 2 momentary switches

Any advice whether it's possible to use the single battery, or what I may be missing?

---

<div class="post-metadata">

**Author:** ![Infraviolet](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/infraviolet/32/1013044_2.png) [@Infraviolet](https://forum.arduino.cc/u/Infraviolet)\
**Post date:** [May 5, 2019, 5:31am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/2 "2019-05-05T05:31:18Z")

</div>

Fit some extra LEDs to the arduino and write some extra stuff into your sketch such that they will blink a bit if things are running, you could have them flash out different morse code like patetrns depending on which parts of the coe are running. This will help you see if the arduino is running properly or managing to just about power on but not do anything else. You will need to say how you are powering the arduino, are you putting 12V into the Vin pin? A full circuit diagram would be easier to advise on than a list of components.

---

<div class="post-metadata">

**Author:** ![slipstick](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@slipstick](https://forum.arduino.cc/u/slipstick)\
**Post date:** [May 5, 2019, 8:09am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/3 "2019-05-05T08:09:52Z")

</div>

Circuit diagram please. A single battery should be o.k. IF everything is connected correctly.

It might also be useful to see the code you're using.

Steve

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2019, 8:34am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/4 "2019-05-05T08:34:06Z")

</div>

Stall current for that servo is 9 Amps, can your battery supply that current?

---

<div class="post-metadata">

**Author:** ![Brendo311](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@Brendo311](https://forum.arduino.cc/u/Brendo311)\
**Post date:** [May 6, 2019, 5:53am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/5 "2019-05-06T05:53:13Z")

</div>

I solved the issue before coming back to check for input. I didn't notice there was a VIN pin on the UnoR3 :-\ doh! Wiring the voltage regulator (which is powering the servo) to the VIN and GND pins on the arduino instead of to the battery was the correct solution. i think it was a grounding issue even with the regulator ground wired to arduino GND. Or possibly the consecutive delay in the setup script.

To answer some of your questions though:  
Infraviolet  
Powering the arduino through 12v battery to the barrel jack. Good idea with the leds. I was only measuring current with multimeter.

slipstick  
May post back a circuit diagram at a later time. Do you have any recommendations on diagramming software for simple circuits?

JCA79B  
Yes, currently using a 12v marine battery and powering the servo from a 6V@\<=15A voltage regulator.

working code for this particular servo (Power HD 1235MG 6.0v@35kg-cm) :

///////////  
#include \<Servo.h\>

const int leftButtonPin = 12;  
const int rightButtonPin = 13;  
const int servoPin = 9;  
const int defaultPosition = 85;  
double pos = 85.0;

Servo servo;

void setup() {  
pinMode(leftButtonPin, INPUT);  
pinMode(rightButtonPin, INPUT);  
servo.attach(servoPin);  
Serial.begin(9600);  
servo.write(defaultPosition);  
delay(1000);  
}

void loop() {  
int leftButtonState, rightButtonState;  
leftButtonState = digitalRead(leftButtonPin);  
rightButtonState = digitalRead(rightButtonPin);

if(leftButtonState == HIGH && rightButtonState == HIGH){  
pos = defaultPosition;  
printInfo();  
delay(200);  
}  
else if(leftButtonState == HIGH){  
if(pos \> 20){  
pos = pos - .4;  
printInfo();  
}  
}  
else if(rightButtonState == HIGH){  
if(pos \< 160){  
pos = pos + .4;  
printInfo();  
}  
}  
servo.write(pos);  
delay(5);  
}

void printInfo(){  
Serial.print(pos);  
Serial.println();  
}  
///////////

Thank you all.

Brendan

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [May 6, 2019, 10:30pm UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/6 "2019-05-06T22:30:53Z")

</div>

> JCA79B:  
> Stall current for that servo is 9 Amps, can your battery supply that current?

90Ah lead-acid battery, sure it can handle 9 amps. The question I'd ask is do you have the right fuses  
to protect the wiring?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 9:50am UTC](https://forum.arduino.cc/t/powering-arduino-and-servo-from-same-12vdc-battery/589800/7 "2021-05-06T09:50:30Z")

</div>


