Ponar

While at the last Maker Faire, I picked up a 4wd robot kit.

My thought is to hook an ultrasonic sensor to it, to do some simple obstacle avoidance.  Since I’ve never worked with any of these components before (servo’s, ultrasonic sensors, motor-drivers, etc), I want to break down each step so I can really grasp how this stuff works.

I was looking at my bucket of parts and it dawned on me:  I have a servo, I have a Ping))) sensor, a spare Arduino Uno, a bunch of Erector Set parts, and knowledge of Processing programming:  I could (should!) make a simple sonar system.  So the “Ponar” was born:  Ping))) + Arduino + Servo + Processing = Ponar.

How it works:

The Arduino program sweeps the servo back and forth over a 90deg arc.  At each degree, the Ping))) sensor returns back a distance reading.  The degrees and distance values are passed over the serial port to the PC, where the Processing application turns them into a ‘traditional looking’ (in my head at least) sonar read-out.

See it in action:

Want to make one too?  Here’s the steps I went through:

Parts List:

Software List:

Hardware setup:

  • Assemble the servo, bracket, ping, and erector set into a pleasing arrangement.
  • Connect the Arduino’s 5v and ground pins to the mini beadboard with the jumpers.
  • Use jumpers to connect the Vin of the Ping))) and the servo to the Arduino powered row on the mini breadboard.
  • Use jumpers to connect the ground of the Ping))) and the servo to the Arduino grounded row on the mini breadboard.
  • Use a jumper to connect the signal line of the Ping))) to the Arduino’s digital pin 7.
  • Use a jumper to connect the signal line of the servo to the Arduino’s digital pin 9.
  • Connect the Arduino to the PC with the usb cable.
  • Upload the Arduino sketch to the Arduino:  It should start sweeping left and right.
  • Run the Processing sketch:  It should sample the serial stream being passed from the Arduino, and display the sonar view on-screen.

For a couple days work, it was really informative, and actually pretty fun.

