0% found this document useful (0 votes)
55 views65 pages

Distance measurement using ultrasonic sensor

The document outlines a project that utilizes ultrasonic sensors and Arduino for accurate distance measurement without physical contact. It discusses the advantages of ultrasonic sensors, their applications in various fields, and compares their effectiveness with other measurement technologies. Additionally, it highlights the current status of distance measurement technologies in India and the United States, emphasizing the integration of advanced systems in multiple sectors.

Uploaded by

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

Distance measurement using ultrasonic sensor

The document outlines a project that utilizes ultrasonic sensors and Arduino for accurate distance measurement without physical contact. It discusses the advantages of ultrasonic sensors, their applications in various fields, and compares their effectiveness with other measurement technologies. Additionally, it highlights the current status of distance measurement technologies in India and the United States, emphasizing the integration of advanced systems in multiple sectors.

Uploaded by

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

ABSTRACT

Nowadays, we have some difficulties in obtaining the distance that we want to


measure. Even though, measuring tape is an easy option, but this kind of tool will have a
limitation of manual error.

The project is designed to measuring distance using ultrasonic waves and


interfaced with arduino. We know that human audible range is 20hz to 20khz. We can utilize
these frequency range waves through ultrasonic sensor HC-SR04.

The advantages of this sensor when interfaced with arduino which is a control and
sensing system, a pro per distance measurement can be made with new techniques.
Ultrasonic sensors are first rate gear to degree distance without real touch and used at several
places like water degree measurement, distance dimension etc. this is an efficient manner
to measure small distances exactly. on this assignment we've got used an Ultrasonic
Sensor to determine the space of an obstacle from the sensor.

In many applications like vehicle control, medical applications, robotic movement


control, etc.; distance measurement of an object is used. This can be done using a variety of
sensors- Ultrasonic, IR, radar, laser, etc. Measurement using ultrasonic sensors is the
cheapest and its reliability among several others is very high.

In this project distance measurement and location of an object by using ultrasonic


sensor and microcontroller is present.

1
INDEX

CONTENTS
Page Numbers

1 INTRODUCTION
1.1 Introduction 3
1.2 Present status in India 3-4
1.3 Status in other countries 4-5
1.4 Novelty of the work 5-6
2 CONFIGURATION Of THE SYSTEM
2.1 Circuit diagram 7
2.2 Components used in the system 7-24
2.3 Working principle 24-25
3 APPLICATIONS OF THE SYSTEM
3.1 Advantages 26-27
3.2 Disadvantages 27-29
3.3 Applications
3.4 32
29-31
4 HARDWARE IMPLEMENTATION
4.0
4.1
5 CONCLUSION

2
CHAPTER – 1
1.0 INTRODUCTION
1.1 INTRODUCTION
Distance measurement of an object in front or by the side of the moving entity is
required in large number of devices. These devices may be small or large and can be quite
simple or complicated. Distance measurement has important applications in automotive and
industrial applications.
The distance measurement through sensors is useful in detecting obstacles. It uses
ultrasonic waves to search an object same as Bats uses sonar technique to communicate with
other bats. Bats are wonderful creatures. Blind from the eyes but the vision is sharper than
Ultrasonic ranging is the technique used by bats. Ultrasonic sensor provides an easy way in
distance measurement. The sensor is perfect for distance measurements between moving or
stationary objects. Ultrasonic Sensor measure the distance of the objects in air through non-
contact technique. They measure distance without damage and are easy to use and reliable.
[5] In order to calculate the distance between the sensor and the object, the sensor measures
the time it takes between the emissions of the sound by the transmitter to its contact with the
receiver. The formula for this calculation is D = ½ T x C (where D is the distance, T is the
time, and C is the speed of sound ~ 343 meters/second). For example, if a scientist set up
an ultrasonic sensor aimed at a box and it took 0.025 seconds for the sound to bounce back,
the distance between the ultrasonic sensor and the box would be,
D = 0.5 x 0.025 x 343 or about 4.2875 meters.

An ultrasonic sensor emits sound waves toward an object and determines its
distance by detecting reflected waves Ultrasonic sensor diagram. (Robo Galaxy)Ultrasonic
sensors are used primarily as proximity sensor

Fig: basic DTM diagram

1.2 PRESENT STATUS IN INDIA


In India, distance measurement technologies are integral to various sectors, including
manufacturing, construction, surveying, and space exploration. The country has made
significant advancements in both terrestrial and satellite-based distance measurement
systems.

3
Terrestrial Distance Measurement Technologies:

India has adopted a range of distance measurement technologies to enhance precision and
efficiency across different industries:

 Laser Distance Sensors: Companies like Baumer India offer laser distance sensors
capable of measuring distances from micrometers up to 60 meters. These sensors are
utilized in applications such as factory automation and the processing of electronic
components.
 Ultrasonic and Inductive Sensors: These sensors are employed for precise
measurements of distances, widths, heights, positions, and diameters of objects,
serving various industrial applications.
 Laser Displacement Sensors: Offered by companies like KEYENCE India, these
sensors provide high-speed, accurate, and precise measurements of distance and
position, suitable for applications requiring high precision.
 Laser Distance Sensors: Micro-Epsilon India provides laser distance sensors
designed for non-contact measurements, with ranges up to 270 meters, used in
machine building and handling equipment.

Satellite-Based Distance Measurement:

India has developed its own regional satellite navigation system, NavIC (Navigation
with Indian Constellation), which provides accurate position information over India and
the surrounding region. NavIC is intended to offer an all-weather absolute position
accuracy of better than 7.6 meters throughout India and within a region extending
approximately 1,500 km around it.

Educational and Research Institutions:

The Indian Institute of Surveying & Mapping (IISM) in Hyderabad plays a pivotal
role in advancing surveying and mapping technologies. Established in 1967, IISM offers
training in modern surveying systems, including GPS, electronic distance measurement, and
laser scanning, contributing to the development of spatial data collection methodologies.

Additionally, the National Physical Laboratory of India (NPL) in New Delhi


maintains national standards for measurements, including length, ensuring the accuracy and
reliability of distance measurements across the country.

In summary, India has established a robust infrastructure for distance measurement,


integrating advanced technologies and research institutions to support various applications
across multiple sectors.

1.3 PRESENT STATUS IN OTHER COUNTRIES

In the United States, distance measurement technologies are integral to various


sectors, including manufacturing, construction, surveying, and space exploration. The country
has adopted a range of advanced measurement systems to enhance precision and efficiency
across different industries.

4
Terrestrial Distance Measurement Technologies:

Several companies in the U.S. offer advanced distance measurement sensors:

 Laser Distance Sensors: Companies like Baumer USA provide laser distance sensors
capable of measuring distances from micrometers up to 60 meters. These sensors are
utilized in applications such as factory automation and the processing of electronic
components.
 Ultrasonic Distance Sensors: Migatron Corp. offers ultrasonic sensors that can
