Introduction: Distance Measuring Device

Hey, Guys, I'm Sridhar Janardhan back with another tutorial.This time I am going to teach you how to create your own distance measuring instrument under 10$.I have tried my best to keep this ibles very simple so even a beginner can crack it down.This ibles needs a sensor called ultrasonic sensor whose operation will be explained in the later part of the ibles.So now let's start to gather the components.

Step 1: Components Required:

The components required for this tutorials are:

  • Arduino Uno
  • Jumper wire
  • Ultrasonic sensor
  • LCDI2cBreadboard

Step 2: HC-05 Ultrasonic Sensor:

The HC-05 Ultrasonics sensor is a device that is designed to measure the distance of an obstacle placed in front of them.it has two eye-like things the echo and trig.The echo pin emits a wave that travels through the medium and reflects back as soon as it hits the obstacles.The reflected wave triggers the trig pin, The time taken between the emitting and triggering the trig pin is calculated to estimate the distance between the sensor and the object.

Pin description of the HC-0s sensor:

  • TRIG pin: This pin triggers the sensor and sends a control signal indicating the conveying of the objects.
  • VCC pin: The positive power supply is given to this pin.
  • GND pin: the Grounded power supply is given to this pin.
  • ECHO pin: The pin that is used to send the wave into the medium

Pin connection as follows:

  • TRIG pin: digital pin 13
  • ECHO Pin: digital pin 12
  • VCC pin:Positive railing of the breadboard
  • GND pin:Negative railing of the breadboard

Let's now connect the LCD.

Step 3: Connecting LCD:

I have soldered I2C TO lCDto make the connection easy.

To know the tutorial on how to connect I2C to LCD please click here

The connection of LCD is as follows:

  • The SDA pin to Arduino analog pin A0.
  • The SDL pin to Arduino analog pin A1.
  • The VCC pin to the positive railing of the breadboard.
  • The GND pin to the negative railing of the breadboard.

Let's get into coding

Step 4: Coding

#include

LiquidCrystal_I2C lcd(0x3f, 16, 2);

void setup() {

lcd.begin();

Serial.begin(115200);

} void loop() {

lcd.setCursor(0, 0);

lcd.print("time: ");

lcd.print(duration);

lcd.print(" us ");

lcd.setCursor(0, 1);

if( duration > 38000 ) {

lcd.println("out of reach ");

} else {

lcd.print("dist: ");

lcd.print(distance);

lcd.println(" cm "); }

}

}

Step 5: Output

Comments

author
Joshua_Howe made it! (author)2017-07-12

Love the project, thank you. I've been thinking of something similar for my bike. Would its response time be quick enough to capture the distance of a car passing from behind? What's the maximum distance it picks up from? I'm assuming it could be coulpled with a logger of some sort where you cold retrieve the data at a later time.

author
OskarW2 made it! (author)OskarW22017-07-14

Just talking from experience with mine:

The max distance i ever recorded was around 4-5m.

It has fairly quick response time, microseconds.

Hope it helps you!

author
Joshua_Howe made it! (author)Joshua_Howe2017-07-14

Thanks, that's far enough (about 1m is law, so I'm more interested in who's closer than that.)

About This Instructable

1,088views

39favorites

License:

Bio: I am an electronic hobbyist on Arduino, Photon, Raspberry Pi and common electronics.A passionate cook.Any assistance in electronics and web development feel free ... More »
More by callmeappytechie:IFTTT Using PhotonPhoton:Displaying Values of DHT11 Using Blynk Node:Ultrasonic Sensor With Blynk
Add instructable to: