Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
training:measuring_voltage_with_adc [2016/03/27 22:55] kluong [Arduino] |
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_{range}} $ | + | $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: | Therefore, if you want to convert your arduino's ADC readings into voltages this is the formula you can use: |