detect distances to a variety of objects, ranging from small spheres to large rolls of
steel. These sensors are used in industries like petroleum, chemical, and
manufacturing.
 Laser Displacement Sensors: KEYENCE America provides laser displacement
sensors designed for non-contact measurements, offering high-speed, accurate, and
precise measurements of distance and position.

Satellite-Based Distance Measurement:

The United States utilizes the Global Positioning System (GPS) for distance measurement
applications:

 Global Positioning System (GPS): GPS provides accurate position information by


measuring the time it takes for signals from satellites to reach a receiver. This system
is essential for navigation, mapping, and various location-based services.

Educational and Research Institutions:

Various institutions in the U.S. contribute to the advancement of distance measurement


technologies:

 National Institute of Standards and Technology (NIST): NIST provides


measurement standards and conducts research to advance measurement science,
including distance measurement technologies.
 National Institute of Standards and Technology (NIST) in the USA: NIST
provides measurement standards and conducts research to advance measurement
science, including distance measurement technologies.

In summary, the United States has established a robust infrastructure for distance
measurement, integrating advanced technologies and research institutions to support various
applications across multiple sectors.

1.4 NOVELTY

The novelty of using an ultrasonic sensor for distance measurement lies in its ability to
accurately measure distances to objects without physical contact by sending out ultrasonic
waves and measuring the time it takes for the echo to return, making it ideal for applications
where non-contact detection is crucial, like obstacle avoidance in robots, liquid level

5
monitoring, and proximity sensing in various environments, all while being relatively
inexpensive and easy to implement compared to other technologies.

a. Non-contact Measurement:

 Ultrasonic sensors measure distance by emitting sound waves and measuring the time
it takes for the waves to bounce back from an object. Since there is no physical
contact, this makes them ideal for situations where contact could damage the object or
alter the measurement (e.g., fragile or moving objects).

b. Accuracy and Precision:

 With advances in technology, modern ultrasonic sensors can provide very precise
measurements, with some systems offering accuracy within millimeters over a
considerable range of distances (e.g., up to 10 meters or more).

c. Versatility and Robustness:

 These sensors are robust, making them suitable for various environments, including
dusty, dirty, or humid locations. They can be used in a wide range of industries, such
as manufacturing, robotics, and automotive applications, where traditional sensors
might struggle.

d. Cost-Effective:

 Ultrasonic sensors are generally inexpensive compared to other types of distance


sensors, like laser or infrared sensors, making them a cost-effective solution for many
applications.

e. Wide Range of Applications:

 They are used in various applications:


o Level Sensing: Monitoring the level of liquids or solids in tanks or bins.
o Obstacle Detection: In autonomous vehicles or robots to detect nearby
objects or obstacles.
o Proximity Sensing: In industrial systems for part positioning and alignment.

f. Simple Setup and Integration:

 Ultrasonic sensors are relatively easy to set up and integrate into systems, making
them popular for DIY projects, educational purposes, and industrial automation.

6
g. High Sensitivity to Various Materials:

 Ultrasonic sensors can measure the distance to a wide range of materials, including
metals, plastics, and liquids, unlike some other sensors (such as infrared) that are
limited to specific surfaces.

CHAPTER – 2

2.0 CONFIGURATION OF THE SYSTEM

2.1 CIRCUIT DIAGRAM

Fig: circuit diagram


2.2 COMPONENTS USED IN SYSTEM
2.2.1 Arduino UnoR3
It is a microcontroller board based on the ATmega328. Arduino is an open- source,
proto typing platform and it s simplicity makes it ideal for hobby is tsornovice to use as well
as professionals. The Arduino Uno has 14 digital input/output pins (of which 6 can be used as
PWM outputs), 6 analog inputs, a 16MHz crystal oscillator ,a USB connection, a power jack,
an ICSP header, and are set button. It contains everything needed to support the
microcontroller simply connect it to a computer with a USB cable or power it with AC-to-
DC adapter or battery to get started
The Arduino UnoR3 uses an ATmega16U2 instead of the 8U2 found on the Uno (or
the FTDI found on previous generations). This allows for faster transfer rates and more
memory. No drivers needed for Linux or Mac(in file for Windows is needed and included in
the Arduino IDE), and the ability to have the Uno show up as a keyboard, mouse, joystick,
etc. The Arduino Uno differs from all preceding boards in that it does not use the FTDI USB-
to-serial driver chip. Instead, it features the Atmega8U2 microcontroller chip programmed as
a USB-to-serial converter.

7
The Uno R3 also adds SDA and SCL pins next to the AREF. In addition, there are
two new pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to
the voltage provided from the board. The other is a not connected and is reserved for future
purposes. The Uno R3works with all existing shields but can adapt to new shields which use
these additional pins.
"Uno" means one in Italian and is named to mark the upcoming release of Arduino
1.0. Preferred quality and originals are made in Italy. The Arduino Uno and version 1.0 will
be the reference versions of Arduino, moving forward. The Uno is the latest in a series of
USB Arduino boards, and there ference model for the Arduino platform.

Fig :arduino board

Features of the Arduino UNO:

· Micro controller: ATmega328

· Operating Voltage: 5V

· Input Voltage (recommended): 7-12V

· Input Voltage(limits):6-18V

· Digital I/OPins:14(of which 6 provide PWM output)

· Analog InputPins:6

· DC Current per I/O Pin: 40mA

· DC Currentfor3.3VPin:50mA

· Flash Memory: 32KBofwhich0.5KBusedbybootloader

· SRAM: 2KB(ATmega328)

· EEPROM: 1KB(ATmega328)

· Clock Speed: 16MHz

The Arduino Uno can be programmed with the Arduino software


(download). Select "Arduino Uno w/ ATmega328" from the Tools > Board menu
(according to the microcontroller onyour board). For details, see the reference and
tutorials.

8
The ATmega328 on the Arduino Uno comes pre burned with a boot loader that allows
you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files). You can
also by pass the boot loader and program.

The ATmega8U2 firmware source code is available. The ATmega8U2 is


loaded with a DFU boot loader, which can be activated by connecting the solder jumper
on the back of the board (near the map of Italy) and then resetting the 8U2. You can then
use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and Linux)
to load a new firmware. Or you can use the ISP header with an external programmer
(overwriting the DFU boot loader).

Fig : arduino uno


Rather than requiring a physical press of the reset button before an upload,
the Arduino Uno is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of the ATmega8U2 is
connected to the reset line of the ATmega328 via a 100 nano farad capacitor. When this
line is asserted (taken low), the reset line drops long enough to reset the chip. The
Arduino software uses this capability to allow you to upload code by simply pressing the
upload button in the Arduino environment. This means that the boot loader can have a
shorter timeout, as the lowering of DTR can be well-coordinated with the start of the
upload.

This setup has other implications. When the Uno is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from
software(via USB).For the following half-second or so, the boot loader is running on the
Uno. While it is programmed to ignore malformed data (i.e. anything besides an upload
of new code), it will intercept the first few bytes of data sent to the board after a
connection is opened. If a sketch running on the board receives one-time configuration or

