Tuesday, December 25, 2007

Arduino with Parallax Sonar sensor

Yesterday, I picked up one of the heavily-advertised Parallax PING Ultrasonic sonar sensors from Radio Shack, and wanted to see how easy (or difficult) it would be to get operating with the Arduino. As it turned out, it was incredibly easy - in fact, it took less than 15 minutes of coding to get operating, and all I needed was the PDF spec-sheet from Parallax:


I plugged the sonar module into the top of the breadboard, wired ground, wired +5V, and then connected a wire from the signal port to the Arduino's pin 8. 15 minutes later, here's a video of me moving the sensor towards and away from my laptop's monitor:



After I wrote my own code, I found a slightly more elegant way to wait and count the length of the return pulse - there's Open Source community in action - thanks!

Anyway, here's my code - I've uploaded it to Liquidware.

3 comments:

Unknown said...

Hey thanks, I picked up a PING))) sensor at Radio Shack today and your function works great!

Rodrigo Miranda said...

What shield have you used?
Is it a breadboard shield? It seems very compact...

Matt said...

@rodrigo - this one: http://www.liquidware.com/shop/show/MPB/Mini+ProtoBoard :-)