I would like to build a circuit of a microcontroller reading an analog accelerometer, without the use of a voltage regulator. The problem would be that the battery's voltage will gradually decrease with time changing the VCC of the accelerometer and microcontroller.

In this case, the obvious problem when finding the step for the analog to digital conversion:

$$ step = \frac{VCC}{1023} $$

Is that the step is dependent of VCC and will change with it.

Is it possible to do analog to digital conversion with variable VCC?

(The accelerometer is the ADXL377)

  • 1
    \$\begingroup\$ If the accelerometer has a proportional to VCC output (like many strain gauges etc) then converting with respect to VCC is what you need to do. Otherwise, many microcontrollers have an option to reference the ADC to a fixed reference, and most will be able to reference to an external reference. \$\endgroup\$
    – Neil_UK
    Mar 25, 2016 at 12:23
  • \$\begingroup\$ In other words, provide a link to the accelerometer. \$\endgroup\$
    – Andy aka
    Mar 25, 2016 at 12:25
  • \$\begingroup\$ @Neil_UK but VCC will keep changing. How do I keep reading the VCC? \$\endgroup\$
    – Rui Lima
    Mar 25, 2016 at 12:39
  • \$\begingroup\$ You don't need to read Vcc, the accelerometer outputs a proportional voltage, the ADC reads a proportional voltage, VCC cancels automagically! \$\endgroup\$
    – Neil_UK
    Mar 25, 2016 at 12:51
  • \$\begingroup\$ @Neil_UK I see. I basically convert directly from binary to gravity instead of binary to voltage. I don't need to know VCC. \$\endgroup\$
    – Rui Lima
    Mar 25, 2016 at 13:01

2 Answers 2


The ADXL377 has an output that is ratiometric to its supply voltage. Read the data sheet on page 3 and look at note 2 at the bottom of the page.

This means you are in-luck because if the output voltage goes down by 10% due to Vs dropping by 10% then 1 LSb of the conversion remains exactly equivalent to the value of acceleration implied by the device.


Lots of the micro-controllers have internal reference.
You can use this reference to measure against (but than you must use resistor divider so that measured voltage is always lower).
Other way is to measure voltage of MCU itself using trick: measure voltage of internal reference related to Vcc. Because you know value of the reference, you can calculate Vcc. When you know Vcc it is easy to determine correct measured value.
For both ways you should take note that internal reference is precise up to some percentage, so calibration is required.

If yours MCU does not have voltage reference you can use external, such as TL431. You connect it to another pin and measure voltage on it. Then you can calculate Vcc (because voltage on TL431 is constant).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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