====== 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. ===== Arduino ===== 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 integers returned by the ADC: $V_{sample} = N_{sample}*\frac{ V_{max}-V_{min }}{N_{max}-N_{min} $ Therefore, if you want to convert your arduino's ADC readings into voltages this is the formula you can use: $V_{sample} = N_{sample}*\frac{ 5V }{1023} $