Site icon Circuit Ideas for You

Distance Measurement Circuit using Ultrasonic Sensor and Arduino

Ultrasonic sensors use high-frequency sound waves to detect distance, then they measure the time it takes for the echoes to bounce back.

When combined with the Arduino microcontrollers computing capacity, we can build a system that can precisely calculate an objects distance from us.

This assignment will examine the fundamentals of ultrasonic sensors, the necessary Arduino code and the procedures for constructing a system for measuring distance.

Code and Explanations:

const int trigPin = 2;
const int echoPin = 3;

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  // Trigger the sensor
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Measure pulse duration
  long duration = pulseIn(echoPin, HIGH);

  // Calculate distance
  int distance = duration * 0.034 / 2;

  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");
  delay(100);
}

Ultrasonic Sensor Circuit Working :

Parts List:

ComponentQuantity
Arduino UNO1
LCD 16X2 Display1
Ultrasonic Sensor Module1
IC 78091
Potentiometer 10k1

A transmitter and a receiver are the two transducers that are usually found in an ultrasonic sensor.

Transmission is a brief burst of ultrasonic waves is released by the transmitter.

Waves propagate across the atmosphere until they come into contact with an item.

Reflection is the waves create an echo when they strike an item and return.

Reception is the returning echo is picked up by the receiver.

Calculating distance is the distance to an object is exactly proportional to the amount of time that passes between sending a signal and receiving an echo.

How to Build:

To build a Distance Measurement using Ultrasonic Sensor and Arduino follow the below mentioned steps for connections:

Connections details of Arduino and LCD

Connections details of Ultrasonic Sensor:

Note:

The estimated speed of sound, which is 0.034 cm/µs, is a rough figure that might change based on the air temperature and humidity.

You might need to modify this number for measurements that are more exact.

Conclusion:

Through the integration of an Arduino board and an ultrasonic sensor, we can effectively develop a distance measurement system.

The foundation for several applications, including as proximity sensing, object identification and obstacle avoidance, is provided by this research.

More sophisticated systems can be created by adding more sensors, displays or actuators for further improvements.

References:

Distance measurement using ultrasonic sensor

Exit mobile version