Controlling A Servo With An Ultrasonic Sensor Usin
Controlling A Servo With An Ultrasonic Sensor Usin
by LevinCharles
We are a group of UQD10801 (Robocon1) students from Universiti Tun Hussein Onn Malaysia (UTHM) that will
demonstrate how to control a servo motor using an ultrasonic sensor and an arduino as part of our assignment.
An ultrasonic sensor is a device that can measure the distance to an object by the use of sound waves while a servo
motor is built for precision control of the angular or linear position, velocity, and acceleration.
1) Arduino Uno x 1
2) Ultrasonic Sensor x 1
3) Servo Motor x 1
Controlling a Servo With an Ultrasonic Sensor Using Arduino: Page 1
4) Breadboard
The platform used to build the circuit and test the simulation was Tinkercad.
The servo motor will rotate to a certain angle depending on the distance detected by the ultrasonic sensor. The
distance detected will also be displayed on the serial monitor.
1) Connect the 5V pin of the Arduino board to the bottom row of the breadboard
2) Connect the GND pin to the top row of the breadboard.
3) Connect the VCC pin of the sensor to the positive terminal of the breadboard.
2) Connect the ground terminal of servo motor to the negative terminal of the breadboard.
#de ne trigPin 9 }
Serial.print(distance); else {
servo.write(90); }
} delay(500);
else if (distance<180) { }
Serial.print(distance);
https://www.youtube.com/watch?v=Dn7usi89gYE
You're welcome :)