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.
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.
// 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.