Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino-Controlled IR Sensor Fire Detection System with Buzzer Alert and Water Pump Activation

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled IR Sensor Fire Detection System with Buzzer Alert and Water Pump Activation

Circuit Documentation

Summary of the Circuit

This circuit is designed to detect a specific condition using an IR sensor and respond by activating a buzzer and a water pump through a 5V relay. The system is controlled by an Arduino UNO microcontroller, which reads the sensor data and controls the relay and buzzer accordingly. The circuit is powered by a 9V battery, which is stepped down to 5V by the Arduino to power the components.

Component List

9V Battery

Buzzer

5V Mini Water Pump

5V Relay

Arduino UNO

IR Sensor

Wiring Details

9V Battery

Buzzer

5V Mini Water Pump

5V Relay

Arduino UNO

IR Sensor

Documented Code

#define SENSOR_PIN 2
#define BUZZER_PIN 3
#define RELAY_PIN 4

void setup() 
{
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(SENSOR_PIN, INPUT);  
  pinMode(BUZZER_PIN, OUTPUT);

  Serial.begin(9600);  // Start serial communication for plotting

  digitalWrite(RELAY_PIN, HIGH);  // Ensure sprinkler is OFF initially (HIGH if LOW-level triggered)
  digitalWrite(BUZZER_PIN, LOW);  // Ensure buzzer is OFF initially
}

void loop() 
{
  int sensorValue = digitalRead(SENSOR_PIN);  // Read fire sensor value
  int buzzerStatus = 0;  // Initialize buzzer status (0 = OFF)

  // Sending a series of values (1 through 10) to Serial Monitor for demonstration
  for (int i = 1; i <= 10; i++) {
    Serial.println(i);  // Simulate sensor value changes or other data for plotting
  }

  // Send sensor value for plotting as the first value
  Serial.print(sensorValue);  // Print sensor value for plotting
  Serial.print(" ");  // Separate sensor value and buzzer value with a space

  // Check fire detection and control buzzer/relay
  if (sensorValue == HIGH)  // Fire detected
  {
    digitalWrite(BUZZER_PIN, HIGH);  // Turn on buzzer immediately
    buzzerStatus = 1;  // Buzzer on
    delay(2000);  // 2-second delay before activating sprinkler
    digitalWrite(RELAY_PIN, LOW);  // Turn On sprinkler (relay is LOW-level triggered)
  }
  else  // No fire detected
  {
    digitalWrite(BUZZER_PIN, LOW);  // Turn off buzzer
    buzzerStatus = 0;  // Buzzer off
    digitalWrite(RELAY_PIN, HIGH);  // Turn Off sprinkler (relay is LOW-level triggered)
  }

  // Send buzzer status for plotting as the second value
  Serial.println(buzzerStatus);  // Print buzzer status (0 or 1)

  delay(5);  // Small delay for better plotting resolution
}

This code is designed to be uploaded to the Arduino UNO microcontroller. It initializes the pins for the sensor, buzzer, and relay, and contains a main loop that reads the sensor value, activates the buzzer, and controls the relay based on the sensor input. It also sends data to the serial monitor for plotting or debugging purposes.