How to make Home Security system

0 8431 Medium

How to make Home Security system by using PIR sensor and DF player mini for audio integration

projectImage

Things used in this project

Hardware components

HARDWARE LIST
1 Arduino UNO
1 Df player mini
1 5 volt audio amplifier
1 Jumper wires (generic)
1 PIR Sensor, 7 m
1 Speaker: 3W, 4 ohms

Story

 

In this Project, we will learn, how we can make security alarm by using PIR sensor and DF player Mini. This system detect motion in room and play audio, Security Alert ! some one entered in the room. You can use this as welcome audio player for guests.

 

For making this project, I am using:-

 

-Arduino UNO

 

-DF player Mini

 

-Alarm Speaker

 

-SD Card

 

-PIR sensor (Motion sensor)

 

-5 Volt Audio Amplifier

 

CODE
#include "DFRobotDFPlayerMini.h"
const int buttonPin = 7;
int buttonState = 0;
DFRobotDFPlayerMini player;

void setup() {
  
pinMode(buttonPin, INPUT);
  // Init USB serial port for debugging
  Serial.begin(9600);
  // Init serial port for DFPlayer Mini
  //softwareSerial.begin(9600);

  // Start communication with DFPlayer Mini
  if (player.begin(Serial)) {
   Serial.println("OK");

    // Set volume to maximum (0 to 30).
    player.volume(30);
    // Play the first MP3 file on the SD card
    //player.play(1);
  } else {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }
}

void loop() {
  buttonState = digitalRead(buttonPin);
   if (buttonState == HIGH) {
    player.play(1);
  }
}

The article was first published in hackster, October 2, 2021

cr: https://www.hackster.io/munir03125344286/how-to-make-home-security-system-31953e

author: Muhammad_Munir

License
All Rights
Reserved
licensBg
0