I have AJ-SR04M ultrasonic sensors. And I want to connect my 4 sensors to pixhawk. I tried to connect them but it has 4 pins( 5V, Trig, Echo, GND ) and pixhawk has 3 pins( 5V, Signal, GND).
How can I connect these sensors to my pixhawk 2.4.8 ?
Or can I connect these sensors to Raspberry pi 3B?
Hi @enseri, apologies for the delay on responding to this.
That’s not a sensor I’m familiar with (thanks for bringing it up! ), but from some searching online it seems to be equivalent to the JSN-SR04T, which apparently uses the same driver as the HC-SR04.
From the ArduPilot documentation for the HC-SR04, it seems that the sensor uses one Pixhawk AUX pin for the trigger signal, and another AUX pin for detecting the echo. Since the Pixhawk has only 6 AUX pins, you could use at maximum 3 such sensors for direct integration into an ArduPilot autopilot firmware. If you’re running ArduSub one AUX pin is generally used for a leak detector, so you would need to choose between them.
It’s possible a serial driver would require only one GPIO pin per sensor, which would be helpful
A Raspberry Pi has GPIO pins and can run code, so is at least theoretically capable of interfacing with one or more of these sensors. If you want that to interact with the autopilot then you would likely need to configure some RNGFNDn_TYPE parameters to MAVLink, and send DISTANCE_SENSOR MAVLink messages to the autopilot with the information from each sensor.