Introduction: Arduino Light Sensor Buzzer

This design is used to place inside of a dark place and an alarm noise will sound whenever you open the dark area. It uses a light-sensitive resistor and is quiet when it is dark and makes a noise when it is light. This will help you protect your things and keep you more organized. As photons (light) land on the detector, the resistance will decrease. The more light is we will have a lower resistance. By reading different values from the sensor, we can detect if is it light , dark or a value between them.

Step 1: Step 1: Parts for Your Setup

1) An Arduino,

2) A breadboard

3) A piezo buzzer

4)Jumper wires (Male)

5) a 10kΩ resistor (brown-black-orange)

6)Photoresistor (LDR)

Step 2: Step 2: Building Setup

Follow the picture using the materials from above

Step 3: Step 3: Coding

Connect your Arduino bored to your computer and put this code into the serial monitor

const int dark = 200; //set dark parameters
const int sound = 60; //set noise to play void setup() { pinMode(3, OUTPUT); pinMode(A2, INPUT); Serial.begin(9600); } void loop() { int light = analogRead(A2); if (light < dark) { Serial.print(light); Serial.println(" It's dark"); } else { Serial.print(light); Serial.println(" It's light"); tone(3, sound, 10);

} delay(10); }