Shop OBEX P1 Docs P2 Docs Learn Events
Pingin' Blues — Parallax Forums

Pingin' Blues

KenBashKenBash Posts: 68
edited 2006-10-13 13:11 in Propeller 1
I got my new Ping Ultrasonic sensors a couple of days ago and have been trying to put together a function that gives me a smooth, steady readout of my distance.·

I've tried several different approaches,·· averaging,· time delays, etc.

I still tend to get some pretty wide variences.· However, I find that the shape and position of the target seems to make the most difference.· ( a hand doesn't make·a good·target )

My last attempt to get a smooth reading is to take a group of readings,· sort them high to low and take the middle value.·

I figgure I'll come up with something that works reliably·( ... put enough monkeys in front of enough typewriters...· or a single monkey at the typewriter long enough...)·

However.. I ran into something that I can't explain and thought I'd ask the experts.

The attached code pings a distance and displays it on a VGA screen.

when my distance from the sensor is about 20+ inches... everything is fine, but when I get closer,· it starts to mess with my VGA display!·

A distance of just a few inches trashes my screen. · I'm pretty sure something is affecting the internal PLL because I can see the screen change like it would when you change frequencies on a monitor.

I suspect·this is something I'm doing wrong in software but I can't see what it might be.

Any ideas?

Ken B.





▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
" Anything worth doing... is worth overdoing. "

··············································· ( R.A.H. )
····································

Comments

  • acantostegaacantostega Posts: 105
    edited 2006-07-09 07:20
    I don't know anything about your screen output problem, but I can tell you that ultrasonic sensors are relatively unreliable due to multipath reflections, specular reflections and sometimes have problems with materials that "absorb" sound. Not that this makes them useless, but they have to used with care. They don't work like laser range sensors. The book "Sensors for Mobile Robots: Theory and Applications" by H.R. Everett has some good material on this.
    Good luck!
  • KenBashKenBash Posts: 68
    edited 2006-07-09 17:40
    I appreciate the reference for the sensors. I figured that was the case about reflections and such. However , That's not the thing that worried me.

    I love the Propeller! I'm having fun with making it into an industrial controller, however, this is the type of thing that can be a literal killer if you don't understand what is causing it and be able to stay away from such things.


    ************* NOTE I've been changing my code as I've been writing on this. I KNEW I was doing something wrong! I was over-running my array size! I'm not sure why it was ever working with longer distances but opening up the array fixed it.

    Sorry for posting a silly programming error here on the site!

    As we used to say in flight Ops: " It was a loose nut in the cockpit"



    Ken B.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    " Anything worth doing... is worth overdoing. "

    ··············································· ( R.A.H. )
    ····································
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2006-07-09 18:20
    KenBash,

    It's not a silly programming error, if you learned something as a result.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • daveedavee Posts: 35
    edited 2006-10-13 05:43
    The only programmer that never wrote a bug never programmed a computer.

    To err is human, to compute, divine

    You learn more from your failures than you do from your successes. (That sort of makes us all geniouses)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Evartt

    People don't hate computers, they just hate lousy programmers.

    http://wehali.com
  • simonlsimonl Posts: 866
    edited 2006-10-13 13:11
    You've made my day Davee -- I must be a real guru lol.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
Sign In or Register to comment.