This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
lab9 [2018/01/25 18:59] narcisa_ana.vasile [Temperature] |
lab9 [2018/01/25 19:00] (current) narcisa_ana.vasile [Voltage] |
||
---|---|---|---|
Line 183: | Line 183: | ||
==== Voltage ==== | ==== Voltage ==== | ||
- | It's interesting to know how the battery is doing. While there is a " | + | It's interesting to know how the battery is doing. While there is a " |
What we do instead is hook up the battery voltage to analog pin A1, and read that. The chip uses an internal reference voltage of 1.6, so we first have to divide down the battery voltage into a measurable range. I am using a voltage divider circuit with a 1M and 470k resistors, so when the ADC pin reads 1.6V, there is actually 5.0V coming in through the battery. Here is a simple schematic to explain: | What we do instead is hook up the battery voltage to analog pin A1, and read that. The chip uses an internal reference voltage of 1.6, so we first have to divide down the battery voltage into a measurable range. I am using a voltage divider circuit with a 1M and 470k resistors, so when the ADC pin reads 1.6V, there is actually 5.0V coming in through the battery. Here is a simple schematic to explain: |