Voltage divider and battery monitor

Hi, I have recently been learning electronics patterns, specifically the voltage divider as it seems to crop up everywhere.

I would like to use it practically to be able to report to my arduino what battery power remains in my lip-ion battery. The battery has it's own protection circuit and delivers 4.2v when fully charged, nominally 3.7v and cuts off supply when it runs down to 3.2v.

So, my arduino analog pins are rated 0v to 3.3v. I thought what I'd do is build a voltage divider to recieve 4.2v and knock that back to 3.3v, ie the max my analog pin can take. Then, In the code I can use map to get a 0-100 mapped to the input voltage.

I was thinking of setting this up and experimenting to find my voltage dividers output just prior to the battery dying to get the lower value.

Then I made a mental leap. I was thinking that a potentiometer must just be a variable voltage divider! And low and behold I found a YouTube video demonstration this.

So with this in mind I'd like to ask a couple of questions.

One, am I correct in my above understanding.

Two, am I safe using a pot.

Thanks, rick.

You're safe, generally, but you may want to glue the wiper in place, once you've determined the correct ratio.

rickpbush:
One, am I correct in my above understanding.

Yes.

rickpbush:
Two, am I safe using a pot.

Yes. So long as you put it in a place where nobody can see the knob and think, "I wonder what happens if....."

OTOH using two resistors isn't difficult and is a lot safer. You don't have to get it to exactly 3.3V, almost anywhere below that will be fine.

Hi guys, thanks for the reassuring answers. I have built a divider using resistors and it outputs 3.35 when the input is 4.2 i just don't know if half a volt over is going to stress the analog pin, i didn't have exactly the combination of resistors I calculated I needed to hit the ratio spot on is all.

I am also a bit dubious about putting a pot directly between the + and - of my battery. Please could you tell me, theoretically, if I did have a pot connected to the terminals of my battery, if I turned it to 0 ohms, would it short the battery or is it only going to be 0 ohms from the wiper pin but lots of ohms across the in and out therefore providing a safe resistance ? Sorry for my ignorance it's just that the answer to that question will help solidify my understanding

rickpbush:
I am also a bit dubious about putting a pot directly between the + and - of my battery. Please could you tell me, theoretically, if I did have a pot connected to the terminals of my battery, if I turned it to 0 ohms, would it short the battery or is it only going to be 0 ohms from the wiper pin but lots of ohms across the in and out therefore providing a safe resistance ? Sorry for my ignorance it's just that the answer to that question will help solidify my understanding

Why don't you grab a multimeter and find out...?

Lol, I did, as I understand it, if I have a 10k pot then I'll get 10k across the in and out regardless of the wiper position. I guess I knew that anyway looking at how the pot is designed and using my knowledge of voltage dividers. It just worried me is all. Sorry, just needed reassurance.

One last question on this subject, my battery outputs 4.2 peek. So, 4.2 is going to be the largest voltage going into my divider. Lets imagine that for some reason, maybe plugging in to charge or some kind of surge, lets say 4.8 got sent into my divider. By its nature then, the divider would output something higher than 3.3.

Is there a way that I can use some kind of component to limit what can go into my divider to 4.2, some kind of diode or something? Or should I just set my divider to expect say 5v as an upper limit and then adjust my max function to accomodate this?

Are you interested in monitoring the full span of your battery voltage, or just the upper ranges? You probably can use two small diodes in the line going to the pot to limit the max voltage to the analog input pin to 3.4v if the battery voltage spikes to 4.8v. This might also provide better resolution in the battery upper voltage ranges. A 15 turn trim pot might be a better pot option than a typical knob pot.

rickpbush:
if I have a 10k pot then I’ll get 10k across the in and out regardless of the wiper position.

Yes.

rickpbush:
I guess I knew that anyway looking at how the pot is designed and using my knowledge of voltage dividers. It just worried me is all. Sorry, just needed reassurance.

Measure, measure, measure. That’s the secret.

rickpbush:
One last question on this subject, my battery outputs 4.2 peek. So, 4.2 is going to be the largest voltage going into my divider. Lets imagine that for some reason, maybe plugging in to charge or some kind of surge, lets say 4.8 got sent into my divider. By its nature then, the divider would output something higher than 3.3.

Yep. And that’s why I’d aim below 3.3V. Somewhere between 2.5V and 3.0V is good. You’ve got enough resolution on the ADC.

Hmmm...

The analog pins can handle 5v (or 1024 AlanalogRead) so...

why the voltage divider?

The analog pins can handle 5v

Only if the supply voltage is 4.5volts or above.
I don't think we have that item of information.