This is an old revision of the document!


Measuring Voltage with ADC

We use an analog to digital converter (ADC) to help us measure analog voltage values. Since a microcontroller is a digital construct, it doesn't understand continuous analog values.

On the Arduino platform, we can measure voltage using the analogRead() function. On the Arduino Uno, the analogRead() function returns an integer from 0-1023.

By default, the Arduino Uno ADC is configured from a range of 0-5v, meaning the whole integer range from 0-1023 represents voltage readings from 0-5v. To convert an analogRead() integer to a voltage reading, you need to do a conversion.

Here is the formula to convert voltage readings, where N is the number of steps in your ADC conversion:

$V_{out} = N_{sample}*\frac{ V_{max}-V_{min }}{N_{total}} $

Therefore, if you want to convert your arduino's ADC readings into voltages this is the formula you can use:

$V_{out} = N_{sample}*\frac{ 5v }{1023} $

  • training/measuring_voltage_with_adc.1459118983.txt.gz
  • Last modified: 2021/09/19 21:59
  • (external edit)