HC-SR04 Sonar Rangefinder to Pixhark

I am connecting the HC-SR04 Sonar Rangefinder to Pixhark, but I get the error message “Rangefinder 1 was not detected”.

The connection between sonar and PX4 is as follows.

sonarGND ・ ・ ・ PX4 AUX6 GND

sonarVCC ・ ・ ・ PX4 AUX6 + 5V

sonarEcho ・ ・ ・ PX4 AUX6 signal

sonar Trig ・ ・ ・ PX4 AUX5 signal

The parameter “BRD_PWM_COUNT” is set to “4”.

Please let me know.

Good day, there are two versions of the sensor you have… one is SPI and the other one is I2c l…, which version do you own?

This is the sonar.

You have to configure 2 GPIO pins.
I don’t advice this kind of sonar due bad performances…

That’s not worth the effort to get working. Lured by the cheap price. Makes a nice Christmas tree ornament…

The GPIO setting is BRD_PWM_COUNT = 4. Is it correct?

GY-US42v2 Sonar
How is it?

The rangefinder you are using and the GY-US42v2 Sonar are already out of date.
Better you look for a new generation rangefinders…,

Do you have any recommended sonar?

You can look for Benewake Tf mini s… or teraranger…, it depends about the application you need.

The flight controller used is “Pixhark” and the software is “miss on plamer”.

Is it possible to connect to pixhark?

Yes you can use it…, me im using a different protocol for it, but you can use it as UART or I2C

Is it possible to stop at a certain distance with this sonar?

In case you want use a single rangefinder you can use it as landing sensor or as altimeter…, if you want a multiple option like teraranger evo hub tower with multiple sensor you can set it as avoidance and with the correct settings you can stop your drone

Is it possible to use TFmini-S alone?

So it’s clear because you keep saying Sonar, these are ToF sensors. Most commonly called Lidar but there is a difference between the 2.

standalone can be use as landing sensor or altitude sensor

Well, long story short, put it in the trash. Don’t use it!

I bought tfmini-s.
First of all, I would like to install it in front of the aircraft and set obstacle avoidance.

TF MINI-S is connected to the flight controller “TEREM2”.
The parameter is
Change “SERIAL2_PROTOCOL” to “9”
I set “SERIAL2_BAUD” to “115”.
Are there any other items to set?

well, a single tf mini can work only as altimeter or as landing sensor.
If you want use a rangefinder as an obstacle avoidance you need more than one

Why do you need multiple tfmini to avoid obstacles?