Description : High Tech Security

by 968988 in Circuits > Arduino

145 Views, 4 Favorites, 0 Comments

Description : High Tech Security

Copy of Arduino Final Project (5).png

The main purpose of this circuit is to detect someone's motion when it comes within the range of the Distance sensor. When this happens, the distance sensor will send the signal to the LED and the buzzer which will get turn on and the motion sensor will start printing "Danger". After this happens, the keypad is used to break the circuit and the when the key on the keypad gets pressed the LED and the Buzzer will turn off and the Motion sensor will start printing reset.

Components Needed

Brilliant Habbi.png

Making Connections : First Connect the Keypad With the Arduino

Copy of Arduino Final Project.png

The pins that I used to connect the 4x4 keypad with the Arduino are -

  • Row 1 - Pin 13
  • Row 2 - Pin 12
  • Row 3 - Pin 11
  • Row 4 - Pin 10
  • Column 1 - Pin 9
  • Column 2 - Pin 8
  • Column 3 - Pin 7
  • Column 4 - Pin 6

Making Connections : Secondly, Connect the Buzzer With the Arduino

Copy of Arduino Final Project (2).png
  • Positive - Pin 13
  • Negative - Ground Wire (Black Wire )

Making Connections : Then Connect the Motion Sensor With the Arduino

Copy of Arduino Final Project (3).png
  • The motion sensor has three connections and the pins that I used to connect them with the Arduino are -
  • Signal - Pin 1
  • Power - Power Wire ( Red Wire)
  • Ground - Ground Wire ( Black Wire)

Making Connections : After That, Connect the Resistor and the LED With the Arduino

Copy of Arduino Final Project (6).png

The pins that I used to connect both of these components with the Arduino are -

  • Anode of the LED - 12
  • Cathode of the LED - Terminal 1 of the Resistor
  • Terminal 2 of the Resistor - Ground Wire (Black Wire)

Making Connections : Lastly Connect the Distance Sensor With the Arduino

Copy of Arduino Final Project (7).png

The distance sensor has four connections and the pins that I used to connect them are -

  • VCC - Power Wire (Red Wire)
  • TRIG - Pin 11
  • ECHO - Pin 10
  • GND - Ground Wire(Black Wire)

The Code

Explanation

In function void loop

long duration, distance; digitalWrite(trig, LOW); delayMicroseconds(2); digitalWrite(trig, HIGH); delayMicroseconds(10); digitalWrite(trig, LOW); duration = pulseIn(echo,HIGH); distance = (duration/74/2);

The code here is for the distance sensor and the formula “distance = (duration/74/2);” is used to determine the distance.

char keypressed = myKey.getKey();

This function is used to give the information to the arduino which key is going to be pressed on the keypad.

if (distance>= 10 && distance <30){ if(digitalRead(pir) ==1){ Serial.println("Danger"); digitalWrite(led,HIGH); buzzer(1); } if(keypressed == '1' ){ digitalWrite(led,LOW); buzzer (0); Serial.println("Reset"); exit; } }

else if (distance>= 30 && distance <70){ Serial.println("No Movement Detected"); digitalWrite(led,LOW); buzzer(0); }

The IF statement is a decision-making statement that is used to inform the program to make decisions based on specified criteria. If someone is within the range of the distance sensor, the buzzer and led will turn on. Else both of these components will be turned off.