# Battery measurement.

Question asked by Leek1001 on Sep 27, 2011
Latest reply on Sep 30, 2011 by Leek1001
Good morning all,

First of all, my project:Measure the voltage, current en temperature with an ADC from the STM32 Value Line Discovery. Sending this data to the computer with UART (RS232). The load on the battery is a switchable resistive load bank with a maximal withdraw of 40A.

Now my problem.The ADC in the STM32F100RBT6B is an 12bit, 16 channels without an Vref pin (package LQFP64) on a STM32 Value Line Discovery board.
How can I measure the voltage of my battery (2*12V = 24V, max specified = 30V).

My thought went out to:
0 – 30V range divide in two different parts (2 channels of the ADC) like:0 – 15V and 15 – 30V, because I need to read the voltage at 10mV accuracy.How to:Vref = VDDA = VDD = 3,3V if I’m right?So if I make two different voltage dividers I could get my specified voltage.

0 – 15V = (10K / (40K+10K)) * 15V = 0V min - 3V max.

15 – 30V = (10K / (90K+10K)) * 30V = 1.5V min - 3V max.

1)

How to solve the second voltage divider?
2)      How to solve the problem with my Vref? I don’t know how its mounted on the board but I think the power supply could effect my readings because Vref and VDDA would change with the power supply.
3) I want to use an voltage regulator for creating an 3.3V-5V or an DC/DC converter for 3.3V-5V. What is the best option? I'm affraid that the pulsed DC/DC supply would create interference on my ADC reading.