Introduction
Hi, today I will teach you how to use Arduino Buzzer Alarm with LDR Circuit, a component used very often with Arduino capable of emitting sounds with different tones. Specifically in this tutorial, the buzzer will emit different tones depending on the light thanks to the photoresistor.
An Arduino buzzer alarm with LDR (Light Dependent Resistor) can be used for a variety of applications, such as a light-sensitive burglar alarm, a warning system for low light conditions, or an automatic light switch. Here is a simple example of how to build a circuit using an Arduino and an LDR to create an alarm with a buzzer:
How LDR works
What is LDR?
An LDR light-dependent resistor is a type of resistor that changes its resistance based on the amount of light that it receives. This type of resistor is unique in that it allows for the sensing of light levels and the control of electronic circuits based on those levels.
In its simplest form, a twilight photoresistor consists of a resistor with a light-sensitive material, such as cadmium sulfide, that changes its resistance when exposed to light. The resistance of the photoresistor decreases as the light level increases, and vice versa. By measuring the resistance of the photoresistor, an electronic circuit can determine the light level and adjust its behavior accordingly.
Pinout of Buzzer
Hardware Required
Components | # | Buy From Amazon |
---|---|---|
Arduino UNO | 1 | Buy Now |
Buzzer | 1 | Buy Now |
Photoresistor (LDR) | 1 | Buy Now |
Potentiometer 10Kâ | 1 | Buy Now |
Jumper Wires | – | Buy Now |
Breadboard | 1 | Buy Now |
Circuit Diagram
Circuit Connection
Place the LDR Resistor and Buzzer on the BreadBoard and connect the Positive Pin of the Buzzer to pin 9 of arduino and the GND pin of the Buzzer is connected to the GND of Arduino.
Connect a 10K resistor to the 5V pin of the Arduino and to it the LDR and a cable that leads to pin A0. Connect the Arduino GND pin to the other leg of the photoresistor.
Arduino | LDR | Buzzer |
---|---|---|
9 Pin | +Ve | |
A0 | Pin-1 | |
5v | Pin-1 with R1 | |
GND | Pin-2 | -Ve |
Installing Arduino IDE Software
First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow
Code
//For More Projects visits: www.arduinocircuit.com
int Buzzer = 9; //The buzzer is connected to digital pin 9
int Photores = 0; //The photoresistor is connected to analog pin 0
int Note; //Variable in which the value of the note is stored
void setup() {
pinMode (Buzzer, OUTPUT); //The pin the buzzer is connected to is set as output
}
void loop() {
Note = 3*(analogRead (Photores)) + 500; //Note calculation
tone (Buzzer, Note); //Writing the note on pin 9
delay(10); //Wait 10 ms before changing note
}
Applications
- Light-Sensitive Burglar Alarm: The buzzer alarm can be connected to a home security system that uses an LDR sensor to detect changes in light levels. When an intruder enters a room, they may turn off the lights, causing the LDR to trigger the buzzer alarm.
- Low Light Warning System: The buzzer alarm can be used to alert you when the light levels in a particular area drop below a certain threshold. This could be useful in a dark hallway, closet, or stairwell where lighting is essential for safety.
- Automatic Light Switch: The buzzer alarm can be used to trigger a relay that turns on the lights when the LDR detects low light levels. This could be used in areas where lighting is needed, such as a garden or a parking lot, and can help save energy by only turning the lights on when they are needed.
- Nighttime Animal Detection: The buzzer alarm can be used to alert you when an animal enters your yard or property at night. The LDR can detect changes in light levels and trigger the buzzer alarm, allowing you to investigate the disturbance.
- Plant Monitoring: The buzzer alarm can be used to alert you when a plant needs more or less light. The LDR can detect changes in light levels, and the buzzer alarm can be triggered when the light levels fall outside a specific range. This could be useful for indoor gardening or monitoring plants that require a specific amount of sunlight.