Ponar sees beer

 

    • Jodi
    • August 9th, 2011 9:25pm

    Wow, that is a pretty cool! So can it talk to ;)

  1. That’s next :P

    • Mums
    • August 11th, 2011 8:34am

    That’s my son! It’s in his genes to be an inventor just like his grandfather.

  2. lol. thanks mUm ;)

    • Vic
    • October 24th, 2011 2:02am

    I ran into the txrx lame stuff.
    I downloaded the binaryzip file, nothing in the file.
    Why would they change one but not the other if people were going to run into this mess?
    I lost a whole night trying to hunt down for a fix, but apparently it’s not an easy fix.
    I found several of the RXTXcomm.jar files for the arduino, for processing.
    I’m at a loss, and worse, an entire night thinking that it couldn’t be too hard.
    Do you just copy the entire zip file? There’s nothing apparently in the zip, so I don’t see how the fix could take place.

  3. I’m not sure what’s wrong: I’ve done a lot of Arduino programming, and never ran into this: As long as you have the latest Arduino & Processing software installed, plus your Java install is up to date I don’t know why it would work. I have a default Arduino\Processing\Java install, no custom hackery going on. I’ve never done any zip file copying, not sure why that would be needed.

    • Vic
    • October 24th, 2011 12:15pm

    I downloaded the exact programs. Like default arduino, default processing.
    Ran the processing code, and came up with a mis-match warning at the bottom of the processing window.
    Then I googled the error, and came up with a bunch of people copying files from one place to another. Which got a little complicated.
    I was told to copy some zip files, and there was nothing in those zip files or it came up as corrupted.
    You don’t know how important this would be to my research. Not school research, but wildlife research. This would tell me when an animal has close into close proximity to me inside my vehicle at night.
    It’s a shame that I can’t get this to work.
    Out of the thousands of people who tried this, I’m the only dunce who failed at getting it to work. lol. I tell ya. My luck has not been good to me this year.

  4. This sounds like a weird software version mismatch of some kind, but unfortunately it’s outside the realm of my knowledge. I feel your pain though, I run into this kind of stuff all the time. I’ve tested this code on both Windows7 and Mac OSX Lion successfully, fyi.

    Both Arduino and Processing have pretty good forums, you may try and posting your problem there, maybe someone will have a better solution than I do :( I hope you find a solution, your research sounds pretty cool.

    • Vic
    • October 24th, 2011 12:39pm

    Thank you. It is pretty cool.
    It’s for bigfoot research.
    Got to:

    http://www.youtube.com/user/AzBirdDog

    and check out what I have thus far.
    I’ve had some younger bigfoot bouncing up and down on my back bumper of my SUV, as I was inside of it. Didn’t hear them until my vehicle started bouncing up and down.
    I’ve also found a handprint on my SUV, 11.5 inches from the bottom of the palm to the tip of the middle finger.
    Witnesses were there when I discovered the print.
    This is HEAVY DUTY research as I am in a habituated area.
    I’m dealing with about 20 of them, all different sizes and ages.
    Even really old and really young.

    But thank you for the assistance. Arduino is beautiful for what I do, making sensors that no other researchers have. For pennies on the dollar.
    The discovery of bigfoot has already been done, Do a youtube search for “The Ericson Project.” They’re in the midst of putting out a discovery documentary of national TV. I’m trying to prove that they are here in my state.
    Again, Thank you for the help. I’ll get this running if I have to pull teeth! LOL
    Atleast now I have something to work with. Before, everybody was making these sonar, type programs using IR. I need it to work with ultra-sonic frequency, as you have done.

  5. That’s pretty crazy, Good luck with your research! The only thing my ponar found was a beer bottle :P

    • Vic
    • October 24th, 2011 4:06pm

    LOL
    It could do alot more.
    I’m still a newbie in the world of arduino, and even more so on processing.
    But I see alot of uses for me out in the field.
    My main needed tool would be multiple wireless sensors, and a monitor system for those.
    I just purchased a few xbee modules and they’re on thier way.
    Wireless pan & tilt for ir camera and parabolic microphone.
    The list goes on and on.
    But i’ve basically a great need to learn processing.
    That is a must, for a monitor system.

    • Vic
    • October 26th, 2011 2:31am

    I got the txrx stuff worked out, after a few nights and less hair that I had to pull out. But!
    It still doesn’t work.
    I checked wiring, arduino pins. I tell ya, This just isn’t my thing, i guess.
    I thought that it was a power issue, nope.
    I tried using my mega 1280, my uno clone. Nothing.
    Ping goes to 7, servo goes to 9. Nada.
    I even tried a different PING sensor, I have two of them. Nothing.
    I tried an older version of processing. Nothing.
    I give up!
    But thank for the code, It did get me started in processing, I know a little bit more about it and I learned to figure out a few things.
    But, it’s over.
    Must be something wrong with my pc.
    It’s time to get back to my other projects.

    Again, thanks!

  6. You may just want to try the basic Arudino Ping example here:
    http://www.arduino.cc/en/Tutorial/Ping
    It’s dead simple, and if that’s not working, and you know you have the latest arduino stuff installed, then my guess it would be something to do with your PC hardware as well :(

    • Vic
    • October 26th, 2011 11:19am

    It has to be something with my PC.What versions of Processing and Arduino do you have running this? The software?
    Because through the arduino’s software, everything runs fine.
    The arduino serial monitor works for everything that I have thrown at it.
    But the Processing serial side of things apparently isn’t able to read it.
    And that’s why I think that it’s something to do with my PC.

  7. I’ve installed it at work on my Win7 box, that’s using Arduino 0022 which is the current release, And Processing 1.5.1, which is also the current release. I have the same versions of the software installed on my mac at home (OSX Lion). I’m using Java 6, Update 29, build 1.6.0_29-b11

    My guess again is it has something to do with Processing and Java: You may have a weird version mismatch: I would uninstall Processing, uninstall Java. Then re-download and install Processing, which includes Java. It should (hopefully) all be sync’d at that point.

    • Vic
    • October 26th, 2011 12:46pm

    I just tried that, It didn’t work either. LOL
    Go figure, Use it for beer bottles, people can get it up and running.
    Have the intentions of a discovery of a living hominid still walking the planet?
    It won’t work for them people. lol
    I’m sure it does what it’s supposed to do, and you’re the only person that I have found who used this together with a PING detector to make the radar/sonar thing.
    And that’s cool.
    But, I’m at a loss.
    Tonight I’ll try it on my laptop.

    • Vic
    • October 29th, 2011 6:34pm

    I think the problem is JAVA!
    I’m not fully understanding JAVA here.
    I don’t think that you’re speaking about the JAVA that’s installed on my pc.
    You know, the normal java that I run on my pc.
    That’s not the JAVA that you’re speaking of, is it?

  8. Java is the software language that Processing is built upon. Some computers come pre-installed with it, others not. Processing’s installer comes with Java, and will install it if it detects you don’t have it (I believe). The direct download for Java is here:
    http://www.java.com/en/download/index.jsp
    Again, I’d uninstall Processing, uninstall Java, then reinstall Processing that comes with Java, you should be good to go. Or, you can just try downloading the latest Java version of Java and install it first, see if that solves your problems.

    • jeremy J
    • April 7th, 2012 3:33pm

    Thanks for uploading ur code… i have been trying to mesh the two Sweep and Distance code’s for sometime now (very new to the world of Arduino and coding). After uploading the code everything works fine but sometimes the sensor returns a value of ZERO (0). I was wondering if there is a way to have the servo stop at its current position if the sensor returns a zero, and then once it reads a distance greater than zero continue on its sweep? Thanks for all the help so far!!!

  1. No trackbacks yet.