Temperature Warning System with Arduino

Many housewives experienced a case of milk overflowing from the stove that was not closed when the time came. If an alarming system can be made according to the temperature of the milk in the stove, such accidents can be prevented. Thus, kitchen fires can be minimized from waste of energy and resources. In many cases, such as this example, it can be useful in many ways if an audible warning system is created for objects or environments that reach a certain temperature. In this article, we will make an example project for such situations.

Purpose of the project: We will provide audible warning when the temperature and humidity of the environment exceeds a certain level. Through this project, you can design a robotic system that will give a variety of visual and auditory warnings by measuring the temperature of liquids, solids or the environment.

Necessary Materials:

  • Ardunio UNO
  • Dht11 Temperature and humidity sensor
  • 220 Ohm ressistor
  • Buzzer
  • 16x2 LCD Module
  • I2C Module

Project Scheme:

As shown in the diagram above, we use the DHT11 Temperature and Humidity sensor to measure the ambient temperature and humidity. The basic operating principle of the sensors is to supply electricity to the + (plus) and - (minus or ground) poles and to read the required analog or digital values ​​from the signal pin. You can use the DHT11 sensor to measure the ambient temperature. It can be said that the DHT11 sensor works better than sensors like lm35. So you can choose it for environmental temperature and humidity measurements. We added the LCD and I2C module for reading the values ​​from the sensor. In this project we used buzzer module to receive sound alerts. The buzzer module can be used without resistance like above scheme. However, you can use a small resistor such as 220Ohm to reduce the rustling or excessive noise from the buzzer module and to extend the life of buzzer. If value of resistor is too high, you will get lower sound from the buzzer. 

If you have created this schema,  first you must install libraries below if not installed.

Necessary Libraries:

Adafruit Sensor Library

Dht11 Library

LCD I2C Modules Library

If these libraries are already installed, you can install source code to Ardunio.

Source code:

#include "DHT.h"//Including this file from the library in order to use DHT11 sensor
#define DHTPIN 5     // Defining pin 5 for temperature and humidity measurement
#define DHTTYPE DHT11   
#define buzzerPin 3 
#include "Wire.h"// Including this file from the library in order to use I2C module
#include "LiquidCrystal_I2C.h" // Including this file from the library in order to use LCD module
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //LCD module pin definition
void setup() {
void loop() {
  int h = dht.readHumidity();  //Assigning the humidity value to the variable h
  int t = dht.readTemperature();  //Assigning the temperature value to the variable t
lcd.setCursor(0, 0); lcd.print("Sicaklik: "); lcd.print(t); lcd.print("C"); lcd.setCursor(0,1); lcd.print("Nem: "); lcd.print(h); lcd.print("%"); if(h>96 || t>28) //With this if structure, the buzzer will sound when the humidity of the environment exceeds 96% or when the temperature exceeds 28 degrees digitalWrite(buzzerPin,HIGH); else digitalWrite(buzzerPin,LOW); }

When compiling this code, you may receive errors related to libraries. Because the Dht modules, LCD or I2C models you are using are different or some files are required. In these cases, you can install appropriate library files to the components you are using.

What can be done in addition?

  • If you want to warn according to the liquid temperature, you can use liquid temperature sensors instead of the DHT11 sensor
  • With buzzer, you can put visual warning with led next to the audible warning.
  • Using the Sd card module and speaker instead of the buzzer module, you can use pre-recorded sounds as a warning sound.
  • You can change the code after a certain amount of time (for example 1 minute) after the temperature has exceeded.

If you have any other ideas, please don't forget to share them in the comments. Nice codings..

What about solid things temperature?