9
other data when it first starts, make sure that the software with which it communicates
waits a second after opening the connection and before sending this data.

How To Use Arduino

Arduino can sense the environment by receiving input from a variety of


sensors and can affect its surroundings by controlling lights, motors, and
other actuators. The microcontroller on the board is programmed using the
Arduino programming language(based on Wiring) and the Arduino
development environment (based on Processing).Arduino projects can be
stand-alone or theycan communicate with software on running on a computer
(e.g. Flash, Processing, Max MSP).
Arduino is a cross-plato form program. You’ll have to follow different
instructions for your personal OS. Check on the Arduino site for the latest
instructions.

Once you have downloaded /unzipped the arduino IDE, you can Plug the Arduino
to your PC via USB cable.

Fig :arduino IDE

Now you’re actually ready to “burn” your first program on the arduino board. To select
“blinkled”, the physical translation of the well known programming “hello world”, select

File> Sketchbook > Arduino-0017

>Examples> Digital>Blink

Once you have your sketch you’ll see something very close to the screenshot on the right.

10
In Tools>Board select
Now you have to go to

Tools>Serial Port and select the right serial port, the one arduino is attached to.

LCD DISPLAY

Nowadays, we always use the devices which are made up of LCDs such as CD players,
DVD players, digital watches, computers, etc. These are commonly used in the screen
industries to replace the utilization of CRTs. Cathode Ray Tubes use huge power when
compared with LCDs, and CRTs heavier as well as bigger. These devices are thinner as
well power consumption is extremely less. The LCD 16×2 working principle is, it
blocks the light rather than dissipate. This article discusses an overview of LCD 16X2,
pin configuration and its working.
What is the LCD 16×2?

The term LCD stands for liquid crystal display. It is one kind of electronic display
module used in an extensive range of applications like various circuits & devices
like mobile phones, calculators, computers, TV sets, etc. These displays are mainly
preferred for multi-segment light-emitting diodes and seven segments. The main
benefits of using this module are inexpensive; simply programmable, animations,
and there are no limitations for displaying custom characters, special and even
animations, etc.
16X2 LCD

Fig :LCD 16*2


LCD 16×2 Pin Diagram
The 16×2 LCD pin out is
shown below.

• Pin1 (Ground/Source Pin): This is a GND pin of display, used to connect the
GND terminal of the microcontroller unit or power source.

11
• Pin2 (VCC/Source Pin): This is the voltage supply pin of the display, used to
connect the supply pin of the power source.
• Pin3 (V0/VEE/Control Pin): This pin regulates the difference of the display,
used to connect a changeable POT that can supply 0 to 5V.

• Pin4 (Register Select/Control Pin): This pin toggles among command or data
register, used to connect a microcontroller unit pin and obtains either 0 or 1(0 =
data mode, and 1 = command mode).
• Pin5 (Read/Write/Control Pin): This pin toggles the display among the read or
writes operation, and it is connected to a microcontroller unit pin to get either 0
or 1 (0 = Write Operation, and 1 = Read Operation).
• Pin 6 (Enable/Control Pin): This pin should be held high to execute Read/Write
process, and it is connected to the microcontroller unit & constantly held high.
• Pins 7-14 (Data Pins): These pins are used to send data to the display. These pins
are connected in two-wire modes like 4-wire mode and 8-wire mode. In 4-wire
mode, only four pins are connected to the microcontroller unit like 0 to 3,
whereas in 8-wire mode, 8- pins are connected to microcontroller unit like 0 to
7.
• Pin15 (+ve pin of the LED): This pin is connected to +5V
• Pin 16 (-ve pin of the LED): This pin is connected to GND.LCD-16×2-pin-
diagram

Fig: pin diagram of lcd display


Features of LCD16x2 The features of
this LCD mainly include the follow ing.

• The operating voltage of this LCD is 4.7V-5.3V


• It includes two rows where each row can produce 16-characters.
• The utilization of current is 1mA with no backlight
• Every character can be built with a 5×8 pixel box
• The alphanumeric LCDs alphabets & numbers

12
• Is display can work on two modes like 4-bit & 8-bit
• These are obtainable in Blue & Green Backlight

• It displays a few custom generated characters

Registers of LCD
A 16×2 LCD has two registers like data register and command register. The RS (register
select) is mainly used to change from one register to another. When the register set is
‘0’, then it is known as command register. Similarly, when the register set is ‘1’, then it
is known as data register.
Command Register
The main function of the command register is to store the instructions of command
which are given to the display. So that predefined tasks can be performed such as
clearing the display, initializing, set the cursor place, and display control. Here
commands processing can occur within the register.
Data Register
The main function of the data register is to store the information which is to be
exhibited on the LCD screen. Here, the ASCII value of the character is the
information which is to be exhibited on the screen of LCD. Whenever we send the
information to LCD, it transmits to the data register, and then the process will be
starting there. When register set =1, then the data register will be selected.

16×2 LCD Commands


The commands of LCD 16X2 include the following.
• For Hex Code-01, the LCD command will be the clear LCD screen
• For Hex Code-02, the LCD command will be returning home
• For Hex Code-04, the LCD command will be decrement cursor
• For Hex Code-06, the LCD command will be Increment cursor
• For Hex Code-05, the LCD command will be Shift display right
• For Hex Code-07, the LCD command will be Shift display left
• For Hex Code-08, the LCD command will be Display off, cursor off
• For Hex Code-0A, the LCD command will be cursor on and display off
• For Hex Code-0C, the LCD command will be cursor off, display on
• For Hex Code-0E, the LCD command will be cursor blinking, Display on
• For Hex Code-0F, the LCD command will be cursor blinking, Display on
• For Hex Code-10, the LCD command will be Shift cursor position to left
• For Hex Code-14, the LCD command will be Shift cursor position to the right
• For Hex Code-18, the LCD command will be Shift the entire display to the left
• For Hex Code-1C, the LCD command will be Shift the entire display to the right
• For Hex Code-80, the LCD command will be Force cursor to the beginning ( 1st
line)

13
• For Hex Code-C0, the LCD command will be Force cursor to the beginning
( 2nd line)
• For Hex Code-38, the LCD command will be 2 lines and 5×7 matrix

LCD 16×2 Arduino


Please refer to this link to know more about-How to Interface Liquid Crystal
Display using An Arduino.
Thus, this is all about LCD 16×2 datasheet, which includes what is a 16X2 LCD,
pin configuration, working principle, and its applications. The main advantages of this
LCD device include power consumption is less and low cost. The main disadvantages of
this LCD device include it occupies a large area, slow devices and also lifespan of these
devices will be reduced due to direct current. So these LCDs use AC supply with less
than 500Hz frequency. Here is a question for you, what are the applications of LCD

ULTRASONICSENSOR
Basics
The Arduino analog input is limited to a 5 VDC input. If you wish to
measure highspeed, you will need to resort to another means. One way is to use a
speed divider. The one discussed here is found all over Amazon and eBay.
Keep in mind, you are restricted to voltages that are less than 25 volts. More than that and
you will exceed the voltage limit of your Arduino input.
Basic Connection

