Saturday, July 1, 2017

3 - Arduino: setting alarms for a Temperature Sensor


- Layout for this exercise:

1 - Introduction

- The goal of this exercise is to trigger 3 alarms when a temperature threshold is exceeded.

- For that purpose an Arduino microcontroller is connected to 4 electronic devices:

a) TMP36: precision temperature sensor that measures the temperature of the environment
b) red LED: blinks when the temperature goes above a limit
c) serial monitor: prints messages on the serial terminal
d) buzzer or piezo element: beeps when the temperature goes above a limit

2 - Code

- This is the code used in this exercise:

3 - Analysis of the code

- The temperature sensor is connected to the input analog A0 pin which converts the voltage output of the sensor to digital values, and finally translating into Farenheit degrees:

- Setting a temperature threshold, three events happen if the threshold is exceeded:

a) a beep of 2000 Hz and 500 ms:

b) a red LED blinks:

c) a warning message is printed at the serial monitor:

- The serial monitor is initialized to 9600 bauds:

- The series of Farenheit temperatures is normally displayed at the monitor, until a warning message (WARNING, VERY HOT !!) is triggered when the temperature goes above 100.00 F:

4 - Testing the circuit

- In this video it can be checked how the 3 alarms (red LED, buzzer beep and monitor message) go off when a hot air jet from a hair dryer is blown over the circuit, increasing the temperature above 100 F: