Introduction: Arduino LCD Fire Safety Warning System

This is a student made project which combines the functions of an LCD Screen, a buzzer, an RGB and a DHT temperature sensor.

The current surrounding temperature is displayed and updated on the LCD screen.

The message printed on the LCD screen informs the user of the level of "fire danger" .

The screen dims and flashes to alert the user of danger.

The buzzer becomes louder and faster to alert the user of danger depending on the level of current risk.

The RGB changes green, yellow, orange and red depending on the level of current risk.

Can be put into a 3D printed enclosure for more professional look.

This solves a real world problem of people not knowing when there's is risk of a fire until it's too late

Step 1: Gather Materials

Materials used in this Project:

1x LCD Display

1x DHT_11 Temperature Sensor

1x RGB

1x Piezo Passive Buzzer 1.0v

2x Small Breadboards

3x Standard resistors

1x Normal Sized Breadboard

1x Arduino UNO

Bluetack to lock wires in place.

An assortment of different ended wires, both open ended and single ended.

A device to run the code


Access to a 3D printer if you desire the outer shell and more polished look

Step 2: Setting Up the Breadboards

1. Connect the orange wire from the pin labelled "GND" on the Arduino board and connect it to the negative side (blue) of the breadboard. From this point on, if we need to use GND for any external devices we will simply put them in the same column as this on the breadboard.

2. Connect the red wire from the pin labelled "5V" on the Arduino
board and connect it to the positive (red) side of the breadboard. From this point on, if we need to use 5V for any external devices we will simply put them in the same columnas this on the breadboard.

Step 3: Setting Up LCD Display

1. Flip the board over so it is facing upside down with all the pins on the left side.

2. Connect a wire 5 from the top left on the top row of pins and connect it to pin number 4 on the Arduino UNO.

3. Connect a wire 6 from the top left on the top row of pins and connect it to pin number 5 on the Arduino UNO.

4. Connect a wire 7 from the top left on the top row of pins and connect it to pin number 6 on the Arduino UNO.

5. Connect a wire 8 from the top left on the top row of pins and connect it to pin number 7 on the Arduino UNO.

6. Connect a wire 9 from the top left on the top row of pins and connect it to pin number 8 on the Arduino UNO.

7. Connect a wire 10 from the top left on the top row of pins and connect it to pin number 9 on the Arduino UNO.

8. Connect a wire 3 from the bottom right and connect it to the 5V Row on the breadboard

9. Connect a wire 4 from the bottom right and connect it to the GND Row on the breadboard

SEE IMAGES AS CIRCUIT DIAGRAM SHOWS DIFFERENT LCD

Step 4: Setting Up Piezo Buzzer

1. Connect a wire from the GND pin on the buzzer to the GND column (Blue) on the breadboard

2. Connect a wire from the VCC pin on the buzzer to the 5V column (Red) on the breadboard

3. Connect a wire from the SIG pin on the buzzer to the pin numbered "10" on the arduino UNO board

SEE ABOVE IMAGES AS CIRCUIT DIAGRAM SHOWS DIFFERENT BUZZER

Step 5: Setting Up the DHT Temperature Sensor

1. Set up DHT sensor in breadboard as show above

2. Connect the first pin on the left of the DHT sensor (labelled VCC in the part diagram) to the 5V column (Red) on the breadboard

3. Connect the second pin on the left of the DHT sensor (Labelled DATA in the part diagram) to the A0 port on the Arduino UNO

4. Connect the first pin on the right of the DHT sensor (Labelled GND in the part diagram) to the GND column (Blue) on the breadboard

5. Watch a tutorial and add the dht.h Library found at the end of the instructable to Arduino. (This is mandatory)

Step 6: Setting Up the RGB

1. Place the RGB in a small breadboard as shown above, emphasis on the second leg from the left of the RGB being one slot closer than the other three

2. Place Standard resistors on the first, third and fourth pins. Leaving space for at least one more wire (as show above).

3. Connect a wire from behind the resistor on the left pin of the RGB to the pin Labelled 2 on the Arduino UNO

4. Connect a wire from behind the outlying second from the left pin of the RGB to the GND (blue) column of the breadboard.

5. Connect a wire from behind the resistor on the second from the right pin of the RGB to the pin Labelled 1 on the Arduino UNO

6. Connect a wire from behind the resistor on the right pin of the RGB to the pin Labelled 3 on the Arduino UNO

Step 7: Optional 3D Print Housing

1. Find a tutorial on how to 3D print.

2. Print the below attached design made on Autodesk Fusion 360 (.stl file)

3. Scrape off excess 3D material and smooth over the surface

4. See above picture for guidance on where to place Arduino parts.

Step 8: The Code and Files

-The DHT.h library is attached. (UNZIP)

-The Code with full detailed comments is attached but is also on next step.

-The .stl file for the 3D housing is attached

-The Circuit diagram is again attached. Make sure to refer to the actual steps for the LCD screen and piezo buzzer as different components were used.

Step 9: Arduino Code

//LCD FIRE WARNING SYSTEM
//Reads input from DHT Temperature Pin and depending on if it is hot or not, changes an rgb and speaker to indicate the user if their is danger of fire. //Also displays temperature on LCD screen.

// DHT SETUP

#include <dht.h> // Include the DHT library

#define dht_dpin A0 // Tells the board that the DHT pin is in analog input 0

