This is a design of mine that you place inside of a box, drawer, or fridge and plays an alarm noise whenever you open the box, drawer, or fridge. It uses a light-sensitive resistor and is quiet when it is dark(the box is closed) and plays a noise when it is light(the box in open). It works especially well in the refrigerator, since a light comes on when you open it. You can use this to protect your things, annoy people, or help you stay on your diet by playing an annoying noise when you open the fridge.

Step 1: Gather Parts

You will need:

>a photoresistor (I use an R4)

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

>a piezo buzzer

>a 9v battery and battery clip

>an Arduino board

>a Breadboard

>Jumper wires

Buy Specialty Parts:

photoresistor - https://www.sparkfun.com/products/9088

piezo buzzer - https://www.sparkfun.com/products/7950

Step 2: Put Parts in Place

Not much explaining to do here; just follow the picture.

Step 3: Wire It Up

>Photoresistor goes to 5v, and ground through the resistor. Ground side of photoresistor goes to analog pin A2

>Piezo Buzzer goes to ground, and digital pin 2

>9v battery goes to ground and the Vin pin on board

Step 4: Coding

Connect your Arduino to your computer and upload this code:

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

Mountain View

Open the Serial Monitor in the Arduino program, and watch what happens!

<p>This is a pretty cool idea. I like how you made it modular. Good work.</p>

About This Instructable




Bio: Oh hey, look, a bio section! In case you actually cared enough to look here, I'm millerman4487, and I like waffles and robots. I ... More »
More by millerman4487:Detailed Wallpapers With Snapseed Plant Moisture Sensor w/ Arduino Provide Power With an Old USB Cord 
Add instructable to: