Shop OBEX P1 Docs P2 Docs Learn Events
Ping Sonar Sensor — Parallax Forums

Ping Sonar Sensor

PatrickD034PatrickD034 Posts: 4
edited 2007-02-27 23:25 in BASIC Stamp
I am using the Parallax Ping))) Sonar sensor with BS2, and I am having some difficulties with it. Most of the time it will perform correctly, but every so often, it will be unable to detect objects within 12 inches. If I debug, it will sometimes have an object that is 12 inches away, yet the inches variable in my program will be 100+ .. it makes no sense and is acting very inconsistantly. I am running it off AC power, so I don't think that should be an issue ... this is driving me crazy, any help?

Thanks, Patrick

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-02-16 17:12
    What is the code you are running? you need to have a tight loop between sending and receiving the pulse for the stamp to recognize close objects.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • PatrickD034PatrickD034 Posts: 4
    edited 2007-02-16 17:34
    I am using the example code provided on the Parallax Ping site, http://www.parallax.com/detail.asp?product_id=28015 under the "Ping Stamp Example Code", where I call a Get_Sonar subroutine and convert the distance to inches.

    Are there any known flaws with this specific code that I should worry about? It seems pretty solid to me..
  • PARPAR Posts: 285
    edited 2007-02-16 18:28
    PatrickD034 said...
    I am using the Parallax Ping))) Sonar sensor with BS2, and I am having some difficulties with it. Most of the time it will perform correctly, but every so often, it will be unable to detect objects within 12 inches. If I debug, it will sometimes have an object that is 12 inches away, yet the inches variable in my program will be 100+ .. it makes no sense and is acting very inconsistantly. I am running it off AC power, so I don't think that should be an issue ... this is driving me crazy, any help?

    Thanks, Patrick
    Is it performing correctly "most of the time", or is it performing ("acting") "very inconsistently"?

    How large a surface does the target present to the Ping?

    Is the surface flat (and perpendicular to the Ping), or some other shape?

    Does the inconsisitent distance measure show up erratically·on repeated measurements using the EXACT same setup (i.e., the program loops through a series of pinging events, and the distance is calculated for each event and displayed in your DEBUG window)? Or, is the Ping and/or target and/or some other element in the field of "view" of the Ping moving (however slightly) between pinging events?

    Does the "sometimes" event of 100+ distance repeat consistenly, or does that "wrong" value itself change radically between pinging events conducted under identical conditions?

    PAR
  • PatrickD034PatrickD034 Posts: 4
    edited 2007-02-16 23:31
    Well, first I'll describe my goal. The robot starts in front of a normal-sized textbook placed on the floor. The goal of the robot is to drive up to the book, then drive circles around the book -- nothing too hard. Sensor is oriented at book-level and will see it most of the time, however, during some turns, when the sensor is ~6 inches away from the book, it will fail to see the book - the DEBUG readout will display ~100+ inches. I should clarify, on most turns, it will detect the book and make the appropriate actions, but sometimes it seems to "lose track" of the book - this usually happens around the corners of the book.

    If I perform the same test over and over again, I would say 75% of the time, when the sensor head-on faces the corner of the book , it will not return the distance to the book. I suppose I could try a shoebox or some other object, maybe the pings pulse is going through the pages of the book?
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-02-16 23:58
    Have you considered repeating this experiment with something round, say a coffee can, so there is always at least some surface that will reflect sound back to the sensor?· If you are facing a corner, the sound may be deflecting away to either side,·and you might be getting an echo from another object in the deflected path farther away.· Smart Sensors and Applications Chapter 2 discusses determining the minimum angle of detection of flat surfaces.

    http://www.parallax.com/detail.asp?product_id=28029

    It also occurs to me that the edges of paper pages·would be better at absorbing sound than reflecting it, especially if they are splayed a little bit.

    It might be worthwhile to set up various material/angle/distance combinations to test which object characteristics contribute to reflecting sound back the way it came.·
  • PatrickD034PatrickD034 Posts: 4
    edited 2007-02-17 00:01
    I never thought of the possibility of the sound deflecting.. it could explain everything. I'll have to try some tests when I get home tonight, I'll post the results later.
  • PARPAR Posts: 285
    edited 2007-02-17 06:36
    PatrickD034 said...
    Well, first I'll describe my goal. The robot starts in front of a normal-sized textbook placed on the floor. The goal of the robot is to drive up to the book, then drive circles around the book -- nothing too hard. Sensor is oriented at book-level and will see it most of the time, however, during some turns, when the sensor is ~6 inches away from the book, it will fail to see the book - the DEBUG readout will display ~100+ inches. I should clarify, on most turns, it will detect the book and make the appropriate actions, but sometimes it seems to "lose track" of the book - this usually happens around the corners of the book.

    If I perform the same test over and over again, I would say 75% of the time, when the sensor head-on faces the corner of the book , it will not return the distance to the book. I suppose I could try a shoebox or some other object, maybe the pings pulse is going through the pages of the book?
    Sounds like your Ping is working perfectly, and it is sensing what it sees, but because it is on a moving platform, and because it is becoming constantly re-oriented with respect to the target of interest (book), both in distance and in orientation, the Ping could be seeing any number of things from moment to moment, and accurately reporting on what it sees at that moment.

    You will have to study the "shape" of your Ping's world more carefully, with respect to the Ping's cone of signal, target characteristics (shape, size, distance, strength of echo), so as to know better what your Ping is actually looking at and measuring the distance to. Such testing will tell you how to design your robot's motion, your Ping's aiming requirements, your target's ability to be seen from various aspects, and your programming requirements to attempt to understand what a particular series of varying-distance signals suggest for your robot to do next.

    PAR
  • slamerslamer Posts: 52
    edited 2007-02-27 23:25
    Wow thats interesting!
    I've worked on sound deadning for a home music studio. Once we added insulation to the inner walls. We then had to make one wall surface hard or the music sounded flat to our ears. I hadn't pondered that effect for robot ultrasonic sensors. But Yep it could cause the same type of problem. Hard dense surfaces seem to be the best reflectors for sound. It's amazing the things you learn or Re-learn when you try and make a machine see or hear it's enviroment..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    undefinedundefinedundefinedundefined
Sign In or Register to comment.