Fig:ULTRASONIC sensor
Inputs
 GND – This is where you connect the low side of the voltage you are
measuring. Caution! : This is the same electrical point as your Arduino
ground.

14
 VCC: The is where you connect the high side of the voltage you are measuring

Outputs
Trig (Trigger): Sends a short pulse to initiate the ultrasonic wave emission.
o Echo: Receives the reflected ultrasonic wave, with the pulse width
proportional to the distance of the detected object

Fig: schematic daigram of Ultrasonic sensor

In this Arduino Project, you will learn how to build an Arduino IR sensor
which can measure the speed of the motor This works as a DC voltmeter with
maximum 12V. As you all know Arduino and few other microcontroller can
measure up to 5V directly from the analog pins, but if you want to measure
the voltage beyond 5V, it is not possible and even if you connect more than
5V the chip may get damaged or burnt. So, with the help of this Voltage
sensor we can measure up to 25V from Arduino Analog pins.
So, in this article we teach you, the principle of this voltage sensing module,
how it works and how to interface it with Arduino and display the voltage
values on 16X2 LCD display with I2C adapter and where it is useful. Required
components:
• Arduino Microcontroller
• Voltage sensor module
• 16X2 LCD display with I2C
• Few connecting wires
Speed Detection sensor Module overview:
This IR sensor is small and low cost module whose principle is based on
With the help of it the two lightes. Arduino AVR chips have 10-bit ADC,
so this module simulates a resolution of 0.00488V (5V/1024),so the
minimum voltage of input voltage detection module is 0.00488Vx5(for
25v)=0.02440V.
• For 5V systems the input voltage should not be greater than 12V

15
• For 3.3V system the input voltage should not be greater than 16.5v as
3.3X5=16.5.Related: Measure AC current by interfacing ACS712 sensor with
ESP32
Technical specifications:
• Voltage input range: DC 0-12V
• Output signal type: Analog
• Distance Analog Resolution: 30 cm

Ultrasonic sensor module pin out:

Fig: ultrasonic sensor module pin out


From the above pin out diagram we can notice there are 5 pins to voltage sensor
module. 3 pins are male head connectors which are to be connected to Arduino and other
2 pins has a plastic screw pin terminals where the voltage to be measured is connected.

 VCC: Positive terminal for the external voltage source (0-25v)


 GND: Negative terminal for the external voltage source (0-25v)
Trig (Trigger): Sends a short pulse to initiate the ultrasonic wave emission. 
 Echo: Receives the reflected ultrasonic wave, with the pulse width proportional to the
distance of the detected object 
Build Own ultrasonic sensor using below Schematic diagram:
As we already discussed this sensor works with the principle of voltage divider
circuit. we can even build the circuit by our own with a very few components This circuit
measure the distance. Follow the below schematic diagram to build own ultrasonic sensor
with range 0-12V DC.

Circuit Diagram to interface Ultrasonic sensor with Arduino


Connect all the required components according to the below circuit diagram.

16
Fig: Ultrasonic sensor with arduino circuit
As you can see from the above circuit diagram the Ultrasonic sensor module signal
pin OUT is connected to Analog pin A0 of Arduino. The – pin of sensor is connected to
GND pin of Arduino. On the other side the distanceto be measured whose +ve and -ve pins
are connected to VCC and GND respectively.

Fig:distance detector sensor module


The LCD display has 4 pins 2 pins for power and 2 pins for communication. The
power pins VCC and GND of LCD display are connected to 5V and GND of Arduino.
The communication pins SDA and SCL are connected to A4 and A5 of Arduino
respectively.
Not only Arduino UNO microcontroller but also you can use Arduino
NANO, etc.,
That s it for connection, If you want to interface this with LCD display with out I2C
adapter refer this article: Interfacing LCD Display with Arduino in detail.
If you want to display the output on the OLED display refer this article: Interfacing
SSD1306 OLED display with Arduino. Now its time to upload the code

I2C MODULE
An I2C LCD1602 is a device that can display text and characters on a
16x2 (16 columns and 2 rows)liquid crystal display (LCD) using the I2C
protocol. You can use an I2C LCD1602 to show information from your
Arduino projects, such as sensor readings, messages, menus, etc. The I2C
module has a built-in PCF8574 I2C chip that converts I2C serial data to
parallel data for the LCD

17
Fig: I2c module
Principle.
An I2C LCD1602 consists of a normal LCD1602 and an I2C module that is attached to the
back of theLCD. The I2C module is a chip that can expand the I/O ports of the Arduino
using the I2C protocol.
The I2C protocol is a serial communication protocol that uses two wires: SDA
(serial data) and SCL(serial clock). The I2C protocol allows multiple devices to
communicate with each other using only two wires and unique addresses.

Fig:12c LCD1602
The I2C module converts the signals from the Arduino into commands for the LCD.
The LCD has 16x2 cells that can display characters or symbols. Each cell consists of
5x8 dots that can be turned on or off by applying voltage. The LCD can display
different characters or symbols by turning on or off different combinations of dots.

Fig: 12c module

Backlight/Contrast

18
Backlight can be enabled by jumper cap, un plugg the jumper cap to disable the
backlight. The blue potentiometer on the back is used to adjust the contrast (the
ratio of brightness between the brightest white and the darkest black).

Shorting Cap: Backlight can be enabled by this cap on plugg this cap to disable
the backlight.
Potentiometer: It is used to adjust the contrast (the clarity of the displayed text),
which is increased in the clockwise direction and decreased in the counterclockwise
direction.

After wiring the LCD, you should turn on the Arduino and adjust the
contrast by rotating the potentiometer on the I2C module until the first row of
rectangles appear to ensure proper LCD operation.

I2C LCD Adapter

At the heart of the adapter is an 8-bit I/O expander chip – PCF8574. This chip
converts the I2C data from an Arduino into the parallel data required for an LCD
display.

Fig: PCF8574 chip


The board also includes a tiny trim pot for making precise adjustments to
the display’s contrast.

Fig: 16 pin labe;led LED

19
There is a jumper on the board that provides power to the backlight. To control the
intensity of the backlight, you can remove the jumper and apply external voltage to
the header pin labeled ‘LED’.

I2C Address of LCD

If you have multiple devices on the same I2C bus, you may need to set a different
I2C address for the LCD adapter to avoid conflicting with another I2C device.
For this purpose, the adapter comes with three solder jumpers/pads (A0, A1, and
A2). The address is set when a jumper is shorted with a blob of solder.

Fig:12c Address of LCD

An important point to note here is that several companies, including


Texas Instruments and NXP Semiconductors, manufacture the same
PCF8574 chip. And the I2C address of your LCD depends on the chip
manufacturer.

I2C LCD Display Pin out

The I2C LCD Display has only four pins. The following is the pin out:

20
Fig: 12c LCD display pin out
GND is a ground pin.

