Gesture Doorbell
This motion sensor doorbell works using the ultra sonic sensor from the arduino uno starter kit
it is a simple project to do and is great for a beginner.
Supplies
1 arduino uno
2 ultra sonic sensor
3 buzzer or a speaker
4 mini bread board
5 jumper wires (male to male, male to female)
6 usb arduino cord
Ultrasonic Sensor
Attach the ultra sonic sensor to the breadboard then attach some male to male jumper wires to the holes behind the ultrasonic sensor.
Arduino
Attach the vcc to the 5v on the Arduino
Attach the trig to the 12 pin
Attach the echo to the 13 pin
And finally attach gnd to gnd
Buzzer
Attach the buzzer to 2 male to female wires
Attach the positive wire to the 8 pin
Attach the negative wire to the gnd
Code
#define trigPin 12
#define echoPin 13 int Buzzer = 8;
void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(Buzzer, OUTPUT); }
void loop() { int duration, distance; digitalWrite(trigPin, HIGH); delayMicroseconds(1000); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance >= 80 || distance <= 0){ Serial.println("no object detected"); digitalWrite(Buzzer, LOW);
} else { Serial.println("object detected"); tone(Buzzer, 400); // play 400 Hz tone for 500 ms delay(500); tone(Buzzer, 800); // play 800Hz tone for 500ms delay(500); tone(Buzzer, 400); // play 400 Hz tone for 500 ms delay(500); tone(Buzzer, 800); // play 800Hz tone for 500ms delay(500); tone(Buzzer, 400); // play 400 Hz tone for 500 ms delay(500); tone(Buzzer, 800); // play 800Hz tone for 500ms delay(500); noTone(Buzzer); } delay(300); }
End
Up load the code then detach the usb cable and reattach it to a phone charger that plugs into a walla 9 volt battery is not a enough power for it so you will have to plug it into a wall
I hope you enjoyed this tutorial