Introduction: Arduino Distance Finder

About: I'm Electrical Engineering Student, Coffee Lover, Automated System designer, Programmer and Security System Designer.

This is a breadboard based project which uses Atmel Atmega 2560 (Arduino Mega) to find the distance using Ultrasonic Sensor. The output can be obtained in "cm" on both 16x2 LCD Screen and Serial Monitor of Arduino IDE. We can also use 16x2 LCD Screen or Serial Monitor at the single time, means one thing is optional. The whole circuit is powered by +5V and +3.3V of Arduino Mega. The attached code can also be modified for other Arduino Products.

Step 1: Requirements

The following things are required to get this project done:

1- Arduino Mega or Arduino UNO

2- Potentiometer (eg 5K) (optional)

3- LCD 16x2 (optional)

4- Ultrasonic sensor

Step 2: Pin-outs & Wiring

The Pin-outs & Wiring of Arduino Mega or Arduino UNO and other peripheral is attached with this step and also given following:


Arduino => LCD


+5V => VDD or VCC


8 => RS


9 => E

4 => D4

5 => D5

6 => D6

7 => D7

+3.3V => A

GND => K

Arduino => Potentiometer


+5V => 1st pin

GND => 3rd pin

Potentiometer => LCD


2nd pin => Vo

=> You can set contrast using Potentiometer

Arduino => Ultrasonic sensor


10 => VCC

11 =>Trig

12 => Echo

13 => GND

Step 3: Upload the Code

Upload the code to Arduino Mega or Arduino UNO. After uploading the code to Arduino, open Serial Monitor of Arduino IDE to get the output. You can also attach 16x2 LCD Screen to obtain the output. The Arduino .ino file is also attached with this step.