Arduino uno Ultrasonic Sensor

This project utilizes an ultrasonic sensor to measure the distance of an object from the sensor.

The sensor emits ultrasonic waves and calculates the time it takes for the waves to bounce back from the object.

Based on this time duration, the distance to the object is determined.

Components Needed

Block Diagram

Hardware Wiring Explanation:

Trig Pin: Connect to digital pin 9 (trigPin) on the Arduino Uno.

Echo Pin: Connect to digital pin 10 (echoPin) on the Arduino Uno.

VCC: Connect to Arduino 5V.

GND: Connect to Arduino GND.

Software (Arduino IDE):

Initialize serial communication at a baud rate of 9600.

Connect the Arduino to your computer via USB.

Upload the above Arduino sketch to the Arduino Uno using the Arduino IDE.

Measure Distance:

Send a 10 microsecond pulse to the trig pin of the sensor to initiate the measurement.

Measure the duration of the pulse received on the echo pin using the

Calculate the distance using the formula:

Output Results:

Print the calculated distance to the Serial Monitor for real-time monitoring.

Applications

Notes

Keep the ultrasonic sensor's orientation stable and ensure it is facing towards the object whose distance is being measure

Adjust the speed of sound value in the calculation based on environmental factors if necessary.