Are potential dividers required to measure voltage?

Hi forum!

Just a quick question.

Is there any advantage of using a potential divider to half the voltage before it is sent to the analogue input, e.g. A0, to be read?

I want to read a li-ion voltage e.g. it will not exceed 4.2V

Thanks guys

Maybe, yes, but maybe not to halve it.

What type of Arduino are you planning to use? The strategy for measuring battery voltage will be quite different depending on the model. Are you using a 5V or a 3.3V Arduino?

If using a 5V, you can power it directly from the Li-Ion through the 5V pin, but as the battery voltage drops, it will quickly become unstable and stop running because most 5V Arduino run at 16MHz and need a minimum of around 4V. You certainly can't run a 5V Arduino with li-ion through the Vin or barrel socket, because the voltage regulator will drop 1.5V leaving only around 2.7V, which won't work.

If using a 3.3V Arduino, it depends on the model. If it's based on an AVR chip like atmega328, you can power the board through the 3.3V input, and it will run stable at 8MHz until the Li-Ion is flat. But 3.3V Arduino based on other chips, like esp8266, would be damaged by 4.2V, so must be powered through their regulators. The regulators on some of these boards will drop 1.5V, leaving you with very short battery life. Some 3.3V boards use low dropout regulators which only drop 0.2V.

So, depending on the model or voltage of the Arduino, you may or may not be making use of a regulator. A benefit of using a regulator is that it provides a stable voltage to use as a reference to compare the battery voltage to. But as the battery gets closer to flat, the output of the regulator may begin to drop and no longer provide that stable reference voltage, making your battery voltage measurement incorrect.

But there is a better way. Most Arduino have an internal reference voltage that can be used to compare your battery voltage to. This will give a more accurate measurement even when the battery is nearly flat.

For example on Uno/Nano/Pro Mini, there is an internal 1.1V reference voltage. It is not selected by default, but there is a function to enable it. To use it, you must use a voltage divider to get your maximum battery voltage down to less than the internal reference voltage. In this example, you need to quarter it, not halve it.

willpowell:
Hi forum!

Just a quick question.

Is there any advantage of using a potential divider to half the voltage before it is sent to the analogue input, e.g. A0, to be read?

Preventing the Arduino being destroyed when measuring > 5V is a definite advantage :slight_smile:

I want to read a li-ion voltage e.g. it will not exceed 4.2V

Thanks guys

I'd add a series resistor of 10k to robustify the thing in case of error. This will also prevent the Arduino
being destroyed if the li-ion was connected while the Arduino was powered off. It will also protect should the
cell be connected the wrong way round.

PaulRB:
Maybe, yes, but maybe not to halve it.

What type of Arduino are you planning to use? The strategy for measuring battery voltage will be quite different depending on the model. Are you using a 5V or a 3.3V Arduino?

Thank you for your thorough answer, but i think you misinterpreted the question.

I want to MEASURE the li-ion battery.

I am powering the arduino using the li-ion but with a boost converter to regulate it to 5V, but don't think that's relevant?

I like PaulRB's recommendation to use a voltage divider to reduce the voltage from the battery to below 1.1V and use the internal 1.1V Vref. That way you have a stable and known analog reference and the voltage divider provides some protection for the analog input. For best accuracy, measure the actual value of the analog reference and use that in your calculations. The internal reference can be between 1.0V and 1.2V, but will not change.

i think you misinterpreted the question.

Not at all. PaulRB explained that the strategy to MEASURE the battery is different, depending on which Arduino you have. You failed to state that in the OP.

Follow Paul's advice for your particular case.

i think you misinterpreted the question... I want to MEASURE the li-ion battery.

No I don't think I did, despite the lack of important details in your question. And you have not answered my questions.

You have now told us that you are powering a 5V Arduino of some kind from the Li-Ion using a 5V "boost" converter. The answer is you don't need a voltage divider in this case. You can feed the battery voltage direct to the analog pin, although given the enormous current that a Li-Ion battery can supply, a resistor would be wise in case of accidental short-circuits, as mentioned by MarkT, and wouldn't affect the reading.

Alternatively, use a voltage divider to reduce the battery voltage down to one quarter (so just over 1V when fully charged, and use the 1.1V internal voltage reference in the Arduino. I think this might be a better solution, since you don't know how accurate the 5V output from the boost converter is.

PaulRB:
No I don't think I did, despite the lack of important details in your question. And you have not answered my questions.

my apologies, i am quite new to arduino and thought you were talking about powering.

PaulRB:
For example on Uno/Nano/Pro Mini, there is an internal 1.1V reference voltage. It is not selected by default, but there is a function to enable it. To use it, you must use a voltage divider to get your maximum battery voltage down to less than the internal reference voltage. In this example, you need to quarter it, not halve it.

i will try this. Thank you

willpowell:
thought you were talking about powering.

I was, but the type of Arduino, how you power it and how you measure the battery voltage are deeply linked.

So.. what type of Arduino are you using, if it's not a secret?

MarkT:
I'd add a series resistor of 10k to robustify the thing in case of error. This will also prevent the Arduino being destroyed if the li-ion was connected while the Arduino was powered off. It will also protect should the cell be connected the wrong way round.

Just to follow up on this, you don't want to supply battery power to a GPIO pin when the processor is powered down, either directly or through a resistor. The resistor will help if that happens accidentally, but you want to design things so everything is switched on and off together. So for example, you would have a switch on the battery output to the boost regulator rather than switch the enable pin of the regulator.

ShermanP:
you would have a switch on the battery output to the boost regulator rather than switch the enable pin of the regulator.

Most boost modules don't often have an accessible enable pin. If you place the switch on the output of the boost module, the boost module will continue to drain the battery even when the switch is off. So that's another reason to have the switch on the battery side of the boost module.

PaulRB:
I was, but the type of Arduino, how you power it and how you measure the battery voltage are deeply linked.

So.. what type of Arduino are you using, if it's not a secret?

Pro mini 5V.

PaulRB:
So that's another reason to have the switch on the battery side of the boost module.

don't want a switch, project requires no option to power down. But it goes to sleep (does not need to measure voltage then). I will use a resistor to get voltage below 1.1V and use voltage ref

willpowell:
I will use a resistor to get voltage below 1.1V and use voltage ref

Two resistors. You need to make a voltage divider. For example 33K and 10K. For 4.2V input, you will get 4.2*10/(10+33) = 0.97V output.