Proximity Alarm

by 23muzquiz6024 in Circuits > Arduino

155 Views, 1 Favorites, 0 Comments

Proximity Alarm

14009ab8-09d2-461c-a5ea-d80a0ee2009c.jpg

My project consists of a proximity alarm you can set up at your door or anywhere you want. It will make a sound when someone passes through and the difference between my project and a normal proximity alarm in my project you can adjust the length. You can make the alarm sound when someone approaches a 50 cm radius or a 5 cm radius. I really liked this project and I hope everyone enjoys it.

Supplies

1.Piezo

2.Arduino

3.Wires

4.Led

5.HC-SR04

Tinkercad

Screen Shot 2021-06-11 at 10.30.39.png
Screen Shot 2021-06-11 at 10.31.31.png

Step 1: First thing I did is test everything in Tinkercad I made sure everything was working correctly before I went out to buy materials. Everything was working smoothly in the Tinkercad and I liked the project so it was a go from then.

Code:const int trigPin = 9;

const int echoPin = 10; const int buzzer = 11; const int ledPin = 13;

long duration; int distance; int safetyDistance;

void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(buzzer, OUTPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); }

void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2; safetyDistance = distance; if (safetyDistance <= 10){ digitalWrite(buzzer, HIGH); digitalWrite(ledPin, HIGH); } else{ digitalWrite(buzzer, LOW); digitalWrite(ledPin, LOW); } Serial.print("Distance: "); Serial.println(distance); }

Assemble

9cd76719-1058-4899-a706-410fe467d601.jpg
6bcf7d03-2a2a-4ac0-85d2-b20eae8db0a0.jpg

Step 2: I went out to buy the materials and put everything together. This step for my personality is the most challenging because putting wires together is complicated for me I don't really like it compared to Tinkercad. After time assembling it was finally ready and there we can see my final product.

Test

My project worked perfectly I loved it and here is the link to the final project. https://www.youtube.com/watch?v=TQ_Iu149MNg