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

Arduino UNO Based IR Sensor Alarm with LED Indicator

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based IR Sensor Alarm with LED Indicator

Circuit Documentation

Summary

This circuit is designed to detect a certain condition using an IR sensor and respond by activating a Piezo buzzer and a red LED. The core of the circuit is an Arduino UNO microcontroller, which reads the output of the IR sensor and controls the buzzer and LED accordingly. The circuit is powered by a 9V battery, which is connected to the Arduino's Vin pin for power regulation. The IR sensor is powered by the Arduino's 5V output. The buzzer and LED are connected to digital pins on the Arduino and are activated when the IR sensor detects the predefined condition. Resistors are used to limit current to the LED and the buzzer.

Component List

Wiring Details

Arduino UNO

IR Sensor

Piezo Buzzer

9V Battery

Buzzer

LED (Red)

Resistor

Documented Code

// sketch.ino
int sensorPin = 2; // IR sensor OUT pin connected to Digital Pin 2
int buzzerPin = 8; // Piezo Buzzer pin connected to Digital Pin 8
int ledPin = 5;    // LED anode connected to Digital Pin 5
int sensorValue = 0; // Variable to store the sensor output

void setup() {
  pinMode(sensorPin, INPUT); // Set the sensor pin as input
  pinMode(buzzerPin, OUTPUT); // Set the buzzer pin as output
  pinMode(ledPin, OUTPUT);    // Set the LED pin as output
}

void loop() {
  sensorValue = digitalRead(sensorPin); // Read the sensor output
  if (sensorValue == HIGH) {
    // If the sensor detects the condition
    digitalWrite(buzzerPin, HIGH); // Turn on the buzzer
    digitalWrite(ledPin, HIGH);    // Turn on the LED
  } else {
    digitalWrite(buzzerPin, LOW); // Turn off the buzzer
    digitalWrite(ledPin, LOW);    // Turn off the LED
  }
}

This code is designed to run on the Arduino UNO microcontroller. It initializes the sensor, buzzer, and LED pins, reads the sensor output, and activates the buzzer and LED when the sensor output is HIGH.