Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
training:measuring_voltage_with_adc [2016/03/27 22:44] kluong created |
training:measuring_voltage_with_adc [2021/09/19 21:59] (current) |
||
---|---|---|---|
Line 9: | Line 9: | ||
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. | 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: | + | 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} $ | ||
- | $V_{out} = \frac{V_{max}-V_{min}}{n} $ | ||
- | $V_{out} = \frac{V_{max}-V_{min}}{2n} $ |