Light Detector Buzzer
![IMG_1456[356].jpg](/proxy/?url=https://content.instructables.com/FY7/QX6Q/LI1YG9LD/FY7QX6QLI1YG9LD.jpg&filename=IMG_1456[356].jpg)
![photo.jpg](/proxy/?url=https://content.instructables.com/FBJ/8NBO/LI1YG7D1/FBJ8NBOLI1YG7D1.jpg&filename=photo.jpg)
This buzzer can be put into food boxes(crackers, bread, cereal, etc...) and it will alert you by buzzing to tell you when the box isn't fully closed(uses light to detect this)
Supplies
![IMG_1448[344].jpg](/proxy/?url=https://content.instructables.com/F6B/OYNG/LI1YG7L8/F6BOYNGLI1YG7L8.jpg&filename=IMG_1448[344].jpg)
![Screenshot 2023-05-24 113431.png](/proxy/?url=https://content.instructables.com/F3Z/M5M8/LI1YG7X6/F3ZM5M8LI1YG7X6.png&filename=Screenshot 2023-05-24 113431.png)
Arduino Uno R3, breadboard, photoresistor, resistor, buzzer, 9v battery and connector, and male to male wires
Tinkercad Coding
![Screenshot 2023-05-24 113431.png](/proxy/?url=https://content.instructables.com/FH1/EWY6/LI1YG7YR/FH1EWY6LI1YG7YR.png&filename=Screenshot 2023-05-24 113431.png)
![code.png](/proxy/?url=https://content.instructables.com/F98/YUV1/LI1YG7Z4/F98YUV1LI1YG7Z4.png&filename=code.png)
On Tinkercad, place the following items; Arduino Uno R3, breadboard, photoresistor, resistor, buzzer, 9v battery and connector, and male to male wires. connect them as the photo shows. Then place the code blocks in the order that the photo shows. Finally start the simulation on Tinkercad, move the slider on the photoresistor and make sure the code is working. The buzzer should turn on when light hits the photoresistor. CODE HERE:
// C++ code
//
int pos = 0;
int i = 0;
void setup()
{
pinMode(A0, INPUT);
pinMode(9, OUTPUT);
pinMode(9, OUTPUT);
}
void loop()
{
if (analogRead(A0) >= 500) {
tone(9, 29, 1000); // play tone 10 (A#0 = 29 Hz)
} else {
digitalWrite(9, LOW);
}
delay(10); // Delay a little bit to improve simulation performance
}
Set Up Physical Board
![IMG_1452[348].jpg](/proxy/?url=https://content.instructables.com/FLK/Q6P8/LI1YG87W/FLKQ6P8LI1YG87W.jpg&filename=IMG_1452[348].jpg)
![Screenshot 2023-05-24 113431.png](/proxy/?url=https://content.instructables.com/FJ8/TH77/LI1YG89C/FJ8TH77LI1YG89C.png&filename=Screenshot 2023-05-24 113431.png)
With the physical pieces in hand, place them on the bread board and Arduino the same way they are placed on Tinkercad.
Get the Code Working
![IMG_1453.jpg](/proxy/?url=https://content.instructables.com/FMO/SZ7N/LI1YG8OO/FMOSZ7NLI1YG8OO.jpg&filename=IMG_1453.jpg)
![Screenshot 2023-05-24 115137.png](/proxy/?url=https://content.instructables.com/FCE/HXH3/LI1YG941/FCEHXH3LI1YG941.png&filename=Screenshot 2023-05-24 115137.png)
Download the Arduino IDE software at https://www.arduino.cc/en/software . Then plug in the code from Tinkercad into the software. Plug in your physical Arduino and send the code over using the arrow button in the top left corner as shown in the photo. Your Arduino should then start working. When the photoresistor detects light, it will buzz very annoyingly until light is no longer hitting it anymore.
FINISH
Now, you can place this computer wherever you like, whether it is in a cereal box, refrigerator, or room. This light detector can be used for many things, have fun!!