Project tutorial
Ultrasonic Range Detector With Arduino

Ultrasonic Range Detector With Arduino © MPL-2.0

This is a preliminary project that will take you through the steps I took to get the SR04 ULTRASONIC SENSOR.

  • 28,885 views
  • 7 comments
  • 26 respects

Components and supplies

About this project

Ultrasonic Range Detector With Arduino Using The SR04 Ultrasonic Sensor

This is a preliminary project that will take you through the steps I took to get the SR04 ULTRASONIC SENSOR connected and working to the Arduino.

Step 1: Parts List

  • Arduino Uno or compatable
  • SR04 Ultrasonic Sensor
  • Four male to female Jumper Wires

Let’s do it!.

Step 2: Connecting the SR04 Ultrasonic Sensor to the Arduino

  • VCC pin to the Arduino 5v
  • GND pin to the Arduino GND
  • TRG pin to the Arduino Digital pin 12
  • ECHO pin to the Arduino Digital pin 11

That's all the wiring you need..

Next step, load the Software library and sketches.

Step 3: Download SR04 Library and install to Arduino IDE

You need to download another Library to get the Arduino to talk with the SR04 sensor. The sensor I got didn't come with any documentation, so I Googled around until I found a library that works.

Download the library unzip it, and install it in the Arduino IDE. Place it inside your Arduino libraries folder , and restart the Arduino IDE. For convenience, I included the file in the files section below,

  • You should now be able to see the library and examples in select File > Examples > NewPing > NewPingexample sketch load the sketch to your Arduino.
  • If you were successful at installing the libraries, and loading the NewPingexample sketch, Compile the sketch by clicking on the verify button and make sure there are no errors.

It's time to connect your Arduino to your PC using the USB cable. Click on the upload button to upload the sketch to the Arduino.

Once uploaded to the Arduino, open the serial monitor, and you should see the distance data stream coming from the sensor,

Click here to download the library.

To get all the resources.

Thank you!

Code

NewPing.zipC/C++
No preview (download only).

Schematics

Arduino to Sensor
Img 20160509 171619

Comments

Similar projects you might like

Ultrasonic Range Finder

Project tutorial by Saaket Poray

  • 9,417 views
  • 8 comments
  • 10 respects

Food Detector

Project tutorial by crispylel

  • 35,424 views
  • 7 comments
  • 91 respects

Simple Ultrasonic Distance Measurer With LCD Display

Project showcase by onatto22

  • 5,697 views
  • 4 comments
  • 19 respects

Ultrasonic Map-Maker using an Arduino Yun

Project tutorial by Satyavrat Wagle

  • 51,862 views
  • 37 comments
  • 152 respects

Detecting Obstacles and Warning - Arduino and Ultrasonic

Project tutorial by Ammar Atef Ali

  • 71,760 views
  • 40 comments
  • 110 respects
Add projectSign up / Login