absolute maximum range of HC-SR04 ultrasonic sensor? - Page 1
Forum section: electronics / projects

author: JBeale
author_rank: Frequent Contributor
timestamp: August 04, 2020, 10:50:44 pm
content: I see the HC-SR04 ultrasonic sensor is sometimes listed with a maximum range of about 4m or 12 feet. I assumed this was because the return signal gets too weak, due to falloff like 1/r^4 (1/r^2 to the target, then 1/r^2 returning to the detector). In the special case where you're measuring water depth in a vertical pipe, so it's a waveguide situation instead of free space propagation, I assume there's still plenty of signal strength at 12 feet. Will the effective range extend much farther? Or is there some range-gate built into the HC-SR04 that shuts off any echo signal after too much delay, regardless of amplitude? The circuit diagram I saw included a STC11 (like 8051 uC) so it might easily incorporate that kind of time cutoff.I want to measure the water level inside a vertical pipe. The nominal distance in air from the top of the pipe down to the water surface is usually around 13 feet, but in general the water level may rise or fall.I'm not yet sure by how much. I suspect it's unlikely it would fall to the bottom of the pipe, but that would be 40 feet.

author: Whales
author_rank: Super Contributor
timestamp: August 04, 2020, 11:35:39 pm
content: I was once involved in a project using HC-SR04's to detect humans.Detecting a nice, big flat surface like water is an almost perfect case for an ultrasonic sensorAs a side note: the vast majority of HC-SR04's out there use a badly configured 40KHz filter, if you change few resistors then their performance gets dramatically better.I can't remember if there is a max dist hard-coded in, I don't think so (you already have to reject early return echos for X time after sending an output pulse). They're cheap, so I'd say try it and find out.There are more expensive ultrasonic transducers available from a variety of vendors if the HC-SR04 ends up being distance limited.Any "datasheets" you come across for this part are meaningless. They all make different numbers up. These parts are made by a few different people (you will find different layouts for the PCB) and quality even within one batch varies notably.

author: JBeale
author_rank: Frequent Contributor
timestamp: August 06, 2020, 06:33:31 am
content: I got some HC-SR04 boards, and printed a Y-shaped coupler so I could launch and receive the 40 kHz signal into a single 1" diameter pipe. My design isn't perfectly smooth inside, so there are some impedance bumps at the transition to the pipe and the unmodified board always delivers just one pulse showing distance to the near edge of the pipe around 5 cm away. Probing the PCB pins, I see what looks like the analog return signal on pin 7 of the quad opamp (LM324) and it does show some echoes farther along a short length of test pipe. So, there's at least some a chance this could work, if I tap into that signal and gate off the big close-in echo.

author: JBeale
author_rank: Frequent Contributor
timestamp: August 11, 2020, 06:52:05 am
content: I gave up on the HC-SR04 board for now. I tried a simple tweeter driven by an Arduino around 7.5 kHz, and recorded the audio with a lav mic connected to a cell phone (an older phone, after finding out my newer phone apparently has AGC and auto-noise-removal that can't be turned off.) The recording at least shows that it is (1) possible and (2) a little bit more complicated than I had at first assumed. The 1-inch pipe is not perfectly smooth inside because there are couplers each 10' because it is just 10 foot segments screwed end to end, and also there seems to be some white mineralized deposits along the inside of the pipe in some places. Despite those things, I do see a measurable reflection from what is apparently the water surface, within about 4% of the expected time delay based on what a weighted string tells me that the actual water level is currently.

author: Whales
author_rank: Super Contributor
timestamp: August 11, 2020, 08:38:22 am
content: Wow, that's a beautiful graph. All at 7.5KHz and using standard audio equipment. That's genius.Indeed the 6 pulses will never look like 6 pulses, the driver doesn't have zero mass or perfect linearity. You could look for a resonant freq of the driver so that you get less garbage, but it looks like what you have is already good enough.

author: RoGeorge
author_rank: Super Contributor
timestamp: August 11, 2020, 09:04:50 am
content: Try to send a chirped pulse instead of many pulses of a constant frequency.Chirped radar and sonar are very well studied and documented techniques, since both were used a lot in military applications. Depending on the desired accuracy, might worth or not the extra signal processing required with chirping. Either required or not by this application, chirped radar/sonar will be a very interesting read anyway.

author: JBeale
author_rank: Frequent Contributor
timestamp: August 11, 2020, 03:59:27 pm
content: Thanks very much for your replies! I know there's a huge radar literature out there and I should learn more about chirped modes. So far my test was simple, with a fixed-frequency square wave direct from the Arduino pins. After 6 in-phase pulses I did put two pulses 180 degrees out of phase at the end, to try to turn off the signal faster. Facing into free air, this particular piezo tweeter in my particular mounting fixture resonates near 7.4 kHz but that frequency goes up a little when the fixture is mounted onto the end of the pipe and it sees a different acoustic impedance. [edit: Or not... trying it again with a cleaner experiment did not show much difference in the resonant peak}