• Skip to main content
  • Skip to primary sidebar

Making Easy Circuits

Learn and build electronic circuits

You are here: Home / Arduino / How to Measure Distance using Arduino (Ultrasonic)

How to Measure Distance using Arduino (Ultrasonic)

Last Updated on May 29, 2025 by Admin 2 Comments

In this article we learn how to measure distance using Arduino which makes use of Ultrasound in order to calculate distance. Assessed distance is exhibited on LIQUID CRYSTAL DISPLAY. One incorporate the use of this particular digital output info to produce numerous fascinating initiatives for instance accident resistant automobile or Robots, item locator, Sonar (recognition of materials beneath water) etc.

distance measure circuit using arduino

Sound is actually a kinetic vibration transmitted through an stretchy medium. Ultrasound tend to be involving frequencies higher than 20,000 Hz. Human being can easily only listen to somewhere around between TWENTY Hz and 20,000 Hz.

The rate at which sound moves is determined by the actual medium that it goes over as a result of. Throughout the air acceleration is somewhere around 345 m/s, inside water 1500 m/s and in a metal of stainlesss steel 5000 m/s. Therefore we are able to make use of ultrasound and also simply by determining Period we are able to obtain distance. This specific form of range locating can also be referred to as Sonar. Sonar is effective in the same way as Radar. To be able to calculate the distance of a sound travelled, it necessitates to get reflected. distance = time X velocity.

Within this project anyone will be needing Transducer and Sensors pertaining to Ultrasound Transmission and Recognition. A single this sort of Transceivers is HC-SR04 Module. Most of these units normally transmit a quick burst of ultrasonic sound in the direction of a target as well as identify sound back to the sensor. Apart from this one may require Arduino Board along with 16×2 Lcd-display.

 

To make this Arduino based distance measuring circuit you will need:

Arduino board

LCD module

40kHz Ultrasonic sensors

 

Arduino Program Sketch Code

//programme by Mr. Syed Ali//
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int trigPin = 8;
const int echoPin = 13;
 
void setup() 

  {
    lcd.begin(16, 2);
  }
 
void loop()
{
  
  long int duration, inches, meter;
 
  
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
 
 
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
 
  inches = microsecondsToInches(duration);
  meter = microsecondsToMeters(duration);
  
  
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(inches);
  lcd.setCursor(5,0);
  lcd.print("Inches");
  lcd.setCursor(0,1);
  lcd.print(meter);
  lcd.setCursor(5,1);
  lcd.print("Meter");
  delay(1000);
}
 
long int microsecondsToInches(long microseconds)
       {
       return microseconds / 74 / 2;
       }


long int microsecondsToMeters(long microseconds)
       {
       return microseconds / 2900 / 2;
       }

You'll also like:

  • 1.  Seismic Sensor Circuit
  • 2.  Light Activated Switch Circuit
  • 3.  How to Make a Sinewave Inverter Circuit Using Arduino
  • 4.  Simple PIR Water Sprinkler Circuit
  • 5.  Proximity Detector Circuit – LC Tuned IC CS209
  • 6.  Transmitter Bug Detector Circuit

About Admin

Hey friends, Thanks a bunch for stopping by this site! I am an engineer with a Bachelor of Engineering in Electronics and Telecommunication. One of my passions is gathering information from all sorts of electronics books and tutorials. I then take that information and compile it into a language that is super easy to understand. My goal is to make those complex electronics circuit concepts and technical terms much more accessible for all the new and budding electronics engineers out there. I can also design customized circuit diagrams as required by the users.
If you have any questions related to this field, please do not hesitate to drop a comment! I am always here and ready to help you out with any queries you might have. I cannot wait to hear from you!

Reader Interactions

Comments

  1. Marcello says

    December 7, 2021 at 6:29 am

    Schematics missing …

    Reply
    • admin says

      December 7, 2021 at 11:15 am

      yes, can’t seem to find it now….

      Reply

Leave a Reply Cancel reply

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

Primary Sidebar

Categories

  • 3 Phase (4)
  • 8051 Microcontroller (1)
  • Arduino (11)
  • Audio and Amplifier (102)
  • Automation (8)
  • Battery Chargers (64)
  • Bicycle Projects (4)
  • Car and Motorcycle Projects (39)
  • Datasheets (10)
  • DIY Projects (5)
  • Electrical (15)
  • Free Energy (6)
  • Games Projects (2)
  • High Voltage (14)
  • Hobby Projects (30)
  • Household Circuits (2)
  • IC 555 Circuits (4)
  • Ignition Circuits (2)
  • Indicators (50)
  • Infrared (6)
  • Inverter Circuits (29)
  • Lights and Lamps (97)
  • Medical (8)
  • Meter and Tester Circuits (38)
  • Motor Driver (17)
  • New Circuits (56)
  • Oscillators (30)
  • Pets and Pests (5)
  • Power supply (81)
  • Protection Circuits (25)
  • PWM (8)
  • Remote Control (20)
  • Security and Alarm Circuit (48)
  • Sensors and Detectors (66)
  • Signal Processor (23)
  • Solar Controller Circuits (61)
  • SSR (3)
  • Temperature Controller (20)
  • Timer (25)
  • Transformerless (7)
  • Transmitters (12)
  • Tutorials (45)
  • UPS (2)
  • Voltage Regulators (57)
  • Water Sensor and Controller (29)
  • Home
  • Privacy Policy
  • Contact
  • Disclaimer
  • Copyright

© 2025 · Making Easy Circuits