I want to make a portable data logger. So it should be a battery-powered device. One of tasks that I should do is estimating battery voltage and displaying it but because of the power problem I don't want to use voltage divider and ADC. I'm exploring circuit of a similar device in market. I'm sure that there is no voltage divider with resistors and there is no additional IC in circuit because I explore completely the circuit and I know role of each component in circuit. Microcontroller is stm32f103cBt6.

I can't understand how the device estimate battery voltage without any additional circuitry. How they do that in your opinion?


  • \$\begingroup\$ Voltage is an analog value. You will need some sort of ADC, even if it's not the one built into the MCU. \$\endgroup\$ Oct 7, 2017 at 8:14
  • \$\begingroup\$ "because of the power problem" what do you mean by that? You don't need to measure battery voltage thousands of times per second \$\endgroup\$
    – PlasmaHH
    Oct 7, 2017 at 8:23
  • \$\begingroup\$ You don't have to leave the resistive divider connected all the time, only when measuring. \$\endgroup\$
    – Wesley Lee
    Oct 7, 2017 at 8:30
  • \$\begingroup\$ This question makes absolutely no sense as it stands. The microcontroller has an ADC. From your answer below, it looks like you were really asking how do you calculate a voltage without a reference voltage. And your answer was...you don't. \$\endgroup\$
    – horta
    Oct 12, 2017 at 23:26
  • \$\begingroup\$ Some of the STM32F4's have ADC's in them, however you'd have to keep the voltage under 5v (some of them 3.3V). All you need is a voltage and current measurment. This site is not for opinon questions VTC \$\endgroup\$
    – Voltage Spike
    Oct 13, 2017 at 15:34

2 Answers 2


Thank you for your replies. But I find the solution. There is an internal 1.2v voltage reference in STM32 microcontrollers called 'VREFINT'. This voltage can be measured from channel 17 of ADC1. Reference of conversion is VDDA that is connected to VCC of circuit. So we can calculate VCC of circuit with the value of converted 'VREFINT'.

  • 1
    \$\begingroup\$ ...assuming VCC is connected directly to the battery, but that doesn't actually work very well for many battery technologies. It might (just) work for primary lithium ion though, or 2 flashlight batteries in various chemistries. \$\endgroup\$ Oct 14, 2017 at 6:44

You did not provide a schematic. I will assume that MCU Vcc is battery voltage.

One way (with a divider) is to place a MOSFET next to ground (or use MCU pin to do switching). You turn the FET on when you want to measure the battery voltage and turn off when the divider is not needed.

Another way is to measure MCU internal reference voltage against its Vcc. Your MCU ADC must be able to select Vcc as reference voltage and its internal reference as the input channel. This is the only way that does not require a single external component.

  • 2
    \$\begingroup\$ Re " ... This is the only way ..." -> Dangerous challenge :-). I've seen people use an RC watchdog timer frequency variation with voltage measured by the uC's crystal controlled clock to measure voltage. No more parts than were used for std purposes. Then ... :-) \$\endgroup\$
    – Russell McMahon
    Oct 7, 2017 at 11:03
  • \$\begingroup\$ "...for practical purposes" :-) RC timing depends also on temperature, so it should be taken into account. \$\endgroup\$
    – filo
    Oct 7, 2017 at 13:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.