The TMP36 is a low cost temperature sensor
float voltage = analogRead(temperaturePin) * 5.0 / 1023.0; float temperatureC = voltage * 100 - 50; float temperatureF = voltage * 180 - 58;
analogRead(temperaturePin) | temperature [°C] | temperature [°F] |
---|---|---|
140 | 18.43 | 65.17 |
141 | 18.91 | 66.05 |
142 | 19.40 | 66.93 |
143 | 19.89 | 67.81 |
144 | 20.38 | 68.69 |
145 | 20.87 | 69.57 |
At 5.0V and a 10 bit ADC the resolution is 0.49°C (0.88°F)
float voltage = analogRead(temperaturePin) * 3.3 / 1023.0; float temperatureC = voltage * 100 - 50; float temperatureF = voltage * 180 - 58;
analogRead(temperaturePin) | temperature [°C] | temperature [°F] |
---|---|---|
210 | 17.74 | 63.94 |
211 | 18.06 | 64.52 |
212 | 18.39 | 65.10 |
213 | 18.71 | 65.68 |
214 | 19.03 | 66.26 |
215 | 19.35 | 66.84 |
At 3.3V and a 10 bit ADC the resolution is 0.32°C (0.58°F)