Reminder Machine
For this project:
I modified this project from my last semester's project. The one that kind of fail at last. This project is a machine letting you not forget to bring your key out. This can help the people who lives alone and always have to bring key by themself, otherwide they can't get home.
What I modified & How does it work?
The original idea is a machine that gonna to move while you get pase. I modified it and changed the servo is going to move many time, and the nosiy sound is going to remind people to bring the thing on the manchine out.
Preparing Materials
-Arduino x1
-Breadboard x1
-Jumper wires x9
-Ultrasonic Distance Sensor - HC-SR04 x1
-Servo Motor x1
-Paper x2
-Tapes x5
Setting Up Wires & Decora
1. Having one side of the wires on the positive one and another side at 5V
2. Having one side of the wires on the negative one and another side at GND
3. Plug one side of a wire at 7 and another side at the white line of the servo
4. Plug one side of a wire at positive and another side at the red line of the servo
5. Plug one side of a wire at negative and another side at the black line of the servo
6. Plug Ultrasonic Distance Sensor at the row E
7. Plug the one side of a wire one positive side, plug another side to the Ultrasonic Distance Sensor's Ucc
8. Plug the one side of a wire one negative side, plug another side to the Ultrasonic Distance Sensor's Gnd
9. Plug one side of the wire to 9 and another side to the Ultrasonic Distance Sensor's Echo
10. Plug one side of the wire to 8 and another side to the Ultrasonic Distance Sensor's Trig
11. Cut the paper that feet the size of the servo
12. Cover everything up with paper
13. Stick a paper on the top of the servo as the base to put stuff on it
14. Remember to plug or connect the USB cable to the Arduino software for codings
Coding
#include
Servo servo1;
int trigPin = 8;
int echoPin = 9;
long distance;
long duration;
void setup()
{
servo1.attach(7);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);// put your setup code here, to run once: }
void loop() {
ultra();
servo1.write(0);
if(distance <= 10){
servo1.write(90);
}
}
void ultra(){
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration*0.034/2;
}
Paste the following coding to the Arduino software and upload it.
VIDEO!
https://youtu.be/hAuOny5cbtQ