0% found this document useful (0 votes)
23 views13 pages

1.4 Distance Measurement - UltrasonicSensor - Revised

The document describes using an ultrasonic sensor with an Arduino board to measure distances. It explains that an ultrasonic sensor, Arduino board, and breadboard are used. The trig and echo pins of the sensor are connected to pins on the Arduino. Code is uploaded to read the sensor data, calculate distance in centimeters, and print it. Distances are tested by placing objects in front of the sensor and observing the measured distances. The system provides an inexpensive way to accurately detect and measure distances.

Uploaded by

Sayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views13 pages

1.4 Distance Measurement - UltrasonicSensor - Revised

The document describes using an ultrasonic sensor with an Arduino board to measure distances. It explains that an ultrasonic sensor, Arduino board, and breadboard are used. The trig and echo pins of the sensor are connected to pins on the Arduino. Code is uploaded to read the sensor data, calculate distance in centimeters, and print it. Distances are tested by placing objects in front of the sensor and observing the measured distances. The system provides an inexpensive way to accurately detect and measure distances.

Uploaded by

Sayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Distance measurement using Ultrasonic sensors

Department of Mechatronics | SAMM


Faculty of Engineering | Manipal University Jaipur
Contents

§ Introduction

§ Components Required

§ Methodology

§ Code for Current Experiment

§ Conclusions

§ References
Introduction

• Distance measurement is an essential aspect of many projects, including robotics,

automation, and navigation.

• In this Experiment, we will calculate and display distance, measurement using an

ultrasonic sensors and print the distance in centimters.

3
Components Required

▪ Arduino Uno Board - used as the main controller for the distance measurement system.

▪ Ultrasonic Sensor - used to measure distances up to 400cm.

▪ Breadboard - used for prototyping and connecting the components.


Methodology

The distance measurement system using ultrasonic sensors for identification of the distance of
the obstacle in centimeters can be implemented using the following steps:

• Use Ultrasonic sensor with Arduino board.

• Connect the VCC pin of the ultrasonic sensor to the 5V pin of the Arduino board.

• The GND pin to the GND pin of the Arduino board.

• The TRIG pin to pin 11 of the Arduino board, and the ECHO pin to pin 12 of the Arduino board.
• Upload the code to the Arduino board. Use the Arduino IDE to write and upload the code to the

board.

• The code should read the sensor data, calculate the distance in centimeters
• Test the system. Place an object in front of the sensors and observe the LED indication.

• The distance measured by the ultrasonic sensor will be indicated based on the distance of the object

from the sensor.

• Repeat the steps for different distances and objects to test the system's accuracy and consistency.
Figure. 1: Connect the LEDs and resistors in series between the digital output pins of the Arduino
board, such as pin 5 and pin 6, and the GND pin.
Figure. 2: Connect the trigger pin of the ultrasonic sensor module to a digital output pin
of the Arduino board, such as pin 3.
Code Used

void loop()
int trig=9;
{
int echo=10;
// put your main code here, to run repeatedly:
digitalWrite(trig,LOW);
int timeInMicroseconds;
delay(2);
int distanceInCm;
digitalWrite(trig,HIGH);
void setup()
delay(10);
{
digitalWrite(trig,LOW);
// put your setup code here, to run once:
Serial.begin(9600);
timeInMicroseconds=pulseIn(echo,HIGH);
pinMode(9,OUTPUT);
distanceInCm=timeInMicroseconds /29 /2;
pinMode(10,INPUT);
Serial.println(distanceInCm);
}
delay(100);
}

7
IV Conclusion

• In conclusion, the distance measurement system using ultrasonic sensors is an excellent

tool for measuring distances and detecting objects.

• The system is easy to build and customize, making it an ideal tool for educational and

research purposes.

• The system's low cost and simplicity make it an attractive alternative to traditional

distance measurement systems, which can be expensive and complex.

7
V References
[1] https://www.arduino.cc/

[2] https://en.wikipedia.org/wiki/Arduino

[3] https://learn.sparkfun.com/tutorials/what-is-an-arduino/all

[4]https://www.learnrobotics.org/blog/ir-sensor-vs-ultrasonic-sensor/#:~:text=Ultrasonic%20sensors%20use%20sound%20waves,big
%20differentiators%20in%20these%20sensors.

8
V

Thank You!

You might also like