Arduino Security Alarm with Reed Switch

Arduino Security Alarm

How does the security alarm circuit works?

When power is turned on, the circuit goes into standby mode, and this condition is indicated by “SECURITY ALARM” in the LCD screen.Note that here a N/O reedswitch + bar magnet combination is used to detect any mishaps, and hence the reed switch should be in “closed”state at standby mode. When reed switch is opened, pin 2 of Arduino goes high with the help of the pull-up resistor R2, and the alert signal is available through the piezo-speaker PZ1 (not an active piezo-buzzer).

Arduino Security Alarm

At the same instant “ALERT ACTIVATED” message is displayed on the LCD screen. Once triggered, this “ALERT ACTIVATED” message remains lit until the system is resetted by the “reset” switch in the arduino board. In this way the owner is informed that the alert went off atleast once during his/her absence. Components R1 (100R) is added to limit the operating current of the LCD backlight unit, and P1 (10K) is the display contrast controller.

Arduino Sketch

  1. // ARDUINO-BASED SECURITY ALARM //
  2. // T.K.Hareendran //
  3. #include <LiquidCrystal.h>
  4. int sensPin = 2; // Sensor Input Pin
  5. int ledPin = 13; // LED output Pin
  6. int pzSpeaker = 5; //Piezo-speaker Output Pin
  7. int val = 0; // variable for reading the Input Pin status
  8. LiquidCrystal lcd (7, 8, 9, 10, 11, 12);
  9. void setup() {
  10. pinMode(sensPin, INPUT); // Set Sensor as input
  11. pinMode(pzSpeaker, OUTPUT); // Set Piezo-Speaker as output
  12. pinMode(ledPin, OUTPUT); // Set LED as output
  13. lcd.begin(16, 2);
  14. lcd.print(” SECURITY ALARM”);

Arduino Security Alarm schematic

  1. }
  2. void loop(){
  3. val = digitalRead(sensPin); // read input value
  4. if (val == HIGH) { // check if the input is HIGH
  5. digitalWrite(ledPin, HIGH); // turn LED ON
  6. lcd.setCursor(0, 1);
  7. lcd.print(“ALERT ACTIVATED!”);
  8. playTone(500, 600);
  9. delay(100);
  10. playTone(500, 800);
  11. delay(100);
  12. } else {
  13. digitalWrite(ledPin, LOW); // turn LED OFF
  14. playTone(0, 0);
  15. delay(300);
  16. }
  17. }

 

Read more: Arduino Security Alarm with Reed Switch

Leave a Comment

Your email address will not be published. Required fields are marked *