This project will use a DHT22 temperature sensor that will activate a buzzer alarm once the temperature reaches as specified threshold as well as activate a red LED. If the temperature is below the threshold then a green LED will activate to signify the temperature being in an acceptable range. This project teaches you to develop a temperature alarm, which can be used for pet enclosures, monitoring the heat index/humidity of a room, or for a weather station.
DHT22 Alarm Code (Fahrenheit):
Using the code and illustrations as reference, connect, upload, and open the serial monitor, where you will see the temperature and heat index displayed, updating every two seconds. The following text is a non-fully inclusive list of code adjustments you can make. Note that to show/remove a topic you would remove/add ‘//’ in front of the line without the quotation marks unless otherwise specified.
Show/Remove Celsius Temp.: Lines 48-49
Show/Remove Fahrenheit Temp.: Lines 50-51
Show Humidity (*F): Remove ‘false’ in Line 39, add ‘, false’ (no quotes) on Line 41.
Show Humidity (*C): Remove ‘false’ in Line 41, add ‘, false’ (no quotes) on Line 39.
Show/Remove Heat Index (*F): Lines 56-57
Show/Remove Heat Index (*C): Lines 54-55
Note that the limit temperature can be adjusted by changing the number in Line 60. Note that the given number is in Fahrenheit, to change the number to Celsius, use this calculator. To increase the temperature of the sensor, breathe heavily immediately in front of it and cool it down by either leaving it alone or placing it in a cool environment.