In this post, we will analyze the simple Arduino circuit below that has a temperature sensor type TMP36 and a red LED used for debugging purposes:
Below some of the characteristics of this TMP36 sensor:
- 3 pins: 1xVin (LEFT), 1xVout (MID), 1xGND (RIGHT)
- Vin range: [2.7V .. 5.5V]
- Temperature range: [-40°C .. 150°C]
- Accuracy: ±1°C
- Analog Output signal range: [0.1V .. 2V]
- Baseline: temperature of 25°C outputs 0.75V
The code used in this example is on github and it is divided into 3 main sections:
1. declaration and initialization of global constants and variables
2. setup routine: Definition of pin modes, analog reference (in this case an INTERNAL reference of 1.1V built-in Arduino's PCB was chosen), open Serial communication for debugging/callbacks.
3. loop routine: reading and averaging analog input values, limit checking, analog to digital conversion with 10bit resolution, calculation of temperature using formula above
Results from Serial prompt:
No comments:
Post a Comment