Arduino UNO Fire Detection and Safety System with Relay-Controlled Water Pump
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit is designed to detect the presence of a flame using a Sensor SHT113 Flame and then activate a series of safety devices including a buzzer, a siren, and a fan. A KY-019 Relay module is used to control the power to a water pump. The Arduino UNO serves as the central controller, reading the flame sensor's output and controlling the relay, buzzer, and fan accordingly. The circuit is powered by two 5V batteries, one for the Arduino and its peripherals, and the other exclusively for the water pump through the relay.
Component List
Sensor SHT113 Flame
- A flame detection sensor that outputs a digital signal.
- Pins: A0 (Analog Output), D0 (Digital Output), GND (Ground), VCC (Power Supply).
Arduino UNO
- A microcontroller board based on the ATmega328P.
- Pins: Various digital I/O, analog inputs, power, and ground pins.
Buzzer
- An audible signaling device.
- Pins: PIN (Signal Input), GND (Ground).
Siren
- A loud noise-making device.
- Pins: Positive (Power Supply), Ground.
KY-019 Relay Module 1 Channel
- A relay module for controlling high power devices.
- Pins: S (Signal), 5V (Power Supply), GND (Ground), NC (Normally Closed), COM (Common), NO (Normally Open).
Water Pump
- A device used to move water.
- Pins: VCC (Power Supply), GND (Ground).
5V Battery
- A power source for the circuit.
- Pins: positive, negative.
Fan
- A device used to create airflow.
- Pins: GND (Ground), 5V (Power Supply).
Wiring Details
Sensor SHT113 Flame
- VCC connected to 5V power supply.
- GND connected to common ground.
- D0 connected to Arduino UNO pin D2.
Arduino UNO
- Vin connected to 5V power supply.
- GND connected to common ground.
- D2 connected to Sensor SHT113 Flame D0.
- D7 connected to KY-019 Relay Module S.
- D8 connected to Buzzer PIN.
- D9 connected to Fan 5V.
Buzzer
- PIN connected to Arduino UNO pin D8.
- GND connected to common ground.
Siren
- Positive connected to Buzzer PIN.
- Ground connected to common ground.
KY-019 Relay Module 1 Channel
- S connected to Arduino UNO pin D7.
- 5V connected to 5V power supply.
- GND connected to common ground.
- COM connected to 5V Battery negative.
- NO connected to Water Pump VCC.
Water Pump
- VCC connected to KY-019 Relay Module NO.
- GND connected to 5V Battery positive.
5V Battery
- Positive connected to Arduino UNO Vin and KY-019 Relay Module 5V.
- Negative connected to common ground.
Fan
- 5V connected to Arduino UNO pin D9.
- GND connected to common ground.
Documented Code
// Define pin numbers
int flameSensor = 2; // Flame sensor input pin
int relayPin = 7; // Relay module control pin
int buzzerPin = 8; // Buzzer control pin
int fanPin = 9; // Fan or LED control pin
void setup() {
// Initialize the pins
pinMode(flameSensor, INPUT);
pinMode(relayPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(fanPin, OUTPUT);
// Initially turn off the relay, buzzer, and fan
digitalWrite(relayPin, LOW);
digitalWrite(buzzerPin, LOW);
digitalWrite(fanPin, LOW);
Serial.begin(9600); // Start the serial communication for debugging
}
void loop() {
int flameDetected = digitalRead(flameSensor); // Read the flame sensor value
if (flameDetected == LOW) { // Fire detected (assuming LOW means detection)
Serial.println("Fire detected! Activating safety devices...");
// Turn on relay, buzzer, and fan
digitalWrite(relayPin, HIGH);
digitalWrite(buzzerPin, HIGH);
digitalWrite(fanPin, HIGH);
} else {
Serial.println("No fire detected.");
// Turn off relay, buzzer, and fan
digitalWrite(relayPin, LOW);
digitalWrite(buzzerPin, LOW);
digitalWrite(fanPin, LOW);
}
delay(1000); // Check every second
}
The code is written for the Arduino UNO microcontroller. It initializes the pins connected to the flame sensor, relay, buzzer, and fan. In the main loop, it checks the flame sensor's output. If a flame is detected, it activates the relay (which powers the water pump), the buzzer, and the fan. If no flame is detected, it ensures that these devices are turned off. The system checks for a flame once every second.