And attach the servo motor on the other side of the red strip using hot glue.
Servo motor control using arduino and ultrasonic sensor.
Arduino and ultrasonic sensor control servo and distance meter in this project you can see how to control servo motor and tu calculate distance using arduino and ultrasonic sensor.
We will now focus on the main aim of the project i e is to control the servo using an ultrasonic sensor.
Thus let s add them one after the other.
Attach the ultrasonic sensor on the red strip on one side of the base using hot glue.
Control the servo motor by using the ultrasonic sensor.
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.
How the project work.
When ultrasonic sensor read 5cm distance ore less servo will rotate in 120 degree else servo will rotate 0 degree arduino will print the distance on serial print.
The connection is very simple.
The ultrasonic vcc is connected to 5v the gnd to ground.