Go Down

### Topic: Arduino measuring its own power supply (Read 3110 times)previous topic - next topic

#### sinaptik

##### Apr 14, 2012, 03:13 am
I'm using a protected lipo to power an arduino, I'd like to monitor its own power supply. The only way I can think of doing this is with a voltage divider circuit.

Is this safe to do? Is there a better way?

#### RuggedCircuits

#1
##### Apr 14, 2012, 03:18 am
What is the LiPo voltage? If it's not >6V you can't plug it in to the Vin input and get a 5V output (it will always be less than the input voltage).

You can use the voltage divider circuit to measure the battery if you do have a battery >6V into the Vin pin.

--
The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins

#### sinaptik

#2
##### Apr 14, 2012, 03:23 am

What is the LiPo voltage? If it's not >6V you can't plug it in to the Vin input and get a 5V output (it will always be less than the input voltage).

You can use the voltage divider circuit to measure the battery if you do have a battery >6V into the Vin pin.

--
The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins

I'm using a 3s lipo (9v - 12.6v). My main concern is that this would possibly fry the a0 pin via overcurrent.

#### RuggedCircuits

#3
##### Apr 14, 2012, 03:27 am
Nope, it will be fine as long as you choose your resistors right. For a 12.6V maximum voltage, you want to divide that down to 5V so you need a voltage divider ratio of 5/12.6 = 0.4. You can use r1=3.3k ohms and r2=5.1k for a pretty good approximation to that.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

#### sinaptik

#4
##### Apr 14, 2012, 03:31 am

Nope, it will be fine as long as you choose your resistors right. For a 12.6V maximum voltage, you want to divide that down to 5V so you need a voltage divider ratio of 5/12.6 = 0.4. You can use r1=3.3k ohms and r2=5.1k for a pretty good approximation to that.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

Awesome. Thank you very much for your help.

#### ytcat

#5
##### Apr 27, 2012, 08:16 am
How can I measure current in the same circuit?

#### pwillard

#6
##### Apr 27, 2012, 12:21 pm
http://www.sparkfun.com/products/8882

#### MarkT

#7
##### Apr 27, 2012, 01:03 pm

Nope, it will be fine as long as you choose your resistors right. For a 12.6V maximum voltage, you want to divide that down to 5V so you need a voltage divider ratio of 5/12.6 = 0.4. You can use r1=3.3k ohms and r2=5.1k for a pretty good approximation to that.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

If you use 15k and 22k then there's less risk of overloading the input protection diodes if the voltage should stray higher and you'll save about 1mA of supply current.  You can use even higher value resistors but then you'll possibly have to call anaogRead() twice in a row to allow sufficient settling time (if you are measuring other analog pins in the meantime).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### RPCoyle

#8
##### Apr 29, 2012, 02:54 am
Use a 10K trim pot for the 5K resistor, that way you can fine tune the circuit to get exactly the voltage you want.

Go Up