Reading multiple echoes with HC-SR04 ultrasonic sensors
Some fancy nice ultrasonic sensors can read multiple echoes of sent ultrasonic wave. Cheap senosrs register the first echo that arrived back. If we could listen more echoes we can tell if there space behind first detected object. I have some HC-sr4 ultrasonic sensors that cost only few dollars. It came to my mind that maybe second sensor could detect waves arriving after first one. This seemed to work! As after fast googleing it seemed nobody has shared something like this, I decided to go on with a this tip.
The picture shows the set up. This is first tests and nothin optimized but worked quite well. 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.
I tried two different settings and managed to find both box and the wall behind it. If sending cone of second sensor isn't muted, objects that are further away than distance to closest object can't be detected because of pulse from the second sensor. This has however andvantace of not waiting so long the second wave. If I muted the second sensors transducer with my finger (hitec solution) i could listen echoes from far away. This setup can't tell you if there is emptynes beyond sensors range or if all the sound just echoed back from the first object detected. Arduino code attached.
EDIT: Changed the code a bit and got nice readings shown in this picture. First echos leght is added to second pulse duration. When there's no other echoes both readings are same. Now second value seems to report very exactly second object distance. Sensors are in the beginnig in front of box, when i move it sidewys and it reaches the edge, wall behind box comes visible :)
SPECULATIVE: I don't know if it were better to trigger second sensor with software because it takes time to wait echo signal read operation. One could this way decide how faraway obejts to listen by delaying second triggering.
Chaining the sensors could be useful for other reasons too, i am not sure. You don't have to trigger the sensors individually, just listen the inputs. Also could one make a self oscillating system by linking second (or nth) sensors echo to first trigger pin. Last echo should be protected with a diode because of original launching pulse from microcontroller.