Proximity Alarm
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
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
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