Reading multiple echoes with (HC-SR04) ultrasonic sensors
lanternfish
Posts: 366
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?
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
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!