Introduction: Buzzer Alarm Using LDR and Arduino

Hello Guyz

I Wanted To Build A LDR Buzzer And Got Many Instructables Which Were Using Transistors To Do This Project.

So I Bulid This Project With The Help Of Arduino Which Many People Have.

Just Follow The Steps And You'll Get Your LDR Buzzer Ready Within 5 Minutes!

Step 1: REQUIREMENTS

So,For Making This Project You Need A Couple Of Things Which Are Described Below:-

1. 1 X Arduino (UNO/MEGA/NANO)

2. 1 X Piezzo Buzzer

3. 1 X 470k Resistor

4. 1 X Breadboard

5. 1 X LDR

6. Some Wires

Step 2: Wiring

Just Follow The Fritzing Diagram And Do The Wiring As Described In The Image!

You Will Get Your LDR Buzzer Circuit Ready In A Couple Of Minutes!

Step 3: CODE

Here's The Code Which You Have To Upload To Your Arduino :-

int rcvpin=A0;
int buzzpin=9;

void setup()

{

pinMode(rcvpin,INPUT);

pinMode(buzzpin,OUTPUT);

buzz(200);

buzz(200);

buzz(200);

delay(2000);

Serial.begin(9600);

}

void loop()

{

int ldrval=analogRead(rcvpin);

Serial.println(ldrval);

if(ldrval>=900)

{

buzz(50);

}

}

void buzz(unsigned char time)

{

analogWrite(buzzpin,170);

delay(time);

analogWrite(buzzpin,0);

delay(time);

}

Step 4: FINISHED!

Upload The Code And BOOM! There You Go!

You Just Made Your LDR Buzzer Without Any Hassles!

Congrats!

Comments

author
Respecttheboss47 (author)2016-06-02

Is it possible that I can hook up a flashing light. If so what code should i use

author
Perigrinus (author)2016-04-20

Will it work with a 10k ohm or a 330ohm resistor?

author
jpinto orduz (author)Perigrinus2016-05-28

Yes, the difference is how sensitive is gonna be the LDR

author
johnstallone1 (author)2016-02-26

can it work for a 220 ohm resistor

author
aramaic made it! (author)2015-01-13

Great Work !!! Very Simple and easy . If implemented can save you a lot of money for day/night control of light or heat. Thank you

20150113_152802.jpg
author
MsSweetSatisfaction (author)2014-08-30

Cool! You did a nice job explaining your process. Thanks for saying!

About This Instructable

19,824views

17favorites

License:

More by abhirooprobotics:Arduino Temperature and Humidity on 7 Segment DisplayMains Hum Detector / Static Electricity DetectorArduino Temperature and Humidity Display With 7-Segment Display
Add instructable to: