0% found this document useful (0 votes)
36 views4 pages

Ultrasonic Sensor Distance Measure

1) The student measured the distance of an object using an ultrasonic sensor connected to an Arduino Uno board and LCD display. 2) An ultrasonic sensor works by sending and receiving ultrasonic waves to calculate the time taken for the echo to return, allowing the sensor to determine the distance to the object. 3) The procedure connected the ultrasonic sensor and LCD display to the Arduino, uploaded the code, and monitored the serial monitor to view distance measurements in real-time.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

Ultrasonic Sensor Distance Measure

1) The student measured the distance of an object using an ultrasonic sensor connected to an Arduino Uno board and LCD display. 2) An ultrasonic sensor works by sending and receiving ultrasonic waves to calculate the time taken for the echo to return, allowing the sensor to determine the distance to the object. 3) The procedure connected the ultrasonic sensor and LCD display to the Arduino, uploaded the code, and monitored the serial monitor to view distance measurements in real-time.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment No. - 2.

Student Name: Abhishek Dewan UID: 21BCS5891


Branch: BE-CSE Section/Group: 605-B
Semester: 5th Date: 11/09/2023
Subject Name: IOT Subject Code: 21CSP- 344

AIM: To measure the distance of an object using an ultrasonic sensor.

COMPONENTS REQUIRED:
You will need the following components −
1. Arduino Uno R3 board
2. Ultrasonic sensor (HC-SR04)
3. 16×2 LCD I2C Display
4. Jumper Wires

THEORY:
Ultrasonic Sensor:
An ultrasonic Sensor is a device used to measure the distance between the sensor and an object
without physical contact. This device works based on time-to-distance conversion.

Working Principle of Ultrasonic Sensor:


Ultrasonic sensors measure distance by sending and receiving the ultrasonic wave. The
ultrasonic sensor has a sender to emit the ultrasonic waves and a receiver to receive the
ultrasonic waves. The transmitted ultrasonic wave travels through the air and is reflected by
hitting the Object. Arduino calculates the time taken by the ultrasonic pulse wave to reach the
receiver from the sender. Formula: Distance = Speed * Time
In the code, the “duration” variable stores the time taken by the sound wave traveling from the
emitter to the receiver. That is double the time to reach the object, whereas the sensor returns
the total time including sender to object and object to receiver. Then, the time taken to reach the
object is half of the time taken to reach the receiver. so we can write the expression as, Distance
= Speed of Sound in Air * (Time Taken / 2) Note: Speed of sound in air = 344 m/s.

PROCEDURE:
• Connect the Echo pin of the sensor to the D2 pin of the Arduino.
• Connect the Trig pin of the sensor to the D3 pin of the Arduino.
• Navigate to Tools and select board and port.
• Verify and compile the code, then upload the code to the Arduino Uno R3 board.
Name: Abhishek Dewan UID: 21BCS5891
• Monitor the output in the Serial monitor (Set the baud rate as 9600). To open Serial
monitor Tools>Serial Monitor or (Ctrl+Shift+M).

Follow the circuit diagram as shown in the image given above.


To interface with the LCD display, we need to install the supporting library to the Arduino IDE.

Steps to Interface LCD display:

1. Install driver library for Liquid Crystal Display.


• Navigate Tools>Library Manager (or) Enter ( Ctrl+Shift+I ) to open library
manager.
• Search for “LiquidCrystal I2C” and install the “LiquidCrystal I2C” library. 2.
Import the header file “LiquidCrystal_I2C.h” in the code.
3. Connect the SDA pin of an LCD display to the SDA pin of the Arduino Board and the SCL
pin of an LCD display to the SCL of the Arduino Board.
4. Connect VCC to 5V pin and GND to GND pin.

Name: Abhishek Dewan UID: 21BCS5891


SKETCH:

Name: Abhishek Dewan UID: 21BCS5891


RESULT:

LEARNING OUTCOMES:

• Learnt about the proximity sensor and its applications.


• Learnt how to connect proximity sensor on Arduino.
• Learnt how to connect LCD display.
• Learnt how to code in Arduino.
Name: Abhishek Dewan UID: 21BCS5891

You might also like