Shop OBEX P1 Docs P2 Docs Learn Events
Multiple pings in one project? — Parallax Forums

Multiple pings in one project?

jeff2.0jeff2.0 Posts: 24
edited 2010-01-19 04:38 in BASIC Stamp
Hi all.
I have a project where I need to stack 7 ping units·above each other pointing straight out,·each·about 1 foot apart.
My question is, "Will they conflict with each other in some way?"

Here's a text drawing showing the arrangement.

Ping
>
·(each about one foot apart)
Ping
>

Ping
>

Ping
>

Ping
>

Ping
>


Thanks in advance.
jeff

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-14 03:29
    Sure they'll conflict with each other. The PING documentation shows the distribution of ultrasonic energy and the sensitivity at different off-axis angles. These "cones" will begin to overlap not far from the PINGs. You can only trigger one PING at a time and wait for the echos to die down before you trigger another PING or you'll get false readings. You might be able to trigger the last one or two PINGs on either end, but you'll have to experiment to see how much they interfere with each other.

    Post Edited (Mike Green) : 1/14/2010 3:34:58 AM GMT
  • jeff2.0jeff2.0 Posts: 24
    edited 2010-01-14 03:36
    I'm only needing to sense around 2-3 inches away from the face of each ping, before the cones converge.
    Would what you said still be the case?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-14 03:51
    If the maximum desired sensing distance is less than half the distance between the Pings, you should have no problem when triggering them simultaneously. You run into problems when the echo from one Ping reaches another before the echo from the latter one does. But with your stated parameters, that would not be an issue.

    Just out of curiosity, what are you doing?

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-14 03:52
    It depends. You really haven't described what you're trying to do and what the environment "looks like" to ultrasound. You also haven't explained how you're using the PINGs (timing wise). The PINGs respond to the first echo received and won't react to later echos unless it's retriggered. If there's still an echo bouncing around strong enough to trigger the PING it will do so. If your 2-3 inch reflective surface is always there and large enough to reliably produce an echo, you're probably ok. Depending on your construction, you may want some ultrasonic acoustic dampening material beyond the reflective surface to prevent echos from beyond the reflective surface from leaking back in and triggering the PINGs on the next trigger.
  • jeff2.0jeff2.0 Posts: 24
    edited 2010-01-14 04:17
    Thanks guys.

    I'm re-building a game for a client that has a bunch of cut in half basket balls mounted on a wall above each other.
    The player jumps as high as they can, sticking their hand up in front of (or touching) the highest ball possible.

    Currently the game has photo-electric light sensors mounted in a little hole in the middle of each ball which works OK if you know where to put your hand. People are dumb however and can't figure out that they must cover the little hole to win.

    So...I would like to put pings under each ball to sense a hand passing in front of it so that the players can trigger the highest ball easier.

    I love my job.
    I have already done a quick mockup with one ping that is programmed to trigger an output pin if an object is < 3 inches which works great. It's very quick and it sees my hand just fine.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-14 04:28
    The PINGs can be retriggered about every 20ms. Triggering each one individually every 20ms takes a total of 120ms which should be fast enough to catch a hand passing in front of the balls.
  • jeff2.0jeff2.0 Posts: 24
    edited 2010-01-14 04:57
    So it looks like the multiple pings will work.

    As long as you guys are helping me let me throw this at you.
    I'm having trouble thinking through the logic on the ball thingee.

    When I reach the highest ball that I can, then I want to ignore the other lower ones that I triggered on the way up to the highest one. Would that be some form of an If,Then Else statement? Sort of like........

    IF ballone is reached THEN x ELSE IF balltwo is reached THEN y ELSE IF ballthree is reached THEN z etc......?
    Any ideas?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-14 05:20
    Make an array of bits initialized to zeros. Have a loop that goes through each PING repeatedly and sets the corresponding bit if the PING result is less than whatever threshold you decide on. This loop repeats over and over for as many seconds as you want it to run. When that part's done, you go in reverse through the bits from the last to the first and stop on the first bit array entry that's a one.
  • jeff2.0jeff2.0 Posts: 24
    edited 2010-01-14 14:40
    Awsome idea Mike!
    Thanks for all your help.

    jeff
  • allanlane5allanlane5 Posts: 3,815
    edited 2010-01-14 16:10
    Hmm. Why don't you put ONE ping at the top of the stack of basketballs, aimed downward. Then, when the guy jumps, keep 'pinging' him until you find the shortest distance (equivalent to highest height) reached?

    You may have to experiment if a ping sensor will reflect from the end of his hand. You might even put a plate with a switch on it on the ground, that he'll jump off from, to tell your system when to start looking for a signal.

    That 'reflect off his fingertips' might be a show-stopper for this approach -- I'm sure you could 'see' his head, but really you want his finger-tips.
  • jeff2.0jeff2.0 Posts: 24
    edited 2010-01-15 02:52
    Interesting thought allanlane5.
    I will set up a test and see.
    Cool idea, thanks.

    j
  • jeff2.0jeff2.0 Posts: 24
    edited 2010-01-19 04:38
    Mike Green said...
    Make an array of bits initialized to zeros. Have a loop that goes through each PING repeatedly and sets the corresponding bit if the PING result is less than whatever threshold you decide on. This loop repeats over and over for as many seconds as you want it to run. When that part's done, you go in reverse through the bits from the last to the first and stop on the first bit array entry that's a one.
    This worked too. I went to a 2 state swiches to test the logic.
    I used the waiting period of the winning output·to keep checking the other higher inputs.
    I didn't really understand how to do the array so I got it to work this way.


    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    'work on·BALL GAME logic.
    'balls 1 through 7's inputs are pins 1 through 7 on stamp
    'ball light outputs are outputs are pins 8 through 14
    'each·higher ball·can still win aven after a lower ball has won



    Setup:
    INPUT 1······ 'controls out 8
    INPUT 2······ 'controls out 9
    INPUT 3······ 'controls out 10
    INPUT 4······ 'controls out 11
    INPUT 5······ 'controls out 12
    INPUT 6······ 'controls out 13
    INPUT 7······ 'controls out 14

    keepchecking VAR Word
    faster6 VAR Nib
    faster7 VAR Nib

    Main:
    LOW 8
    LOW 9
    LOW 10
    LOW 11
    LOW 12
    LOW 13
    LOW 14
    DO
    IF IN1=1 THEN GOSUB OneWins·· 'sample inputs to find a winner 1-7
    IF IN2=1 THEN GOSUB TwoWins
    IF IN3=1 THEN GOSUB ThreeWins
    IF IN4=1 THEN GOSUB FourWins
    IF IN5=1 THEN GOSUB FiveWins
    IF IN6=1 THEN GOSUB SixWins
    IF IN7=1 THEN GOSUB SevenWins
    LOOP

    OneWins:
    HIGH 8
    FOR keepchecking = 1 TO 800
    IF IN2=1 THEN GOSUB TwoWins 'sample inputs to find a winner 2-7
    IF IN3=1 THEN GOSUB ThreeWins
    IF IN4=1 THEN GOSUB FourWins
    IF IN5=1 THEN GOSUB FiveWins
    IF IN6=1 THEN GOSUB SixWins
    IF IN7=1 THEN GOSUB SevenWins
    NEXT
    LOW 8
    RETURN

    TwoWins:
    LOW 8
    HIGH 9
    FOR keepchecking = 1 TO 950
    IF IN3=1 THEN GOSUB ThreeWins 'sample inputs to find a winner 3-7
    IF IN4=1 THEN GOSUB FourWins
    IF IN5=1 THEN GOSUB FiveWins
    IF IN6=1 THEN GOSUB SixWins
    IF IN7=1 THEN GOSUB SevenWins
    NEXT
    LOW 9
    RETURN

    ThreeWins:
    LOW 8
    LOW 9
    HIGH 10
    FOR keepchecking = 1 TO 1500
    IF IN4=1 THEN GOSUB FourWins· 'sample inputs to find a winner 4-7
    IF IN5=1 THEN GOSUB FiveWins
    IF IN6=1 THEN GOSUB SixWins
    IF IN7=1 THEN GOSUB SevenWins
    NEXT
    LOW 10
    RETURN

    FourWins:
    LOW 8
    LOW 9
    LOW 10
    HIGH 11
    FOR keepchecking = 1 TO 2000
    IF IN5=1 THEN GOSUB FiveWins· 'sample inputs to find a winner 5-7
    IF IN6=1 THEN GOSUB SixWins
    IF IN7=1 THEN GOSUB SevenWins
    NEXT
    LOW 11
    RETURN

    FiveWins:
    LOW 8
    LOW 9
    LOW 10
    LOW 11
    HIGH 12
    FOR keepchecking = 1 TO 2500
    IF IN6=1 THEN GOSUB SixWins·· 'sample inputs to find a winner 6-7
    IF IN7=1 THEN GOSUB SevenWins
    NEXT
    LOW 12
    RETURN
    Etc....etc....
Sign In or Register to comment.