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

Arduino UNO Based IR Sensor Alarm System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based IR Sensor Alarm System

Circuit Documentation

Summary

The circuit consists of an Arduino UNO microcontroller interfaced with an IR sensor, a buzzer, and a red two-pin LED. The IR sensor is used to detect the presence of an object, and upon detection, the Arduino activates the buzzer and the LED to signal that an object has been detected. The circuit is powered by the 5V output from the Arduino, and a common ground is shared among all components.

Component List

Arduino UNO

IR Sensor

Buzzer

LED: Two Pin (red)

Wiring Details

Arduino UNO

IR Sensor

Buzzer

LED: Two Pin (red)

Documented Code

// Code for Arduino UNO
int sensorPin = 2;    // IR sensor pin
int ledPin = 3;       // LED pin
int buzzerPin = 4;    // Buzzer pin

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

void loop() {
  int objectDetected = digitalRead(sensorPin);  // Read the sensor value

  if (objectDetected == LOW) {  // Assuming LOW means object detected
    digitalWrite(ledPin, HIGH);  // Turn LED on
    digitalWrite(buzzerPin, HIGH);  // Turn Buzzer on
  } else {
    digitalWrite(ledPin, LOW);   // Turn LED off
    digitalWrite(buzzerPin, LOW);  // Turn Buzzer off
  }
}

The code is written for the Arduino UNO and is responsible for reading the output of the IR sensor. When the sensor detects an object (signaled by a LOW reading), the Arduino turns on the LED and the buzzer. When no object is detected, the LED and the buzzer are turned off. The setup() function initializes the pins, and the loop() function contains the main logic that is executed repeatedly.