0% found this document useful (0 votes)
19 views

Arduino Security Box

security

Uploaded by

Mars
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Arduino Security Box

security

Uploaded by

Mars
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

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
Wires
Components can be found at http://egrobotics.com/store/
This Project uses and Arduino Board and LDR Add-on Kit
www.EGRobotics.com
The Code:
void setup() {
pinMode(13, OUTPUT);
delay(2000);
}
void loop() {
int sensorValue = analogRead(A0);
if (sensorValue > 300) { // Change Light Sensitivity by changing this value.
digitalWrite(13, HIGH);
analogWrite(3, 100);
delay(1000);
analogWrite(3, 150);
delay(1000);
}
else {
digitalWrite(3, LOW);
}
}

LDR Alarm
Make Alarm with sound and light and can be controlled using photocell (LDR) to stop the tone
and fix lights
Components REQD.:
1) Arduino UNO
2) Printer USB Cable
3) Solderless Breadboard
4) LED [x3]
5) Buzzer 5V
6) LDR
7) Resistor 10 kOhm [x1]
8) Resistor 100 Ohm [x1]
9) Resistor 220 Ohm [x3]
10) Jumper Wires

int
int
int
int
int
int

photoIn = 0;
led2 = 2;
led3 = 3;
led4 = 4;
piezo = 5;
aiValue = 0;

// photoresistor on Analogue Pin 1


// LED on Digital Pin 2

// input value

void setup()
{
Serial.begin (9600);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(piezo, OUTPUT);
LED

// Configure the Digital Pin Direction for the LED


// Configure the Digital Pin Direction for the LED
// Configure the Digital Pin Direction for the LED
// Configure the Digital Pin Direction for the

}
void loop() {
aiValue = analogRead(photoIn);

// Read the analogue input value

Serial.println (aiValue);
fotores

//scrivo sul serial monitor il valore della

delay(500);
if (aiValue < 300)
{
digitalWrite(led2, HIGH);
}

// It has got dark, turn the LED on.

if (aiValue > 300 && aiValue < 350)


{
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
// It has got dark, turn the LED on.
}
if (aiValue > 350 && aiValue < 400)
{
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
// It has got dark, turn the LED on.
}
if (aiValue > 400)
{
for (int x=0; x<5; x++)
{
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
delay(200);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
delay(200);
noTone(5);
tone(5, 494, 500);
noTone(5);
tone(5, 523, 300);
}
}

You might also like