Shop OBEX P1 Docs P2 Docs Learn Events
Proximity Sensor - sonar — Parallax Forums

Proximity Sensor - sonar

Hello all

I'm looking at starting my first project with sonar.

If I want to implement 2 or more sonar, what board and module should I use?

Thanks,
jav
«1

Comments

  • Welcome to to forums!

    You did not mention your budget. To Arlo is on sale with four (PING) sensors included:

    https://www.parallax.com/product/28966
  • You could start with:
    https://www.parallax.com/product/28231
    to drive these:
    https://www.parallax.com/product/28962
    and add these:
    https://www.parallax.com/product/28015

    What kind of platform are you looking at?
  • javelinjavelin Posts: 18
    edited 2017-08-31 13:25
    Thanks Publison. I appreciate the feedback.

    I'm looking at starting very small and I'm not trying to build a robot. My first project will just be a simple sonar system using PING.

    At first, I thought of starting with one PING to try out and learn the programming. I may need 2 or more PINGs later so instead of buying the basic boards and module to run one PING, I thought it's more economical to buy the board and module that can run multiple PINGs now.

    I'm using Windows but do have Linux server to use if needed. Suggestion is welcome.

    How about these? Will this board and module run 2 or more PINGs?

    Board:
    https://www.parallax.com/product/28850

    Module:
    https://www.parallax.com/product/bs2pe

    PING: starting with one for now
    https://www.parallax.com/product/28015


    Please know this is my first ever project of this kind but I welcome the challenge...I have to start somewhere : )

    Thanks,
    jav
  • ercoerco Posts: 20,256
    Welcome Javelin. Check out Pingdar, one of the coolest projects ever IMO and a great place to start. http://forums.parallax.com/discussion/86110/ping-dar-a-radar-style-display/p1
  • So I got me the Propeller Activity Board WX and got the PING working, with LED too.

    I have a generic buzzer I like to incorporate with my little project. It's a solid-state 4-8V DC / 25mA buzzer.

    When I hook it up to the Propeller board, it buzzes but the sound is very weak. If I hook it up directly to the 3.3V or 5v, the
    buzz is loud. So what am I doing wrong?

    Here's my code:
    freqout(12, 1000, 1500); // pin, duration, frequency


    Again, there's a sound coming off pin 12 but it's very weak. I have to bring the piezo close to my ear to even
    hear it.

    Any advice or suggestion is appreciated.

    Thanks,
    jav
  • Congrats on the Propeller Activity Board WX purchase.

    How do you have the buzzer connected on the Activity board?
    Also, do you have the PWR switch on the Activity board set to 2?

    Not knowing much else about the buzzer you are using, you might have to add a transistor to the circuit to power the buzzer properly.
  • Keep in mind that multiple PING)))s have limited usefulness. You can't realistically have more than one active at a time ... they tend to interfere with each other ... and you have to wait a little for the echos to die down. More than one is useful if they're mounted in fixed positions ... one straight ahead and +/- 45 degrees. You still have to only trigger one at a time.
  • The wiring looks like the attached pic. I took voltage reading on pin 4 and it's only registering 1.65v. The voltage is too low and I think its why the buzzer sound weak.

    The PWR switch is set on 1 and the result is the same if I set PWR switch on 2.

    The 3.3 and 5v pins readings have the correct voltages so I think that tells me the voltage regs are working properly.

    So, why am I not getting 3.3v on the i/o pins?

    Any suggestion or comment is appreciated.


    Thanks
    jav
    410 x 324 - 103K
  • ercoerco Posts: 20,256
    Prop pin probably can't output enough current for those "active buzzers", voltage is dropping. You may need to add a transistor switch.
  • Your buzzer appears not to need a frequency to make it sound, since you say you can connect it to a voltage and it buzzes. Just make the pin high to turn it on; low to turn it off.

    The reason your output pin registers 1.65 volts is that's it's being driven at a 50% duty cycle, and 1.65V is half of 3.3V.

    -Phil
  • ercoerco Posts: 20,256
    I've sent sounds to those active buzzers, which are electromechanical and self-oscillate on 5VDC. Makes for some cool sounds. Anyone remember the "Flint" ringtone?

  • Thanks for the input everyone, I appreciate it.

    The high/low trick worked like a charm. Thanks to PhiPi for pointing that out.

    As for the multi-PING, I think it can be done reliably or maybe efficiently using individual cogs to manage each device separately. Will need to read up more on that since these are all new to me.


    Thank you!
    jav
  • javelin wrote:
    As for the multi-PING, I think it can be done reliably or maybe efficiently using individual cogs to manage each device separately. Will need to read up more on that since these are all new to me.
    Multi-cogs might exacerbate the interference problem, unless you can coordinate them somehow. The main thing to keep in mind is not to trigger more than one Ping))) at a time, unless perhaps they're pointed in opposite directions. Otherwise you risk the possibility of the echo from one being intercepted by another whose trigger and waiting period overlapped with the first one.

    -Phil
  • ...The main thing to keep in mind is not to trigger more than one Ping))) at a time, unless perhaps they're pointed in opposite directions. Otherwise you risk the possibility of the echo from one being intercepted by another whose trigger and waiting period overlapped with the first one.

    -Phil

    To echo this with a helpful timing tip from Mike Green, "...you really only want one U/S pulse echoing around at a time. Maximum "time of flight" for the PING is around 20ms. I would allow 50-100ms for echoes to die down before triggering another (or the same) PING."

    Thanks to Mike and Phil both!
  • javelinjavelin Posts: 18
    edited 2017-11-19 05:04
    Thank you the suggestions on my little PING project. So much good info and great advice.

    My goal is to run at least two(2) PING. If I can drive three(3 max) PING on the same board, that would be even better. Since the prop board allows cogs to drive devices independently; eg PING, this makes it ideal to run multi-PING with little or no interference, that is if I understand it correctly. Reason why I think this will work is because each pulse will be processed or handled separately by each cog regardless how the PING are positioned. Will test this soon.

    I'm a little confused how the I/O pin works. When the PWR is set to 1 or 2, it initializes the board and the pins. At that point, is there any voltage on those pins? It looks like there are low voltage running on them and they seem to behave like an electronic relay switch. Or, are the I/O pins only get powered when a function call is made?

    Sorry for the many newbie questions.

    Thanks again.

    jav
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2017-11-19 06:16
    javelin wrote:
    Since the prop board allows cogs to drive devices independently; eg PING, this makes it ideal to run multi-PING with little or no interference, that is if I understand it correctly.
    Nope.

    The secret to running multiple Ping)))s with no interference is to cycle them one after the other in a single cog, leaving at least 100ms between triggers. The interference you will get otherwise is an echo from one Ping))) registering in another that's awaiting its own echo, yielding a false distance reading.

    -Phil
  • javelin wrote: »
    Thank you the suggestions on my little PING project. So much good info and great advice.

    My goal is to run at least two(2) PING. If I can drive three(3 max) PING on the same board, that would be even better. Since the prop board allows cogs to drive devices independently; eg PING, this makes it ideal to run multi-PING with little or no interference, that is if I understand it correctly. Reason why I think this will work is because each pulse will be processed or handled separately by each cog regardless how the PING are positioned. Will test this soon.

    Actually, it would be better and easier to keep multiple pings from interfering with each other if they all run in the same cog. If you are using "C" just put a "pause(100);" between the the code segments that take a ping reading.
    Code to read ping(1)
    pause(100);
    Code to read ping(2)
    pause(100);
    Code to read ping(3)
    pause(100);
    

    If they run in separate cogs, I'm not sure how you would synchronize them so they don't interfere.
    javelin wrote: »
    I'm a little confused how the I/O pin works. When the PWR is set to 1 or 2, it initializes the board and the pins. At that point, is there any voltage on those pins? It looks like there are low voltage running on them and they seem to behave like an electronic relay switch. Or, are the I/O pins only get powered when a function call is made?

    Sorry for the many newbie questions.
    Thanks again.
    jav

    When the Propeller resets (or turns on) and starts to run a program, all of the pins are set to "input". The pin has to be set, by the program to be an "output". Then it will be a "low" output (0 volts). To get a voltage on the pin, it has to be set to "output" and "high", which will put 3.3v on the pin.

    The Propeller C library has function that do that.
    void 	high (int pin)
     	Set an I/O pin to output-high.
    void 	low (int pin)
     	Set an I/O pin to output-low.
    int 	input (int pin)
     	Set an I/O pin to input and return 1 if pin detects a high signal, or 0 if it detects low. 
    

    There are also functions that do "high" and "low" in separate steps of setting either input or output and
    void 	set_direction (int pin, int direction)
     	Set an I/O pin to a given direction. (either 0=input, or 1=output)
    void 	set_output (int pin, int state)
     	Set I/O pin output register bit to either high=1 or low=0.
    
    There are other functions for using the pins. They are listed in the simpletools library reference
    https://cdn.rawgit.com/parallaxinc/propsideworkspace/master/Learn/Simple%20Libraries/Utility/libsimpletools/Documentation%20simpletools%20Library.html

    If you are programming in Spin, I'd recommend this book:

    https://parallax.com/sites/default/files/downloads/122-32305-PE-Kit-Labs-Fundamentals-Text-v1.2.pdf

    Regardless of which computer language you are using, I recommend reading the first 12 pages of that pdf to get a better idea of how the propeller works.

    Tom
  • Thank you all for these great information. I've been reading bits and pieces so far just to get started.

    For the Propeller, I'm using C so I'll be checking out the libraries often. I will start testing again soon after I get my hands on another PING. So far, I have one PING, two LED(yellow and red), and a buzzer on that one board.

    If the second PING works, a third PING perhaps...it's going to be tight on that little board : )

    Thanks,
    jav
  • There's something else coming soon, too. Wait, I can't talk about it. . . .how do I delete a post, anyway?

    IMG_2749.JPG

    Ken Gracey
    3264 x 2448 - 2M
  • Oh, boy! Methinks this is gonna be BIG!

    -Phi
  • Oh, boy! Methinks this is gonna be BIG!

    -Phi

    No, it's little. Can't you see?

    Ken Gracey

  • Ken Gracey wrote: »
    There's something else coming soon...

    Hot dang! Now there's something to get excited about! :-D
    Way to not let these guys (or these guys, etc) eat your lunch! Hmmm...maybe I can hawk my Kickstarter Scanse on Ebay and not need that RPi connection after all? I can hear the chanting from deep in the salt mines already, "We need more crunching POWER, bring on the P2!" haha :lol:
  • ercoerco Posts: 20,256
    edited 2017-11-21 07:49
    Ding ding ding! Ping ping ping! Winner! My spider sense is tingling!

    To any would-be competitors: ToF toenails!
  • erco wrote: »
    Ding ding ding! Ping ping ping! Winner! My spider sense is tingling!

    To any would-be competitors: ToF toenails!

    I didn't think you'd notice that little chunk of squid dropped into the red triangle, but this is proof that you really don't miss anything of interest. We're happy to have you and all of your friends listed above on our team.

    Ken Gracey
  • ercoerco Posts: 20,256
    Love the 3.3/5V range. Super smart. Laser. Awesome. Boss. Huge. Cool. Want.

    I'll leave it to Whit to post those infamous two words and exclamation point.
  • Laser ping? Whoaaa...are you saying I can detect incoming missiles from miles away? : )

    A small-footprint laser PING is even better. I already bought another two-ear PING for testing and it's on its way but it's OK. The program should also work with little or no modification with this new laser PING, right?

    Thanks!
    jav
  • javelin wrote: »
    The program should also work with little or no modification with this new laser PING, right?

    100%.

    KG
  • ercoerco Posts: 20,256
    KG is the coolest. First the 360 Feedback servo, now this. How can you remain tight-lipped on such cool things for so long?

    Is there an anti-grav module coming? PLEASE make it 3.3/5V compatible.
  • ST Micro ToF sensor? 'Can't figure out from the photo which micro is being used with it though. Not an SX, not a Prop, and no crystal or resonator that I can see. (Or maybe Parallax's next announcement is going to be a downsized Prop in a 28-pin quad flatpack?)

    But wow! This is a game changer. Between this and the Servo360, one wonders what else Parallax has up their sleeves.

    -Phil
  • ercoerco Posts: 20,256
    stand.jpg
    800 x 800 - 139K
Sign In or Register to comment.