• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

New Projects | Privacy Policy | About us | Contact | Disclaimer | Copyright | Videos | Circuits for Beginners | Basic Circuits | Hobby Projects | Transistor Circuits | LED Drivers 

You are here: Home / Arduino Engineering Projects / Ultrasonic Distance Meter Circuit Using 16×2 LCD

Ultrasonic Distance Meter Circuit Using 16×2 LCD

Last Updated on September 30, 2020 by Swagatam

caution electricity can be dangerous

In this article we are going to construct an ultrasonic distance meter circuit using Arduino and 16x2 LCD. We are also going to see what an ultrasonic module is, how it works and how it can be used to measure distance.

What is ultrasonic?

An average healthy human being can hear frequencies ranging from 20 Hz to 20,000 Hz. Above 20,000Hz or 20 KHz human ear is incapable of detecting these frequencies. Any acoustic resonates greater than 20 KHz is called as ultrasonic and any acoustics resonates less than 20 Hz is called infrasonic.

Most of the domestic animals such cat or dog, can hear wide range of acoustic frequency greater than human beings. Some of our electronic devices may annoy them; that's why ultrasonic sound is being used in electronic mosquito repellents and also in dog repellents.

But many of the wild animals such as bats take advantage of ultrasonic, which helps them to determine the distance between the predator and prey. It has biological sensors which calculate the distance by emitting and receiving ultrasonic waves.

This principle is utilized in many modern electronic measuring equipment; we will learn how the same principle could be applied for the present project also.

Ultrasonic sensor:

We are going to use a special electronic device ultrasonic transceiver module HC-SR04 which is very popular and commonly available on e-commerce sites and electronic retail stores.

It consists of 4 pins Vcc, ground, trigger and echo. These pins are interfaced with arduino microcontroller.

It has a transmitter and receiver modules which look identical and are protected by aluminum cylinder and mesh at the opening of transmitter and receiver. The module also consists of microcontrollers which decodes echo signals.

To measure distance, we need to send series of ultrasonic bursts and listen for the echo. To do this we need to keep the trigger pin high for 10 microseconds, the transmitter sends out 8 pulses of ultrasonic bursts.

The receiver module listens to those bursts after hitting an obstacle. The echo pin gives out high signal proportional to the distance. The Arduino interpret the time of sent and received signals to determine the actual distance.

Since the sound travels at 340 m/s in air and the time can be determined by comparing sent and received signals, we can determine distance by using speed-distance formula:

Distance = speed x time

These values will be calculated by Arduino and print appropriate values on the LCD display. The proposed ultrasonic distance meter circuit can show distance in centimeter as well as in meter.

Author’s prototype:

Tested working model of Ultrasonic Distance Meter Circuit Using 16x2 LCD

Circuit diagram:

Ultrasonic Distance Meter Circuit Using 16x2 LCD

The ultrasonic distance meter circuit connection is done through a standard arduino-LCD interface, which we can also find on many other similar arduino-LCD based projects. The potentiometer is used to adjust the contrast of LCD display.

The ultrasonic sensor can be directly inserted on analog pin as shown in author’s prototype from A0 to A3, sensors facing outwards; this may reduce wire congestion while duplicating the above circuit.

Program Code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
const int trigger = A1;
const int echo = A2;
int vcc = A0;
int gnd = A3;
long Time;
float distanceCM;
float distanceM;
float resultCM;
float resultM;
void setup()
{
   lcd.begin(16,2);
  pinMode(trigger,OUTPUT);
  pinMode(echo,INPUT);
  pinMode(vcc,OUTPUT);
  pinMode(gnd,OUTPUT); 
}
void loop()
{
  digitalWrite(vcc,HIGH);
  digitalWrite(gnd,LOW);
  digitalWrite(trigger,LOW);
  delay(1);
  digitalWrite(trigger,HIGH);
  delayMicroseconds(10);
  digitalWrite(trigger,LOW);
  Time=pulseIn(echo,HIGH);
  distanceCM=Time*0.034;                
  resultCM=distanceCM/2;
  resultM=resultCM/100;
  lcd.setCursor(0,0);
  lcd.print("Distance:");
  lcd.print(resultM);
  lcd.print("M");
  lcd.setCursor(0,1);
  lcd.print("Distance:");
  lcd.print(resultCM);
  lcd.print("cm");
  delay(1000);
}

You'll also like:

  • 1.  Arduino Digital Clock Using RTC Module
  • 2.  Digital Weighing Scale Using Load Cell and Arduino
  • 3.  2.4 GHz 10 Channel Remote Control Switch
  • 4.  Incubator Using Arduino with Automatic Temperature and Humidity control
  • 5.  How to Make Arduino on Breadboard – Step by Step Instructions
  • 6.  High Current Motor Control Circuit using Arduino

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

Reader Interactions

Comments

  1. Prasanta Pal says

    January 13, 2019

    Can we have a hold data button to the circuit??

  2. Abhishek says

    August 20, 2017

    #include

    this should be written as…

    #include

  3. Şeyma Hasdemir says

    June 10, 2016

    Very good but I dont understand which distance how is working

Primary Sidebar

Calculators

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (98)
  • 741 IC Circuits (19)
  • Arduino Engineering Projects (83)
  • Audio and Amplifier Projects (114)
  • Battery Chargers (82)
  • Car and Motorcycle (94)
  • Datasheets (46)
  • Decorative Lighting (Diwali, Christmas) (33)
  • Electronic Components (100)
  • Electronic Devices and Circuit Theory (36)
  • Electronics Tutorial (116)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (13)
  • GSM Projects (9)
  • Health Related (20)
  • Heater Controllers (29)
  • Home Electrical Circuits (102)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (12)
  • LED and Light Effect (93)
  • LM317/LM338 (21)
  • LM3915 IC (25)
  • Meters and Testers (65)
  • Mini Projects (148)
  • Motor Controller (67)
  • MPPT (7)
  • Oscillator Circuits (26)
  • PIR (Passive Infrared) (8)
  • Power Electronics (34)
  • Power Supply Circuits (77)
  • Radio Circuits (10)
  • Remote Control (48)
  • Security and Alarm (61)
  • Sensors and Detectors (120)
  • SG3525 IC (5)
  • Simple Circuits (75)
  • SMPS (29)
  • Solar Controllers (60)
  • Timer and Delay Relay (53)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (40)
  • Ultrasonic Projects (16)
  • Water Level Controller (45)

Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator

© 2023 · Swagatam Innovations