Shop OBEX P1 Docs P2 Docs Learn Events
Reading multiple echoes with (HC-SR04) ultrasonic sensors — Parallax Forums

Reading multiple echoes with (HC-SR04) ultrasonic sensors

lanternfishlanternfish Posts: 366
edited 2013-04-17 21:41 in General Discussion
Saw this over on Lets Make Robots.

I haven't had an in-depth read the specs on the HC-SR04 ultrasonic sensors yet so have assumed they are similar to the PING)).

From the original article:

"... First sensor sends a pulse. When it echoes the pulse back, echo pin is connected to second sensors trigger. Second sensor (sends a pulse) starts listening. When the second wave cames back, it reports to another microcontroller pin ..."

There has been some discussion around expansion of this concept with more sensors:

"... [You might have to surgically disable the xmit on the 2nd and 3rd ping sensors, so that only the receive part is functional.] It will be tricky to trigger three in some sequence and get useful info out.

Let's do a thought experiment. S1 xmits ping at T1 and detects the return from the nearest object at T2. S1 xmits ping at T3, S2 xmits a phantom ping at T3 + (T2 - T1) and is not ready to detect ping return at T4 which S1 does detect. S2 starts listening right after T4 for the 2nd return echo at T5.
..."

There is some Arduino code which looks very easy to translate tp SPIN.

Thoughts?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2013-04-17 11:01
    I don't understand why you would want to do this but you should give it a try and see if it will work for you.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-04-17 21:41
    Franklin wrote: »
    I don't understand why you would want to do this....

    I would guess to get distances to objects farther than the closest one?

    Re SR04 - they differ from the ping in that they have separate trigger and echo pins. So they have four pins instead of three. Also, the ones from china may be a little off (maybe they don't resonate at exact frequency or are otherwise marginal?), I guess I'm going to have to look into tuning some of these in some way.

    If you can bear looking at forth code, there is a driver for these in the propforth download under /extensions. These are being used in the littlerobot project, maybe i will get the kids to try this. Thanks for the heads up!
Sign In or Register to comment.