## Introduction: LDR and Buzzer Interface to Arduino Uno

Hey, peeps!! I'm back with another ibles.In today's project, I am teaching about the basic principle of a security system installed in the bank system.we know that light has got many uses, We being an electronic hobbyist have made an alarm out of it.If there is any absence or reduction of light around a sensor the buzzer pings.this can be achieved using a light dependent resistor or LDR.Seems interesting ??

Let's now start gathering electronics.

## Step 2:

The LDR is also called as a light sensor that gives out a control signal to the Arduino Uno when the light around its surface decrease and it's very cheap. it is a light controlled variable resistor, the resistance of the resistor will decrease with the increasing incident light rays.It varies from few hundred ohms to mega ohms purely depending on light

LDR has no terminal or polarities dis-similar to other sensors available in the market.

We have used a 10kohm resistor to the LDR.

The connection of LDR is as follows:

• One leg of the LDR is connected to the A0 pin of the Arduino since it is analog in nature and the same leg is connected to the ground via a 10k ohm resistor.
• Other leg is connected to the Positive supply i.e 5v Pin of the Arduino.

## Step 3: Buzzer Connection

A Buzzer is an electronic sound machine that converts the electrical impulse sent by the input device and converts them into sound energy.

The buzzer which I have used here has two wires in red and black color.

The connection of buzzer is as follows:

• The buzzer positive or red wire is connected to the digital pin 3.
• The buzzer negative or negative is connected to the GND pin of the Arduino.

## Step 4: Coding

```const int buzzerPin = 3;const int ldrPin = A0;
void setup () {
Serial.begin(9600);
pinMode(buzzerPin, OUTPUT);
pinMode(ldrPin, INPUT); }
void loop() {
if (ldrStatus >= 400) { tone(buzzerPin, 100);
delay(100);
noTone(buzzerPin);
delay(100);
}
else {noTone(buzzerPin);
}```