dht DHT; // dht = DHT

// LIQUID CRYSTAL SETUP

#include <LiquidCrystal.h> // Include the Liquid Crystal library

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //Shorten to LCD / tells arduino which ports the lcd occupies

// DEFINING RGB + BUZZER

#define redpin 1 // Defines redpin of RGB in port 1

#define greenpin 2 // Defines greenpin of RGB in port 2

#define bluepin 3 // Defines bluepin of RGB in port 3

#define buzzerpin 10 // Defines buzzerpin in port 10

// VARIABLE/S

int temp = analogRead(DHT.temperature); // Establishes Integer "temp" which is the value from the DHT.temperature command

void setup() {

// OUTPUT/INPUT

analogWrite(redpin, OUTPUT); // Declare/define redpin as Output

analogWrite(greenpin, OUTPUT); // Declare/define greenpin as Output

analogWrite(bluepin, OUTPUT); // Declare/define bluepin as Output

pinMode(buzzerpin, OUTPUT); // Declare/define buzzerpin as Output

// LCD SCREEN

lcd.begin (16,2); // Define LCD screen as 16 columns and 2 rows }

void loop() {

// LCD CODE WITHOUT VARIABILITY

DHT.read11(dht_dpin); // Read input from dht_dpin also (A0)

lcd.setCursor(0, 0); //Sets curser to Column 0, Row 0

lcd.print("It's "); //Writes "It's " on the LCD screen

lcd.print(DHT.temperature); // Prints the DHT.temperature value from DHT pin on column 0, Row 0

lcd.print(" "); // Prints a space after the temperature

lcd.print((char)223); // prints Degree sign after temperature

lcd.print("C"); // Prints a "c" after the degrees sign to symbolize celsius

// LCD FLASHING

lcd.setCursor(0, 1); // Sets curser to Column 0, Row 1

lcd.noDisplay();

lcd.print("No Fire Danger"); // Prints "No Chance of Fire"

lcd.noDisplay(); // Turns LCD display off (part of flash)

delay(1000);// Stays off for 1 second

lcd.display(); // Turns LCD display back on

delay(1000);// Stays on for 1 second

// RGB + BUZZER CODE

analogWrite(redpin, 0); // No output from red pin

analogWrite(greenpin, 255); // 255 output from greenpin (Makes RGB green)

analogWrite(bluepin, 0); // No output from blue pin

tone(buzzerpin, 20, 20); // // Emits Frequency of 20 hertz for 0.02 Seconds from buzzer

// IF TEMP IS 25-30

if ((int(DHT.temperature) >= 25.00) && (int(DHT.temperature) <= 30.00)) {

lcd.clear(); //Clears LCD Screen

lcd.setCursor(0, 1); //Sets curser to Column 0, Row 1

lcd.print("Small Alert"); // Prints "Small Alert" on Column 0, Row 1

lcd.noDisplay(); // Turns LCD display off (part of flash)

delay(1000);// Stays off for 1 second

lcd.display(); // Turns LCD display back on

delay(1000);// Stays on for 1 second

analogWrite(redpin, 255); // 255 output from redpin (Makes RGB yellow)

analogWrite(greenpin, 255); // 255 output from greenpin (Makes RGB yellow)

analogWrite(bluepin, 0); // No output from blue pin

tone(buzzerpin, 200, 100); // Emits Frequency of 200 hertz for 0.1 Seconds from buzzer

delay(300); // .3 Second delay

} // IF TEMP IS 31-37 else if ((int(DHT.temperature) <= 31.00) && (int(DHT.temperature) >= 37.00)) {

lcd.clear(); //Clears LCD Screen

lcd.setCursor(0, 1); //Sets curser to Column 0, Row 1

lcd.print("Medium Alert"); // Prints "Medium Alert" on Column 0, Row 1

lcd.noDisplay(); // Turns LCD display off (part of flash)

delay(500);// Stays off for 0.5 second

lcd.display(); // Turns LCD display back on

delay(500);// Stays on for 0.5 second

analogWrite(redpin, 255); // 255 output from redpin (Makes RGB orange)

analogWrite(greenpin, 165); // 165 output from greenpin (Makes RGB orange)

analogWrite(bluepin, 0); // No output from bluepin

tone(buzzerpin, 500, 900); // Emits Frequency of 500 hertz for 0.9 Seconds from buzzer

delay(300); // .3 Second delay

} // IF TEMP IS 38-100

else if ((int(DHT.temperature) <= 38.00) && (int(DHT.temperature) >= 100.00)) {

lcd.clear(); //Clears LCD Screen

lcd.setCursor(0, 1); //Sets curser to Column 0, Row 1

lcd.print("Call 000"); // Prints "Call 000" on Column 0, Row 1

lcd.noDisplay(); // Turns LCD display off (part of flash)

delay(250);// Stays off for 0.25 second

lcd.display(); // Turns LCD display back on

delay(250);// Stays on for 0.25 second

analogWrite(redpin, 255); // 255 output from redpin (Makes RGB red)

analogWrite(greenpin, 0); // No output from greenpin

analogWrite(bluepin, 0); // No output from bluepin

tone(buzzerpin, 1000, 900); // Emits Frequency of 1000 hertz for 0.9 Seconds from buzzer

delay(300); // .3 Second delay

}}