Simple Security Alarm System
by ElevaFMaker in Circuits > Arduino
430 Views, 0 Favorites, 0 Comments
Simple Security Alarm System
My groupĀ“s project is a simple Alarm made for security using a movement sensor (PIR), that detects when someone passes by and makes a Buzzer ring. We did it without soldering nor using a Breadbord. This project is really simple and all wires are connected to the Arduino, the Buzzer and the PIR sensor. I am going to explain the code at the end, after the Hardware. Make sure you have the Arduino App instaled on your computer. It is fully functional and detects everyone who passes by, while being inexpensive and simple.
Gathering the Materials
For this project, you are going to need:
1 Arduino board (UNO or Mega) - It is a microprocessor with Inputs/Outputs. After compiling the code, it executes it.
1 PIR sensor - It detects objects in a maximum 7 meters range. It is activated when detects something.
1 Buzzer - A component used to make noise
male-male jumper wires
female-female jumper wires
Building the Hardware and Attaching the Components
We didn't use a breadbord or solder. We attached the sensor pins to the jumper wires and directly to the arduino board. We also connected the buzzer to the arduino with jumper wires. We changed the sensor's maximum range and sensitivity. On the image, we can see how the movement sensor is connected on the Arduino, just remember that you are also going to need a buzzer. We used the Red wire as the positiv (5V)e, the black as the negative (GND) and the yellow we inserted on pin 7.
Writing the Code
You must write the following code on your Arduino app:
#define pinPIR 7
const int pinBuzzer= 5; //const int pinPIR = ;
void setup() { pinMode(pinPIR, INPUT); pinMode(pinBuzzer, OUTPUT); Serial.begin(9600); }
void loop() { bool valorPIR = digitalRead(pinPIR);
if (valorPIR == HIGH){ digitalWrite (pinBuzzer, HIGH); tone(pinBuzzer, 2000); Serial.println(valorPIR); } else { digitalWrite(pinBuzzer, LOW); Serial.println(valorPIR); } }