Devices & Components
Arduino Nano
Pushbutton switch 12mm
Breadboard (generic)
9V Battery Clip
Wire Cable - By the Foot
Buzzer
9V battery (generic)
Jumper wires (generic)
Ultrasonic Sensor - HC-SR04 (Generic)
Solar Cockroach Vibrating Disc Motor
Hardware & Tools
Drill / Driver, Cordless
PCB Holder, Soldering Iron
Soldering iron (generic)
Multitool, Screwdriver
Solder Wire, Lead Free
Tape Measure, Manual
Soldering iron (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Mastech MS8217 Autorange Digital Multimeter
Software & Tools
Arduino IDE
tinkercad
Project description
Code
code
c_cpp
1#define trigPin 13 2#define echoPin 12 3#define motor 7 4#define buzzer 6 5 6void setup() 7{ pinMode(trigPin, OUTPUT); 8pinMode(echoPin, INPUT); 9pinMode(motor, OUTPUT); 10pinMode(buzzer,OUTPUT); 11} 12 13void loop() 14{ long duration, distance; 15digitalWrite(trigPin, LOW); 16delayMicroseconds(2); 17digitalWrite(trigPin, HIGH); 18delayMicroseconds(10); 19digitalWrite(trigPin, LOW); 20 21duration = pulseIn(echoPin, HIGH); 22distance = (duration/2) / 29.1; 23 24if (distance < 70) // Checking the distance, you can change the value 25{ 26digitalWrite(motor,HIGH); // When the the distance below 100cm 27digitalWrite(buzzer,HIGH); 28} else 29{ 30digitalWrite(motor,LOW);// when greater than 100cm 31digitalWrite(buzzer,LOW); 32} delay(500); 33}
Downloadable files
blind's eye
This circuit diagram is made with the help of tinkercad
blind's eye

blind's eye
This circuit diagram is made with the help of tinkercad
blind's eye

Documentation
blog_w25NgsnSMa.docx
blog_w25NgsnSMa.docx
blog_w25NgsnSMa.docx
blog_w25NgsnSMa.docx
Comments
Only logged in users can leave comments