The HC-SR04 ultra sonic distance sensor

SR04 - module

A great toy, sorry, I mean addition to the kit.

It seems the SR04 (“SR zero 4”) is very good at detecting within an angle of +/- 22.5 degrees

SR04 - angle

A ‘ping’ is a signal sent out, with the intention that something will ‘reflect’ it back, revealing the existence of that thing. The sensor sends out pulses (‘pings’) of ultra sonic pulses and can read the ‘reflected’ signals. You cannot hear it, but it’s actually a noise. The ‘ping’ is the same as an echo.

The whole ‘ping’ things was recently improved and is generally refereed to as “New Ping”.

Since we first looked at this just a couple of weeks ago, the SOURCE I mentioned has since moved here: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home (do read the whole page.

The Arduino needs instructions on how to understand / interact / handle the distance sensor. This is achieved by adding instructional files (programming code) into the library” where all other instructions that tell the Arduino hot to interface with all other hardware are kept. Example INSTRUCTIONS on how to install library files are found here: https://www.arduino.cc/en/Guide/Libraries#toc4

and the ACTUAL “NEW PING” LIBRARY FILES are here (version 1.6 BETA): https://bitbucket.org/teckel12/arduino-new-ping/downloads/NewPing_v1.6.zip

The circuit diagram: https://bitbucket.org/repo/pyX7zy/images/1424201420-2wire_bb.png

(Pin 12 of the Arduino goes to the ‘trigger’ pin of the SR04. Pin 11 (a PWM pin – significan??) of the Arduino goes to Echo. The power supply to the SR04 can come from the Arduino or an independent 5V supply. If you do use an independent power supply then remember you must connect the ‘grounds’ of the Arduino and the independent power supply. — It’s going to be easier to use the Arduino +5V output pin for niow.

Do look at the example sketches. There are a few good and come in a number of flavours – which can be more powerful / useful for certain applications 🙂 Sketches here: https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!examples

The support forum also gives help on how to use multiple sensorshttps://forum.arduino.cc/index.php?topic=106043.0

My very big thanks to “teckel”

teckel

for all his hard work do that people like me can play happily with our toys.

Leave a comment