Sonar based on HC-SR04

I would like to share the results of testing a “very cheap” sonar based on HC-SR04. Earlier I added a description of using HC-SR04 for Rover. @geofrancis created a PR for use as a sonar, the forum members responded to this PR. As a result, @geofrancis shared the modified firmware(Rover 4.2).
If the vessel is just drifting, the readings correspond to reality.The results are such that when the motors are running, the readings are very unstable.
Next time I will place the sonar in the bow, removing it from the motors (and ESC) and the water flows from the screws.
If someone wants to repeat the instructions here, the only thing you need is to change the parameter "If someone wants to repeat the instructions here, the only thing you need is to change the two parameter SERVO13/14_FUNCTION = -1. In the MP there will be the parameter RNGFND_SPD_SCAL should be set to 13.44 for fresh water and 13.26 for salt water.

Special thanks to the forum members for their help - @geofrancis

My test boat :crazy_face:
During testing, I used a second sonar(Echologger ECT400) so that I could compare readings.

Log files are attached and a short Video.


What is the maximum depth you could expect from the HC-SR04? Is it 4.5m OR is that what the max would be in air? It looks like the current default is 58, and the new multiplier is 13… so that makes it closer to 1m?

Very interesting project!

58 is the default coefficient, the others are for water. the value of the maximum depth will need to be tested, I think that up to 10m should be enough power. the minimum depth is about 1.4m.

1 Like

That’s certainly very interesting! 1 to 2m of range may not be very useful in many situations but the fact that you could repurpose a regular air sonar for use in water is kind of amazing.

@rmackay9 , 2m is just the limit of the water we have tested with so far on ardurover, im not actually sure of the maximum depth, there are videos of it going to 9+ meters.

Sound travels much further in water with the same energy due to the faster speed of sound and lack of compressibility, but the sonar is easily deafened by any local noise sources like the motors or propellers so I think it should work well when stationary, sailing or running low throttle.


It should be possible to make a lua fish finder script using sonar depth readings, the script just needs to alert for intermittent readings outside the average from the last few seconds. so if your going along with your sonar reading a constant 5m then it doesnt do anything but if you start getting intermittent readings at only 2m then chances are your getting a return from something suspended in the water like a fish.

I have received the JSN-SR20-Y1 and have been doing some testing, this is essentially a dual transducer version of the JSN-SR04T, the advantage of using dual transducers is that it doesn’t have to finish transmitting before it can receive, this means it can work at much shorter range, so far testing shows it working in as little as 15cm of water where the single transducer has a minimum range of 1.4m because it has to finish transmission before it can listen for the echos.

this could also be an ideal candidate for a plug and play solution that can be easily added to the bottom of a boat.

I 'll order for myself too )

1 Like