Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Based IR Sensor Alarm with LED Indicator

Image 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

  • Arduino UNO: A microcontroller board based on the ATmega328P. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

  • IR Sensor: An infrared sensor capable of detecting infrared light. It typically has three pins: VCC, GND, and an output signal pin.

  • Piezo Buzzer: An electronic device that emits a tone when it is electrically energized.

  • 9V Battery: A standard 9-volt battery used to provide power to the circuit.

  • Buzzer: A generic buzzer component that emits sound when powered.

  • LED (Red): A two-pin light-emitting diode that emits red light when powered.

  • Resistor: A component that provides electrical resistance. In this circuit, 200-ohm resistors are used.

Wiring Details

Arduino UNO

  • 5V pin connected to the VCC pin of the IR sensor.
  • GND pin connected to:
    • The GND pin of the IR sensor.
    • The GND pin of the Piezo Buzzer.
    • The cathode of the LED.
    • The GND pin of the 9V Battery.
  • Vin pin connected to the "+" pin of the 9V Battery.
  • Digital Pin 2 connected to the OUT pin of the IR sensor.
  • Digital Pin 4 connected to one side of a 200-ohm resistor, which is connected to the PIN of the buzzer.
  • Digital Pin 5 connected to one side of a 200-ohm resistor, which is connected to the anode of the LED.
  • Digital Pin 8 connected to the other pin of the Piezo Buzzer.

IR Sensor

  • VCC pin connected to the 5V pin of the Arduino UNO.
  • GND pin connected to the GND pin of the Arduino UNO.
  • OUT pin connected to Digital Pin 2 of the Arduino UNO.

Piezo Buzzer

  • One pin connected to the GND pin of the Arduino UNO.
  • The other pin connected to Digital Pin 8 of the Arduino UNO.

9V Battery

  • "+" pin connected to the Vin pin of the Arduino UNO.
  • "-" pin connected to the GND pin of the Arduino UNO.

Buzzer

  • PIN connected to one side of a 200-ohm resistor, which is connected to Digital Pin 4 of the Arduino UNO.
  • GND connected to the GND pin of the Arduino UNO.

LED (Red)

  • Anode connected to one side of a 200-ohm resistor, which is connected to Digital Pin 5 of the Arduino UNO.
  • Cathode connected to the GND pin of the Arduino UNO.

Resistor

  • Two 200-ohm resistors are used in the circuit:
    • One is connected between the anode of the LED and Digital Pin 5 of the Arduino UNO.
    • The other is connected between the PIN of the buzzer and Digital Pin 4 of the Arduino UNO.

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.