How to Use Ultrasonic Sensors with the Arduino

I’ve made my first video tutorial! I obtained some SR-04 ultrasonic sensors quite cheaply, and I’ve been learning how to use them with the Arduino, with good results. I’ve created a tutorial covering how to get the proper libraries and how to use the basic functions in the Arduino IDE to interface with the sensor.

Here’s the steps (covered in the video) on how to get NewPing, a library created for controlling ultrasonic sensors, up and running with the Arduino IDE:

  1. Use this link to download the NewPing Library: https://bitbucket.org/teckel12/arduino-new-ping/downloads.
  2. Click “Download NewPink v1.7” and save the .zip file.
  3. Open the Arduino IDE, and go to ‘Sketch>Include Library>Add .ZIP Library’ and then navigate to where you saved the .zip download, and click ‘open.’
  4. Go to ‘Sketch>Include Library’ again and scroll all the way down to the bottom and select NewPing.
  5. The NewPing library will now be included in your sketch.
  6. For some sample sketches and documentation of NewPing, look here: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!syntax.

For code sample written in the tutorial, click here.

P.S. – Yesterday was the first anniversary of this blog (this is my 48th post)! 😀

ultrasonic sensor schematic

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s