cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring LIPO battery voltage on ADC pin.

HRawa
Associate II

What can be the range of output voltage i can set at output of voltage divider.

External impedance mention in datasheet is 50kohm. How can i match same impedance at the input of ADC pin while using voltage divider?

There are various values of RAIN mention in table 63 of datasheet.Should i use same values for Resistor Divider?

How much counts i can get on ADC to check level of Battery?

I want to learn all about ADC with reference data of STM32L4 series controller so that i can easily configure and sense battery voltage.

LiPo battery ratings is 3V to 4.2V.

Any reference circuit than please share.

I want to learn exact calculation for ADC.

8 REPLIES 8
AvaTar
Lead

ADC input voltage must not exceed VDDA.

> LiPo battery ratings is 3V to 4.2V.

This means, without divider, you will probably damage the input pin.

> External impedance mention in datasheet is 50kohm.

I don't know the L4 datasheet, but I'm pretty sure this is the maximum.

As a simple rule. the input must be able to fully charge/discharge the S&H capacitor over the input impedance during the configured sample time. View it as a simple RC element.

> How much counts i can get on ADC to check level of Battery?

As always, max_counts * (Vref/Vin). If you stay within range.

Read the ADC section of the L4 reference manual, it explains a lot of said relations.

Danish1
Lead II

Unless you have a high-sided switch, the potential-divider will be a permanent drain on the battery. So naturally you want to make the resistance as high as possible.

But that 50 kOhm recommendation might make you think that you have to arrange the impedance at the junction of the divider to be that value (or lower).

As far as I know, you can work-around the 50 kOhm limit in one of two ways:

1) Use a longer sampling-time.

2) Have a capacitor (say 1 nF) from the junction in the potential-divider to ground. This should maintain the voltage during the sampling phase. This low-pass filter should be fine since the battery voltage won't change rapidly.

Hope this helps,

Danish

Dear Danish,

Thanks for your answer.

For resistor divider.

I need to consider values of both resistor R1 and R2 below 50k to match 50k impedance?

Or i can use higher value of R1 in mega ohm and R2(connected to gnd) below 50k ohm to match impedance. does these work?

How can we consider value of Capacitor? any equation than please share.

AvaTar
Lead

A high-impedance divider network and a low-power, single-supply opamp would do as well.

HRawa
Associate II

Hello Avatar and Danish.

Here i am sharing image with calculation and values of Divider with Vout and Iout.

Also attached same image.

external input impedance of ADC pin is 50k.

Does these values help in matching 50k impedance.

if i am using value of R23 below 50K than does it match external impedance????

I want to restrict current output to micro ampere can i increase R22 value to 10M ohm??

I am more confuse related to term matching impedance or equivalent impedance with both resistors.

If i am wrong in calculation than correct me.

0690X000006CFkWQAW.png

AvaTar
Lead

Your Iout calculation is wrong, you miss a factor of 1000. Would be 30uA, not mA.

For the ADC, only R22 would be relevant for impedance consideration. And I think 100k is already far too large to drive the ADC directly.

Ignoring internal impedance, R22 und the S&H capacitor for a RC element that needs to be charged during the sampling time. Which is not difficult to calculate.

I think you will need an opamp as impedance converter, even for R22 = 100k.

Going up to >1MOhm, you would definitely need to take opamp input leakage and bias currents into account.

Dear Avatar,

It means R22 should be restricted to less than 50K to match external impedance????

I dont want to add more circuit in my design.

Suggest me values of resistor R22 and R23.

AvaTar
Lead

> Suggest me values of resistor R22 and R23.

Your application and your requirements, you need to do it for yourself. The will be a trade-off between accuracy, battery drain, and BOM costs. I can't take responsibility for your design decisions.

Check the "Maximum ADC RAIN" table in the datasheet. For the L431xx, it is table 67 at page 140.

For 12 bit resolution, you don't get below 33k even for the longest sampling time.