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?

  • \$\begingroup\$ How accurate do you need it to be? \$\endgroup\$ – JYelton Feb 7 '14 at 23:29
  • \$\begingroup\$ cAMELcASING mv as Mv is pRobably not a Good Idea... \$\endgroup\$ – Brian Drummond Feb 8 '14 at 10:43
  • \$\begingroup\$ @JYelton: I don't have any requirement, just wanted to know any method making it more accurate. \$\endgroup\$ – iQt Feb 9 '14 at 14:43

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}$$

  • \$\begingroup\$ I agree my equation was as clear as yours. You are right of course and your answer on how to solve this is one possible solution, but Ignacio got a solution that is more preferred to my application. \$\endgroup\$ – iQt Feb 7 '14 at 23:55
  • \$\begingroup\$ Ah, but if you're going to use the internal reference, then you don't need to know Vcc at all! But you can still use the internal reference to measure Vcc without any external divider using my technique. \$\endgroup\$ – Dave Tweed Feb 8 '14 at 0:01
  • 1
    \$\begingroup\$ How can he measure a voltage higher than the ADC reference voltage without an external divider? \$\endgroup\$ – alexan_e Feb 8 '14 at 0:08
  • 1
    \$\begingroup\$ By setting VCC as reference and measuring the reference voltage as ADC input. No external dividers or connection needed. Only by software and internal MCU ADC input selector. I personally did this on AVR and STM32. \$\endgroup\$ – x4mer Feb 8 '14 at 1:02
  • 2
    \$\begingroup\$ @Phataas: The second equation above is the one you need. If you set V_ref to be V_cc and V_unknown to be the internal reference (whose voltage you know), you can solve for V_ref. \$\endgroup\$ – Dave Tweed Feb 8 '14 at 2:23

Use a lower fixed analog reference voltage (e.g. many AVR MCUs have an internal 1.1V reference), and put the supply voltage through a voltage divider in order to reduce it below the reference voltage. This will allow you to measure the reduced supply voltage and get a result that is proportional to it.

  • \$\begingroup\$ I did not think of using the internal reference! This will do. I am using a ARM Cortex M3, but it has an internal reference as well. Thank you. \$\endgroup\$ – iQt Feb 7 '14 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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