HC-SR04 Ultrasonic Sensor Not Working - Correct Wiring?

Hello,

I just had a question about the HC-SR04 Ultrasonic Sensor and wanted to make sure the way I’m wiring it is valid, as it doesn’t seem to be working in Mission Planner and we wanted to check if it’s a wiring issue.

Below is a picture of the wiring with a Pixhawk 6X:

  • I used a voltage divider to reduce the voltage coming from the Echo pin, as I found the PWM pins on the Pixhawk can only receive 3.3V and found that some people said the voltage needed to be reduced or else the PWM pins could be damaged

  • I did not connect the PWM pins of the Pixhawk to ground/power, I just connected the ultrasonic sensor to signal on the Pixhawk, and connected ground & power to the ultrasonic sensor separately (from an Arduino plugged into the wall.) → would this cause an issue? This is how I saw most wiring diagrams done from the forums, but I wanted to make sure that just signal being connected to the PWM pins was OK. (I know you can connect a 5V source to power the PWM pins but just wanted to keep it separate for now)

  • We followed the article on this sensor (HC-SR04 Sonar Rangefinder — Copter documentation) for the parameter setups

Thank you!

hello @Taylor_4 i’m trying to make a collison avoidance system for my drone using pixhawk 2.4.8 , i’ve gone through the article which you have followed , but i’m unable to understand the connection of HC - SR04 with pixhawk i want to use 4 of them (HC -SR04)and also have a question that do i need arduino for that or i can simply make it through pixhawk. Please help me in it .

you dont need the voltage divider and you need to add 5v to the pwm rails as they are not powered by the flight controller.

hello , can you help me also