Home Security System

by Rajab1234 in Circuits > Arduino

110 Views, 1 Favorites, 0 Comments

Home Security System

20230613_140212.jpg

This is an alarm system that you can make right now. The way it works is if you are in front of the distance sensor the lcd would tell you how far you are and if you get too close then the green led would turn on to warn you then the yellow and finaly the red and the buzzer goes off which let's know someone is really close to the sensor.

Supplies

Actman.jpg

You would need a couple of things before you go to make this project

1 16x2 I2C LCD $12.99

3 330 Resistors $ 2.67

1 HC-SRO4 $2.80

5 SPDTSlideswitch $ 1.22

3 LEDS $3.00

1 7408 Logicgate $1.36

1 7404 Logicgate $1.36

1 HF-12095 $0.68

1 Breadboard $5.00

TOTAL $31.08

(All prices came from amazon.ca)

Wiring the Project

Screenshot 2023-06-13 185327.png
20230619_132327.jpg

This was the hardest part for me becuese there are so many wires due to the amount of parts that were used. So Before wiring everything I recomnd to give power to both power rails first then moving on to wiring the slide switches and the logic gates becuese by far that would be the hardest part to wire if you choose to do it last. The rest of it is easy you just got to make sure that the right pins go to the right arduinio port.

Trig pin (distance sensor) = 2

Echo pin (distance sensor) = 3

SCL pin (I2C LCD) = A5

SDA pin (I2C LCD) = A4

Red_Led (+) = 11

Green_Led (+) = 13

Yellow_Led (+) = 12

Buzzer (+) = 4

Slideswitch 5 (middle) = 10



Understanding the Logic Password

123.png
LOGICGATEFIANL.png
lOGICGRIDFINAL.png

The analog logic password is a really key part in making this alarm system. So basically there are 4 slideswitches and they run into this AND logic gate and a NOT logic gate so once you get the right slideswitch combnation then you could flip the slideswitch that is connected to one of the outputs for the and gate which would lead to it turning off the system.

That's what it's meant to do but the logic works like this slideswitch A and C are not going through a NOT gate and going straight into one of the AND logic ports which if both switches were on then the output would be high. The other 2 slideswitches B and D are connected to a NOT gate then that NOT output is connected to an AND logic gate and if both slideswitches are off then the output of the AND gate would be high. So since now we both have highs then both outputs of both AND gates go to one AND gate and if both are HIGH then the system would be turned off.

There are 2 pictures above one shows the truth table and you can see that there's only one input that turns into a high. The second picture shows the logic circuit for the password. Also if your curios the equation that I came up with is A~BC~D.

The Code

The code is somewhat easy to understand all you have to do is make sure that it's wired right and make sure that arduino is plugged in also you would need to install one liabary for this to work.

#include <LiquidCrystal_I2C.h>

This library allows you to use the much easier I2C Liquid crystal display if you are looking for it click here and download version 1.1.2.

Downloads

Conclusion

This project was really fun to make for me because I made it from scratch I suggest not to copy these steps 1 by 1 and find out how to make it on your own just to experience the making process.