VCC is the power supply pin. Connect it to the 5V output of the Arduino or
an external 5V power supply.

SDA is the I2C data pin.

SCL is the I2C clock pin.

An important point to note here is that several companies, including Texas


Instruments and NXP Semiconductors, manufacture the same PCF8574 chip.
And the I2C address of your LCD depends on the chip manufacturer.

• I2C LCD Display Pin out


• The I2C LCD Display has only four pins. The following is the pin out:
• Wiring an I2C LCD Display to an Arduino
• Connecting an I2C LCD is much simpler than connecting a standard LCD. You
only need to connect four pins.
Begin by connecting the VCC pin to the Arduino’s 5V output and the GND
pin to ground. Now we are left with the pins that are used for I2C
communication. Note that each Arduino board has different I2C pins that must
be connected correctly. On Arduino boards with the R3 layout, the SDA (data
line) and SCL (clock line) are on the pin headers close to the AREF pin.
They are also referred to as A5 (SCL) and A4 (SDA).

Fig: 12c lcd with arduino uno


Jumper wires

In the dynamic realm of DIY electrical projects, the humble jumper wire emerges
as a silent hero, facilitating seamless connections and unlocking the potential for
innovation. This introduction aims to shed light on the pivotal role these
unassuming components play in the world of electronics.

In the intricate landscape of circuitry, jumper wires act as miniature


conductive bridges, allowing for the swift transmission of signals and
power. Their significance lies in their ability to link various components,

21
making them indispensable in the creation and modification of electrical
setups.

Jumper wires serve as the architects of circuit modifications, providing a


straightforward means to connect, disconnect, and redirect electrical
pathways. This versatility simplifies the prototyping process, enabling
enthusiasts to iterate and refine their designs with ease.

For electronics enthusiasts embarking on DIY projects, a fundamental


understanding of jumper wires becomes per amount. This knowledge empowers
individuals to navigate.

Types of Jumper Wires

In the intricate world of electronics, male-to-male jumper wires stand as the


workhorse of connectivity, offering a versatile solution for a myriad of
applications.

Common Connector Standard: The male-to- male configuration ensures


compatibility across various electronic components, providing a standardized
connection approach.

Fig:Male to male jumper wires


Versatility in Prototyping: Ideal for bread boarding and prototyping, these
jumper wires effortlessly link components, facilitating the swift construction
and modification of circuits. Dive into the diverse realm of jumper wires with
the exploration of male-to-female and female-to-female configurations, each
catering to specific connection needs.

Fig:male-to-female dynamics

22
Male-to-Female Dynamics: This setup enables the connection of male pins to
female receptacles, offering flexibility in interfacing with a range of components.

Female-to-Female Flexibility: These wires provide a unique solution for


connecting components with female connectors, broadening the compatibility
spectrum in circuit design.

Fig:female-to-female flexibility
Head shapes play a pivotal role in the functionality and applicability of jumper
wires. Delve into the nuances of square and round heads to make informed
choices.

Square Head Precision: Square-headed jumper wires offer precise connections,


ensuring a secure fit in components with corresponding square receptacles.

Round Head Adaptability: The rounded head configuration provides


adaptability, seamlessly fitting into various components with circular
connectors, adding a layer of versatility to your toolkit.
9V Battery
An electric battery is essentially a source of DC electrical energy. It
converts stored chemical energy into electrical energy through an
electrochemical process. This then provides a source of electromotive
force to enable currents to flow in electric and electronic circuits. A
typical battery consists of one or more voltaic cells. The voltage of
electric batteries is determined by:

Chemistry. The potential difference of the materials that compose the


positive and negative electrodes in the electrochemical reaction.
 Number of cells. Batteries in series produce a voltage equal to the number of
batteries multiplied by the voltage of each individual battery

23
Fig: 9v battery

9V Battery
The nine-volt battery, or 9-volt battery, is an electric battery that is typically composed of
6 x 1.5V alkaline cells. Therefore, it supplies a nominal voltage of 9 volts. Actual voltage
measures 7.2 to 9.6 volts, depending on battery chemistry. Batteries of various sizes and
capacities are manufactured; a very common size is known as PP3 (Power Pack – 3). The
PP3 has a rectangular prism shape with rounded edges and two polarized snap connectors
on the top.
This type is commonly used for many applications including household uses such as smoke and gas
detectors, clocks, and toys.

The nine-volt PP3-size battery is commonly available in primary zinc-carbon


and alkaline chemistry, in primary lithium iron disulfide and lithium
manganese dioxide (sometimes designated CRV9), and in rechargeable form in
nickel-cadmium (Ni–Cd), nickel-metal hydride (Ni–MH) and lithium-ion.
There are three main types of nine-volt PP3-size
batteries:

Alkaline batteries (Zink/alkaline/Manganese Dioxide). An alkaline battery (IEC code:


L) is a type of primary battery that provides direct electric current from the
electrochemical reaction between zinc and manganese dioxide (MnO2) in the presence of
an alkaline electrolyte. The alkaline battery gets its name because it has an alkaline
electrolyte of potassium hydroxide (KOH) instead of the acidic ammonium chloride
(NH4Cl) or zinc chloride (ZnCl2) electrolyte of the zinc–carbon batteries. Other battery
systems also use alkaline electrolytes, but they use different active materials for the
electrodes. The alkaline cell was introduced to the market in 1959 but did not become
more common than the Zinc-carbon cell until around 1980.
Zinc-carbon batteries. The zinc-carbon battery, also called the Leclanché cell, is a
traditional generalpurpose dry cell. Zinc–carbon batteries were the first commercial dry
batteries developed from the technology of the wet Leclanché cell. This battery provides
a direct electric current from the electrochemical reaction between zinc and manganese
dioxide (MnO2) in the presence of an electrolyte. Zinc-carbon batteries

today have been mostly replaced by more efficient and safe alkaline batteries. It
produces a voltage of about 1.5 volts between the zinc anode, which is typically
constructed as a cylindrical container for the battery cell, and a carbon rod surrounded
by the cathode that collects the current from the manganese dioxide electrode. The name

