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

Arduino UNO Based IR Sensor Alarm with Piezo Buzzer and LED Indicator

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

Circuit Documentation

Summary

The circuit is designed to interface an IR sensor with an Arduino UNO to detect a certain condition (e.g., presence of an object or a specific signal). Upon detection, the circuit activates a Piezo Buzzer and a red LED as indicators. The circuit is powered by a 9V battery, which is connected to the Arduino's Vin pin for voltage input and GND pin for ground. The IR sensor's output is connected to a digital input pin on the Arduino, and the buzzer and LED are connected to digital output pins. The LED is connected in series with a resistor to limit the current and protect the LED.

Component List

Arduino UNO

IR Sensor

Piezo Buzzer

9V Battery

Buzzer

LED: Two Pin (red)

Resistor (200 Ohms)

Wiring Details

Arduino UNO

IR Sensor

Piezo Buzzer

9V Battery

LED: Two Pin (red)

Resistor (200 Ohms)

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
  }
}

The code provided is for an Arduino UNO microcontroller. It initializes the IR sensor, Piezo Buzzer, and LED pins, and in the main loop, it reads the sensor output. If the sensor output is HIGH, it activates the buzzer and LED, otherwise, it deactivates them.