February 15, 2013

Installing NewPing library for Arduino

Just for fun I decided to play with an ultrasonic sensor for distance measurement and an Arduino. The sensor that i used is the HY-SRF05. The included example for Arduino is written for the Parallax PING sensor. The HY-SRF05 is a bit different from the PING in the sense that it uses two pins for communication instead of one. This is not supported by the default example. But luckily there is a good alternative. The NewPing library has many features and support the HY-SRF05. It is available for download from here: http://code.google.com/p/arduino-new-ping/

The installation of an Arduino library is easy. Just unzip the library files in your Windows Documents folder in the folder Arduino\libraries\<LibName> as illustrated below.

 

The library integrates well in the Arduino Software and comes complete with examples.

The HY-SRF05 runs from 5 Volts so it is easy to use with the Arduino. The trigger pin is connected to pin 12 and echo pin to pin 11 on the Arduino. This is how it looks when it is running.
The accuracy of the sensor seems to be fairly good but I did not evaluated that throughly.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.