24
“zinc-carbon” is slightly misleading as it implies that carbon is acting as the reducing
agent rather than the manganese dioxide.
NiMH batteries. A nickel metal hydride battery, NiMH, is a rechargeable battery with a
positive electrode made of nickel hydroxide and a negative electrode made of a metal
hydride (a hydrogenabsorbing alloy). The NiMH battery was commercially introduced
in 1989 and was mainly used as a power source in portable personal computers. Since
then, the NiMH battery system has become very popular in electric hybrid vehicles and
makes up 10% of the total market for rechargeable batteries. Compared to the NiCd
battery, the NiMH provides 40 percent higher specific energy resulting in about two
times higher capacity. NiMH batteries are also less affected by voltage depression, but
the main advantage is the absence of toxic cadmium. The memory effect of NiMH
batteries is much less than nickel-cadmium batteries.
today have been mostly replaced by more efficient and safe alkaline batteries. It
produces a voltage of about 1.5 volts between the zinc anode, which is typically
constructed as a cylindrical container for the batterycell, and a carbon rod surrounded
by the cathode that collects the current from the manganese dioxide electrode. The
name “zinc-carbon” is slightly misleading as it implies that carbon is acting as the
reducing agent rather than the manganese dioxide.
NiMH batteries. A nickel metal hydride battery, NiMH, is a rechargeable battery with
a positive electrode made of nickel hydroxide and a negative electrode made of a
metal hydride (a hydrogenabsorbing alloy). The NiMH battery was commercially
introduced in 1989 and was mainly used as a power source in portable personal
computers. Since then, the NiMH battery system has become very popular in electric
hybrid vehicles and makes up 10% of the total market for rechargeable batteries.
Compared to the NiCd battery, the NiMH provides 40 percent higher specific energy
resulting in about two times higher capacity. NiMH batteries are also less affected by
voltage depression, but the main advantage is the absence of toxic cadmium. The
memory effect of NiMH batteries is much less than nickel-cadmium batteries.

2.3 WORKING PRINCIPLE


The circuit diagram for arduino and ultrasonic sensor is shown above to measure
the distance. In circuit connections Ultrasonic sensor module’s “trigger” and “echo”
pins are directly connected to pin 18(A4) and 19(A5) of arduino. A 16x2 LCD is
connected with arduino in 4-bit mode. Control pin RS, RW and En are directly
connected to arduino pin 2, GND and 3. And data pin D4-D7 is connected to 4, 5, 6
and 7 of arduino. First of all we need to trigger the ultrasonic sensor module to
transmit signal by using arduino and then wait for receive ECHO.This technique of
distance measurement using ultrasonic in air includes continuous pulse echo method, a
burst of pulse is sent for transmission medium and is reflected by an object kept at
specific distance. The time taken for the sound wave to propogate from transmitter
to receiver is proportional to the distance of the object. In this distance measurement
system we had ultrasonic sensor HC-SR04 interfaced with Arduino UnoR3.
Programming and hardware part of ultrasonic sensor interfacing with Arduino
UnoR3.servo motors are used to control the position of objects, rotate objects, move

25
legs, arms or hands of robots, move sensors etc. with high precision. Servo motors are
small in size, and because they have built-in circuitry to control their movement, they
can be connected directly to an Arduino. Arduino reads the time between
triggering and Received ECHO. We know that speed of sound is around 340m/s. so
we can calculate distance by using given formula:
Distance= (travel time/2) * speed of sound Where speed of sound
around 340m per second. A 16x2 LCD displaying distance.

CHAPTER – 3

3 APPLICATIONS OF THE SYSTEM


3.1 ADVANTAGES
a. Low Cost:

 Affordability: Ultrasonic sensors like the HC-SR04 are very inexpensive, and when combined
with an Arduino Uno (which is also cost-effective), this makes for a budget-friendly solution
for distance measurement.
 Affordable for Prototyping: Since both components are low-cost, they are ideal for rapid
prototyping and learning purposes without a large financial commitment.

b. Simple Integration and Easy Setup:

 User-Friendly Setup: The combination of an Arduino Uno and an ultrasonic sensor is easy to
set up and use, even for beginners. The Arduino IDE (Integrated Development Environment)
makes programming simple with minimal coding experience required.
 Clear Documentation and Tutorials: There are abundant resources and tutorials available
online for integrating ultrasonic sensors with Arduino, which makes it highly accessible for
hobbyists and students.

c. Non-contact Measurement:

 Safe and Accurate: Ultrasonic sensors measure distances without needing to physically
touch the object, reducing the risk of damage or distortion. This is particularly useful for
measuring delicate objects or in applications like robotics where contact-based sensors
could interfere with performance.
 Ideal for Various Surfaces: Ultrasonic sensors work well with various materials (like metals,
plastics, or liquids) and surface textures that might affect other types of sensors like infrared
or laser.

26
d. Accuracy and Precision:

 Reliable Measurements: Ultrasonic sensors, when properly calibrated, offer reasonably


accurate and precise distance measurements, with accuracy to within a few millimeters,
especially for shorter distances (e.g., up to 4 meters).
 Customizable Range: You can adjust the range of the ultrasonic sensor depending on the
specific model and how it's programmed in Arduino, allowing flexibility for different projects.

e. Versatile Applications:

 Obstacle Detection and Avoidance: You can use an ultrasonic sensor and Arduino Uno in
robotics for obstacle detection and navigation, making it a great solution for autonomous
robots or vehicles.
 Object Proximity Sensing: This combination can be used for proximity sensing in various
automation systems, such as smart doors, parking systems, or inventory management
systems.
 Liquid Level Sensing: By measuring the distance to the surface of a liquid in a tank or
container, you can use it for monitoring liquid levels without requiring direct contact.

f. Real-Time Feedback and Control:

 Immediate Response: The Arduino Uno can process sensor data in real time, making the
system responsive and capable of immediate actions based on distance measurements. For
example, it can trigger alarms or motors when an object is detected within a certain range.
 Simple Data Output: The Arduino can easily display measured distance on an LCD screen,
send it to a computer via serial communication, or use the data for further processing in
embedded systems.

g. Low Power Consumption:

 Energy-Efficient: The combination of an Arduino Uno and ultrasonic sensor is energy-


efficient, making it a good choice for battery-operated applications or systems where power
consumption is a concern.

h. Scalability and Expandability:

 Expand the System: You can expand this setup by integrating multiple ultrasonic sensors
with the Arduino Uno, allowing you to measure distances in multiple directions or in more
complex applications (e.g., 3D mapping in robotics).
 Integration with Other Components: The Arduino Uno can be easily interfaced with other
components like servos, motors, LEDs, and wireless modules to create more advanced
systems based on the ultrasonic distance measurements.

i. Educational Value:

 Learning Tool: This setup is often used in educational projects to teach students about
sensors, electronics, programming, and distance measurement principles. It offers hands-on
experience with sensors and microcontrollers, helping students understand concepts in a
practical and engaging way.

27
j. Compact Size:

 Small and Lightweight: Both the Arduino Uno and ultrasonic sensor are compact, making it
easy to integrate them into small systems and devices. This is particularly useful for
wearable devices, small robots, or portable distance measurement systems.

3.2 DISADVANTAGES

a Limited Range:

 Shorter Effective Range: Most ultrasonic sensors (like the HC-SR04) have a limited range of
around 2 cm to 4 meters. Beyond this range, the sensor’s accuracy and reliability
significantly drop. This can be restrictive for applications requiring longer-distance
measurements.
 Limited Precision at Long Distances: As the distance increases, the precision of the sensor
tends to degrade, and errors can become more pronounced, especially for distances near
the sensor's maximum range.

b. Susceptibility to Environmental Interference:

 Sensitive to Weather Conditions: Ultrasonic sensors rely on sound waves, and their
performance can be affected by environmental factors like temperature, humidity, or wind.
For example, temperature changes can affect the speed of sound, leading to inaccuracies.
 Interference from External Noise: Ultrasonic sensors can be influenced by background noise
