• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Need circuit help? Post them in the comments! I've answered over 50,000!

Blog | Categories | About | Contact | Calculators-online
You are here: Home / Arduino Projects / Ultrasonic Distance Meter Circuit Using 16×2 LCD

Ultrasonic Distance Meter Circuit Using 16×2 LCD

Last Updated on December 5, 2024 by Swagatam 3 Comments

In this article I will show how 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.

Table of Contents
  • What is ultrasonic?
  • Ultrasonic sensor:
  • Author’s prototype:
  • Circuit diagram:
  • Program Code:

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; I have explained 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.  Introduction to I2C LCD Adapter Module
  • 2.  How to Make a Simple Math Calculator using Arduino
  • 3.  Learning Basic Arduino Programming – Tutorial for the Newcomers
  • 4.  Digital Weighing Scale Using Load Cell and Arduino
  • 5.  Arduino Pure Sine Wave Inverter Circuit with Full Program Code
  • 6.  Playing a Melody Using the Tone() function in Arduino

About Swagatam

I am an electronics engineer with over 15 years of hands-on experience. I am passionate about inventing, designing electronic circuits and PCBs, and helping hobbyists bring their projects to life. That is why I founded homemade-circuits.com, a website where I share innovative circuit ideas and tutorials. Have a circuit related question? Leave a comment.... I guarantee a reply!

Previous Post: « Motorized Sun Shade Circuit
Next Post: 6 watt Audio Amplifier Circuit Using TDA1011 »

Reader Interactions

Comments

  1. Prasanta Pal says

    January 13, 2019 at 2:52 pm

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

    Reply
  2. Abhishek says

    August 20, 2017 at 11:30 am

    #include

    this should be written as…

    #include

    Reply
  3. Şeyma Hasdemir says

    June 10, 2016 at 8:05 am

    Very good but I dont understand which distance how is working

    Reply

Need Help? Please Leave a Comment! We value your input—Kindly keep it relevant to the above topic! Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Subscribe to New Circuit Ideas

Categories

  • Arduino Projects (87)
  • Audio and Amplifier Projects (132)
  • Automation Projects (17)
  • Automobile Electronics (101)
  • Battery Charger Circuits (83)
  • Datasheets and Components (104)
  • Electronics Theory (143)
  • Free Energy (37)
  • Games and Sports Projects (11)
  • Grid and 3-Phase (19)
  • Health related Projects (25)
  • Home Electrical Circuits (12)
  • Indicator Circuits (14)
  • Inverter Circuits (87)
  • Lamps and Lights (142)
  • Meters and Testers (69)
  • Mini Projects (46)
  • Motor Controller (64)
  • Oscillator Circuits (27)
  • Pets and Pests (15)
  • Power Supply Circuits (108)
  • Remote Control Circuits (50)
  • Security and Alarm (64)
  • Sensors and Detectors (101)
  • Solar Controller Circuits (59)
  • Temperature Controllers (42)
  • Timer and Delay Relay (49)
  • Transmitter Circuits (29)
  • Voltage Control and Protection (37)
  • Water Controller (36)

Calculators

  • 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
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator
  • Filter Capacitor Calculator
  • Buck Converter Calculator
  • Boost Converter Calculator
  • Solar Panel, Inverter, Battery Calculator
  • Wire Current Calculator
  • SMPS Transformer Calculator
  • IC SG3525, SG3524 Calculator
  • Inverter LC Filter Calculator

People Also Search

555 Circuits | 741 Circuits | LM324 Circuits | LM338 Circuits | 4017 Circuits | Ultrasonic Projects | SMPS Projects | Christmas Projects | MOSFETs | Radio Circuits | Laser Circuits | PIR Projects |

Recent Comments

  • Swagatam on Understanding SG3525 IC Pinouts
  • Dan on Understanding SG3525 IC Pinouts
  • Swagatam on High Current Wireless Battery Charger Circuit
  • Swagatam on Timer Based Cell Phone Charger Circuit
  • Nitesh Agrawal on Timer Based Cell Phone Charger Circuit

Company

  • Privacy Policy
  • Cookie Policy
  • About Me
  • Contact
  • Disclaimer
  • Copyright
  • Videos
  • Sitemap

Social Profiles

  • Twitter
  • YouTube
  • Instagram
  • Pinterest
  • My Facebook-Page
  • Quora
  • Stack Exchange
  • Linkedin
  • © 2025 · Swagatam Innovations