Arduino Security Box

Arduino Security Box

This project creates a security system for a box or container. Place the LDR in a dark container. When
the container is opened the buzzer will sound letting everyone know that the container has been opened
if the container is quickly closed the buzzer will turn off but an LED will remain on letting the user
know someone opened the container. Reset the board to reactivate the alarm.

Components Needed:

1x Arduino
1x Bread Board
1x Speaker or Piezo Buzzer
1x LED
1x LDR (Light Dependent Resistor)
1x 100 or 220 Ohm Resistor
1x 220 Ohm Resistor
1x 10K Resistor
1x Box

Components can be found at
This Project uses and Arduino Board and LDR Add-on Kit

The Code:

void setup() {
  pinMode(13, OUTPUT);
void loop() {
  int sensorValue = analogRead(A0);
if (sensorValue > 300) { // Change Light Sensitivity by changing this value.
    digitalWrite(13, HIGH);
  analogWrite(3, 100); 
  analogWrite(3, 150); 
  else {
       digitalWrite(3, LOW);


Go to for more fun projects!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    6 Discussions


    2 years ago

    Hi, i would like to ask that if i replace the buzzer to an amplifier circuit for high volume. Will it still functioning?


    6 years ago on Introduction

    Hi i did built this Alarm Circuit but i have a problem on the Piezo Buzzer, it dont Sound that loud like what shows in your video.
    I've tried direct install the buzzer to a 12v just to check if the buzzer has the problem but it's not it is normal and loud, can someone teach me how to make the buzzer louder,

    1 reply

    Reply 6 years ago on Introduction

    Hi jdelfinado,

    Using an Arduino board it will never be as loud as a 12V source unless you run it through a transistor and the Arduino. I don't know which Piezo Buzzer you have but try checking it's datasheet for voltage range. How loud is it compared to when you plug it into the Arduino's 5V? It should be just slightly quieter because of the resistor. You can also remove the resistor to the Piezo to boost the volume, this should be fine as the digital pins put out very little power(Unless you are trying to route the 12V through it.) Other than that double check your circuit. Let me know what you discover. Good Luck!



    6 years ago on Introduction

    Thanks for the help! I got it to work changing the light sensor value. This is a great project thanks for your input!


    6 years ago on Introduction

    So i built this and the alarm is always going off. Is the voltage from the 5v causing this and would I need to integrate in a pullup resistor to lower the voltage for this to work?

    1 reply

    Reply 6 years ago on Introduction

    Hi Tyishistory,

    5V is the correct voltage. If you built it the same as shown above, the only reason I would see it continuing to Buzz would be that the box is not getting dark enough. Do an analog read on the sensor while it is in the box. If it is greater than 300 then be sure to to change the code to fit what was read:

    if (sensorValue > 300) { // Change Light Sensitivity by changing this value.

    You could also test to make sure no positive and negatives are switched. If the Buzzer turns off when a flashlight's beam is on the LDR then the 10K and LDR should be switched.

    Let me know if none of those ideas work!

    Good Luck!

    For more ideas or help check out: