Simple Distance Measuring Device

19,218

282

34

About: Hi, I'm Samy. I make electronic projects with Arduino and Raspberry Pi. I love sharing my projects and I want to help the open-source community! I hope you like my projects as much as I enjoy making them.

In this project we are going to learn how to use the HC-SR04 PING))) ultrasonic sensor to measure distance. This sensor is also often used on robots to detect obstacles.

Difficulty level: Easy

Time needed: ±10 minutes

Step 1: Things You'll Need

HC-SR04 PING sensor (x1)

Arduino UNO (x1)

LCD 16x2 (x1)

9V battery + dc adaptor (x1)

Potentiometer 10kΩ (x1)

Set of jumper wires

Step 2: Plug the PING Sensor and LCD

HC-SR04

GND (pin 1) to potentiometer (left pin)

VCC (pin 2) to potentiometer (right pin)

VO (pin 3) to potentiometer (center pin)

RS (pin 4) to arduino digital pin 12

RW (pin 5) to potentiometer (left pin)

E (pin 6) to arduino digital pin 11

D4 (pin 11) to arduino digital pin 5

D5 (pin 12) to arduino digital pin 4

D6 (pin 13) to arduino digital pin 3

D7 (pin 14) to arduino digital pin 2


Potentiometer

left pin to arduino GND

right pin ro arduino 5V


PING Sensor

VCC to arduino 5V

Trig to arduino digital pin 7

Echo to arduino digital pin 6


9V battery

To arduino DC power socket

Step 3: Upload the Code

Step 4: Have Fun! Show It to Your Friends :)

Yay! you have finished making your own measuring device. Now you can measure things without using a ruler! You can adjust the LCD brightness using the potentiometer. Feel free to give comments or ask questions and stay tune for my next project ; )

Share

Recommendations

  • Sensors Contest

    Sensors Contest
  • Sew Tough Challenge

    Sew Tough Challenge
  • Barbeque Challenge

    Barbeque Challenge

34 Discussions

0
None
seshadhri

7 months ago on Step 3

thank you for sending the code
boss

0
None
seshadhri

Question 7 months ago

send the code to me the code is not correct

0
None
ManideepS1

2 years ago

Can u please make a how to make video

0
None
TaisH

2 years ago

How will this react if the surface is not parallel? Can i read it then?

0
None
kenengineboy12

2 years ago

please i will like to get your contact, I need to discuss with you

0
None
Neiljams

2 years ago

How can i get the LCD display to show the the distances more clearer? Mine seems to be pretty dark even with the 10k trim pot adjusted the best it can be.

0
None
nageshwararvi

3 years ago

LCD display connection?
which is ping sensor here?
thank?

0
None
RishabhM18

3 years ago

I can connect phone in the place of LCD screen

0
None
RishabhM18

3 years ago

I can connect phone in the place of LCD screen

0
None
RishabhM18

3 years ago

I can connect phone in the place of LCD screen

0
None
ApoorvC1

3 years ago

Awsm bro

0
None
ApoorvC1

3 years ago

Awsm bro

0
None
akashs10

4 years ago on Introduction

i have ir sharp sensor (range- 20cm-150cm).will it work instead of the ping sensor used here????

2 replies
0
None
Samuel_Alexanderakashs10

Reply 4 years ago

You can replace the ping sensor with your ir sensor, but you'll have to modify your code and the wiring. if you let me know your email I can help you :)