or other ultrasonic sources. High levels of noise in the environment (e.g., from machinery)
can distort the sensor readings, making them less reliable.

c. Limited Resolution and Accuracy:

 Reduced Accuracy at Close Range: Ultrasonic sensors may not provide highly accurate
measurements when very close to the target (i.e., under 2 cm). In such cases, the sensor's
resolution may be insufficient.
 Angle Sensitivity: Ultrasonic sensors generally have a wide beam and are sensitive to the
angle of the surface they are measuring. The angle at which the sensor hits an object can
lead to a distorted or inaccurate measurement, especially for irregular or angled surfaces.

d. Obstacles in Direct Path:

 Line of Sight Requirement: Ultrasonic sensors require a clear line of sight to the object being
measured. If there are obstacles in the path, or if the object is soft or highly absorbent (like
cloth or foam), the sound waves may not reflect back properly, causing inaccurate or failed
measurements.
 Soft Materials: Objects like fabric, foam, or irregularly shaped materials can absorb sound
waves, making it hard for the ultrasonic sensor to get a reliable reading.

e. Slow Measurement Speed:

 Slower Response Time: The process of emitting sound waves, waiting for the echo, and
calculating the distance can be relatively slow compared to other types of sensors, like
infrared sensors or lasers. This could limit the use of ultrasonic sensors in applications
requiring real-time or high-speed measurements.

28
f. Limited Precision in Complex Environments:

 Multiple Reflectors: In environments with multiple surfaces or highly reflective objects, the
ultrasonic waves might bounce off unintended surfaces, leading to false readings or multiple
echoes, making it difficult to determine the true distance to the target.
 Difficult in Complex Geometries: When trying to measure distances to irregularly shaped
objects or in complex environments, the sensor may struggle to get an accurate reading due
to the sound wave reflection being scattered in various directions.

g. Power Consumption in Continuous Operation:

 Power Requirements for Continuous Measurement: If you are using an ultrasonic sensor
continuously or in real-time applications, it can consume more power than some other
sensors, which could be a concern in battery-powered or energy-sensitive systems.

h. Limited Data Processing Capability:

 Processing Limitations of Arduino Uno: While the Arduino Uno is a versatile


microcontroller, it has limited processing power and memory. Complex calculations, large
datasets, or rapid real-time data processing might strain the Arduino, especially if multiple
sensors or other peripherals are used alongside the ultrasonic sensor.

i. Sensor Placement and Alignment:

 Correct Alignment Needed: Ultrasonic sensors require careful alignment to ensure accurate
measurements. If the sensor is not aligned properly with the target, the distance
measurement may be off or completely incorrect.
 Varying Measurements with Surface Angle: The angle at which the sound waves hit the
object can affect the measurement. If the object is angled away from the sensor, the
reflected waves may not return to the sensor properly, leading to errors.

j. Limited to 2D Measurements:

 Cannot Measure Height or Depth: Ultrasonic sensors can typically only measure distance in one
dimension. For 3D measurement applications (e.g., detecting the exact position of objects in
space), multiple sensors would need to be employed, or other types of sensors (e.g., LiDAR) may
be more suitable.

3.3 APPLICATIONS:

3.3.1. Obstacle Detection and Avoidance in Robotics:

 Robots and Autonomous Vehicles: Ultrasonic sensors paired with an Arduino Uno are
commonly used in robots or autonomous vehicles for obstacle detection and avoidance.
The sensor helps measure the distance to nearby objects, allowing the robot to navigate
around obstacles by adjusting its path in real-time.
 Examples:
o Self-driving robots
o Drones for automatic navigation

29
o Automated guided vehicles (AGVs) in warehouses

3.3.2. Proximity Sensing in Automation Systems:

 Industrial Automation: Ultrasonic sensors are widely used in automated systems to detect
the presence or absence of objects in a particular area. This is crucial in manufacturing lines
for process control or product handling.
 Examples:
o Automatic door openers (proximity sensors to detect people walking by)
o Conveyer belt systems for detecting product position
o Automatic bin fillers in material handling

3. 3.3 Liquid Level Sensing:

 Water or Liquid Tanks: Ultrasonic sensors can be used to measure the level of liquids in
tanks, silos, or containers without contact. By calculating the distance between the sensor
and the liquid surface, you can determine how much liquid is in the container.
 Examples:
o Monitoring water levels in tanks
o Fuel tank level monitoring in industrial systems
o Chemical storage and level monitoring

3.3.4. Parking Assistance Systems:

 Automobile Parking Sensors: Ultrasonic sensors are used in parking assistance systems for
automobiles. The sensor detects how far an object (e.g., a wall, another car, or a curb) is
from the vehicle, and feedback is provided to the driver to assist with parking.
 Examples:
o Car parking sensors (beeping or visual display for parking assistance)
o Smart parking solutions (integrated with mobile apps to show available parking
spaces)

3.3.5. Distance Measurement for CNC Machines:

 Positioning and Alignment in Manufacturing: Ultrasonic sensors are used in CNC (Computer
Numerical Control) machines for accurate measurement and alignment of parts or tools.
They help ensure that the machines perform precise operations by measuring distances
accurately.
 Examples:
o Alignment of machine parts or tools
o Distance monitoring to ensure precision during CNC machining

3.3.6. Distance Measurement for 3D Mapping and Scanning:

 3D Mapping: By using multiple ultrasonic sensors in a grid-like setup, it's possible to create
3D distance maps of environments. This application can be useful for creating detailed
topographic maps or modeling spaces.
 Examples:

30
o 3D scanning for room or object mapping
o Environmental mapping for robotic navigation

3.3.7. Height Measurement:

 Height or Elevation Detection: Ultrasonic sensors can be used to measure the height or
elevation of an object from the ground or another reference point. This is useful in various
applications where height precision is required.
 Examples:
o Measuring the height of vehicles in automated toll systems
o Height monitoring for material handling equipment or forklifts

3.3.8. Smart Home Applications:

 Smart Appliances: Ultrasonic sensors can be integrated with smart home systems to
automate and control appliances or lighting systems. For instance, when someone
approaches, the sensor detects their presence and turns on lights or adjusts heating
systems.
 Examples:
o Smart lighting systems (lights turn on when you approach)
o Motion sensors in security systems
o Automated curtain systems that open when someone enters the room

3.3.9. Object Counting and Position Tracking:

 Inventory and Object Tracking: Ultrasonic sensors can count objects or track their positions
within a specific area. For instance, sensors can be used to count the number of objects
passing through a conveyor or track their position in a storage system.
 Examples:
o Automated inventory management
o Object tracking in warehouses

3.3.10. Distance Measurement for Educational Projects:

 STEM Education: The Arduino Uno and ultrasonic sensor are popular choices for educational
projects, as they offer hands-on experience with basic principles of electronics,
programming, and sensors. Students can learn how sensors work and how data from real-
world environments can be processed by microcontrollers.
 Examples:
