Picture of Arduino Range Finder Tutorial
Make your first project with an arduino UNO or any arduino, and a range finder sensor
Remove these adsRemove these ads by Signing Up

Step 1: Make Sure You've Got Everything!

Picture of Make Sure You've Got Everything!
Your gunna need- 4 jumper wires 1 arduino ( I used UNO) 1 breadboard 1 data cable to program the arduino 1 hc-sro4 sensor

Step 2: Plug Your Sensor Into The Breadboard

Picture of Plug Your Sensor Into The Breadboard
Put your sensor into the breadboard along with 4 jumper wires.

Step 3: Attach To Arduino

Picture of Attach To Arduino
Gnd - gnd Echo- digital pin 2 Trig - digital pin 3 Vcc - 5v

Step 4: Write The Code

Picture of Write The Code
2013 17:30.jpg
Just copy from photo

Step 5: Plug In And Upload

Picture of Plug In And Upload
2013 17:30.jpg
Plug your arduino into your pc and upload. Open serial monitor in top right corner and have fun. You can use this with hundreds of projects good luck
supah4x0r3 months ago

#define trigPin 3

#define echoPin 2

void setup()



pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);


void loop()


int duration, distance;

digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;





supah4x0r3 months ago

Nice, simple, very well done.

JoeS97 months ago

Excellent basic tutorial, it helped me set mine up with a minimum of problems.