The Connections can be made direct between Ultrasonic sensor and Arduino (or) You can also use Breadboard to achieve the same.
- Connect the Vcc pin of Ultrasonic sensor to 5V on Arduino
- Connect the GND pin of Ultrasonic sensor to GND on Arduino
- Connect the Trig Pin of Ultrasonic sensor to D6 on Arduino
- Connect the Echo Pin of Ultrasonic sensor to D5 on Arduino
That's it...
Ultrasonic sensor has wide variety of applications such as distance measurement, object detection, obstacle avoidance etc.,
This project is designed keeping in mind the people who are looking for basic setup of Ultrasonic sensor with Arduino. Any type of Arduino can be used for this project.
The working is very Simple, when the connections are done as per the circuit diagram and when it is powered ON, the Ultrasonic sensor sends sound waves. When the waves come in contact with an object, they bounce back to the sensor. Hence, the distance is calculated by multiplying speed with time. The speed here refers to the speed of sound, which is 340 meters per second. In cm per microseconds it is 0.034 and inch per microseconds it is 0.0133858. We have to divide the speed by 2, since sound wave travels forward and returns back after hitting the object.
On the other hand, the time is the duration taken by the sound wave to travel forward and bounce back. Therefore the distance of object from the Ultrasonic sensor is easily identified.
You can find the calculation in the code attached below. Peace
End Result
Comments