o Educational robot building projects
o DIY distance measurement systems
o Science experiments related to physics and sound waves

3.3.11. Agricultural Applications:

 Field and Crop Monitoring: Ultrasonic sensors can be used in agriculture for monitoring the
height of plants, checking soil levels in irrigation systems, or measuring the distance from
the ground to crops in automated farming setups.

31
 Examples:
o Crop height measurement in precision farming
o Monitoring the level of soil moisture in irrigation systems

CHAPTER – 4

4.0 HARDWARE IMPLEMENTATION

32
Fig: distance measurement circuit
The working of the project is explained here: First of all we need to trigger the
ultrasonic sensor module to transmit signal by using arduino and then wait for receive
ECHO.This technique of distance measurement using ultrasonic in air includes continuous
pulse echo method, a burst of pulse is sent for transmission medium and is reflected by an
object kept at specific distance. The time taken for the sound wave to propogate from
transmitter to receiver is proportional to the distance of the object. In this distance
measurement system we had ultrasonic sensor HC-SR04 interfaced with Arduino UnoR3.
Programming and hardware part of ultrasonic sensor interfacing with Arduino UnoR3.servo
motors are used to control the position of objects, rotate objects, move legs, arms or hands of
robots, move sensors etc. with high precision. Servo motors are small in size, and because
they have built-in circuitry to control their movement, they can be connected directly to an
Arduino. The rest of the calculations are made in the programming part of the Arduino UNO
Components used:

Fig: Arduino Fig: ultrasonic


sensor

Fig: 16*2 Display Fig: Jumper wires

Arduino Uno specifications:


 Microcontroller: ATmega328P
 Operating Voltage: 5V
 Input Voltage (recommended): 7-12V

33
 Inout Voltage (limit): 6-20V
 Digital I/O Pins: 14 (of which 6 provide PWM output)
 PWM Digital I/O Pins: 6
 Analog Input Pins: 6
 DC Current per I/O Pin: 20 mA
 DC current for 3.3V Pin: 50 mA
 Flash Memory: 32 KB (ATmega328P) of which 0.5 KB used by bootloader
 SRAM: 2 KB (ATmega328P)
 EEPROM: 1 KB (ATmega328P)
 Clock Speed: 16 MHz
 LED_BUILTIN: 13
 Length: 68.6 mm
 Width: 58.4 mm
 Weight: 25 g

The Arduino Uno board can be powered via a USB connection or with an external
power supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected
by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery
can be inserted in the GND and Vin pin headers of the POWER connector. The board can
operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the
5V pin may supply less than five volts and the board may become unstable. If using more
than 12V, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts.

The power pins are as follows:

 Vin. The input voltage to the Arduino/Genuino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated power sources).
You can supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
 5V.This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or
the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the
regulator, and can damage your board. We don't advise it.
 3V3. A 3.3 volt supply generated by the on-board regulator. The maximum current draw is 50
mA. microcontroller operates. A properly configured shield can read the IOREF pin voltage
and select the appropriate power source or enable voltage translators on the outputs to work
with the 5V or 3.3V
 GND. Ground pins.
 IOREF. This pin on the Arduino/Genuino board provides the voltage reference with which
the

16*2 Display specifications:

 Operating Voltage: 4.7V to 5.3V


 Operating Current 1mA (without backlight)
 Can display (16x2) 32 Alphanumeric Characters

34
 Custom Characters Support
 Works in both 8-bit and 4-bit Mode

RG 1602 ,16x2 LCD Display in a captivating blue hue, perfect for your electronics
projects. This versatile and reliable LCD screen features a 16x2 character layout, allowing
for clear and crisp text display. Its compact design and easy-to-use interface make it ideal
for a wide range of applications. Whether you're a hobbyist or a professional, this high-
quality LCD display with a soothing blue backlight will enhance your projects and
captivate your audience. Explore the possibilities today

This 16x2 Blue Jumbo Display, featuring the same captivating blue color but with a
larger font size for enhanced visibility. This display offers 2 lines, each with 16
characters, capable of displaying both alphanumeric characters and numbers. Its versatile
functionality makes it perfect for applications such as data scanners and meters, providing
clear and easy-to-read indications of critical information

ultrasonic sensor specifications:

 Power Supply: DC 5V
 Working Current: 15mA
 Working Frequency: 40Hz
 Ranging Distance : 2cm – 400cm/4m
 Resolution : 0.3 cm
 Measuring Angle: 15 degree
 Trigger Input Pulse width: 10uS
 Dimension: 45mm x 20mm x 15mm

One of the most popular ultrasonic sensors would be the HC-SR04. The configuration pin of HC-
SR04 is VCC (1), TRIG (2), ECHO (3), and GND (4). The supply voltage of VCC is 5V and you
attach TRIG and ECHO pin to any Digital I/O in your Arduino Board to power it.

jumper wires specifications:

 Current. 4-20 mA.


 Voltage. 12 V.
 Rated Pressure. 25 kPA.
 Pitch. 2.54 mm.
 Cable Length. 20 cm - 8 Inch.
 Weight. 30 gm.
 Accuracy. 0.25%F.S.
Each conductor shall be uniformly covered with fire-resistive PVC insulation.
The tensile strength of the material shall at least be 120 Kg/cm2 and its elongation, minimum
100%.
The nominal thickness of the PVC insulation shall be 0.25mm. Over all Insulated Conductor
Diameter = 1.10 mm with a tolerance of +0.01mm.
The insulation shall neither be loose around the wire nor adhere to it.

35
CODE:

#include <LiquidCrystal_I2C.h> //i2c library file


LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line
display
int trigPin = A0;
int echoPin = A1;

long distance;
long distanceInch;
long duration;

void setup(){
lcd.init();
lcd.backlight();
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

lcd.setCursor(0,0);
lcd.print(" EEE B.Tech");
lcd.setCursor(0,1);
lcd.print("2rd YEAR STUDENTS");
delay(2000);
}

void loop() {
ULTRASONIC();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("DISTANCE CM:");
lcd.print(distance);
lcd.setCursor(0,1);
lcd.print("DISTANCE INCH:");
lcd.print(distanceInch);

// lcd.setCursor(0,1);
// lcd.print("DISTANCE MM:");
// lcd.print(distanceInch);
}

void ULTRASONIC(){

36
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration*0.034/2;
distanceInch = duration*0.0133/2;
}

CHAPTER – 5

CONCLUSION AND FUTURE SCOPE

CONCLUSION:

Distance measurement using ultrasonic sensors and Arduino is a popular research area
with various applications. The results of this review indicate that ultrasonic sensors and Arduino
are widely used in the development of electronic projects related to distance measurement.
Further research is needed to explore the potential of these technologies in various other
applications

Distance =speed*time

The human audible range can be converted measure the distance precisely manner

FUTURE SCOPE:

The range can be improved by:

1.Using temperature adjustable devices, it can be used over wide temperature range.

2. Using High Range Ultrasonic sensors to extend the range of distance measurement.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy