Electronic – Use microcontroller to measure the microcontrollers voltage

microcontrollervoltage measurement

When using an Analog to Digital Converter (ADC) I want to convert to millivolts (mV) afterwards. My microcontroller is running on 3.3V, but I want to measure more accurately to get better result.

$$mV = \frac{adcData}{2^{12}} * V_{cc} * \frac{1}{1000}$$

Vcc is ideally 3.3V, but I want to measure it.

Is there any way to do this, except measuring the voltage with a multimeter on the board directly?

Best Answer

Your equation is a bit confusing. I would write it as:

$$V_{unknown} = \frac{ADCreading}{2^{12}} V_{ref}$$

where Vref is your microcontroller's supply voltage.

In other words, you have to know one voltage in order to measure the other. You either know a priori what Vref is, and calculate Vunknown from that, or you can connect Vunknown to a calibrated standard and solve the equation for Vref:

$$V_{ref} = \frac{2^{12}}{ADCreading} V_{unknown}$$