LDR and Buzzer Interface to Arduino Uno

by rammy2203 in Living > Education

3722 Views, 2 Favorites, 0 Comments

LDR and Buzzer Interface to Arduino Uno

1.png

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.

FFOOMB4J6QQO5L8.MEDIUM.jpg
F5N1Z4HJ6QQO5PG.MEDIUM.jpg
F4NJOX4J6QQO5QB.MEDIUM.jpg
F2HXVHWJ6QQO5PI.MEDIUM.jpg

FQ2X2M5J6QQO5SO.MEDIUM (1).jpg
F5OP10XJ6QQO5SR.MEDIUM.jpg
FY4IE5UJ6QQO5UZ.MEDIUM (1).jpg
FOUZC94J6QQO5V1.MEDIUM (1).jpg
FIRQWP6J6QQO5WR.MEDIUM (1).jpg

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.

Buzzer Connection

F7H5ONXJ6QQO5WS.MEDIUM.jpg
FQ9HT35J6QQO5Y7.MEDIUM.jpg
FEH3J1CJ6QQO5ZD.MEDIUM.jpg

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.

Coding

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

Output

Ldrbuzz