Rangefinder on a matek f4 wing - Solved

Hi All,
i have managed to get ardurover working with a matek f4 wing controller - big learning curve from betaflight now im just trying to add sonar / rangefinder.

I have some maxbotix mb1023 sensors but can’t seem to get them to show up in mission planner. can they be used on a uart or do they need to have a special analogue pin ?
i have confirmed that the rangefinder is changing the voltage on the output pin when objects get closer - but can’t seem to get it to show up
I have it connected to Uart 6 receive pin but can’t seem to get anything to show up for rangefinder I have tried pin 3 analogue output and pin 5 serial - is a uart serial or ttl ???

Can anyone help with setting up a rangefinder on a Matek wing f4 ?
i have tried all that i can think of to get it working

@Grant_Robinson,

You’ve probably already seen them but our range finder setup wiki pages are here. It looks like the mb1023 supports sending range as a pwm value, an analog voltage or using a serial protocol. ArduPilot can support any of these methods (I think) although I think we only have documentation covering the analog option.

If you want to use the changing voltage output of the sonar then that’s the “analog” option so that pin will need to be connected to the ADC (analog digital converter) pin of the matex f4 wing. I’ve had a look at the pins on this board but I don’t immediately see where the ADC pins are. If you can figure this out then you’d next need to set the RNGFND_TYPE = “1”.

If the sonar’s serial output is to be used, then you’d need to connect the serial output to one of the flight controller’s telemetry ports (the sonar’s output would go to the telemetry port’s RX pin). Then you’d need to set RNGFND_TYPE = “13” for “MaxbotixSerial”, the appropriate SERIALx_BAUD parameter would need to be set to “9” or “9600” (either will work) to match the baud rate output of the sensor and also SERIALx_PROTOCOL would need to be set to “9” for “range finder”.

If the sonar’s PWM output is to be used, then RNGFND_TYPE = “5” for “PWM”. I suspect the RNGFND_PIN would then need to be set to something to allow reading from a pwm input pin. I’m not sure what this should be set to though.

By the way, if the RNGFND_TYPE parameter is changed, the board must be rebooted for the change to take effect.

Hope this helps somewhat.

Thanks for the reply - yes i couldnt find a pin to use analoge & have been mucking around with serial - but to be honest this is all new to me so it’s a steep learning curve.
thanks for the tips - ill report back how i get on.

the rssi pin is the only analog input you get on a 405wing, it is pin number 11 in arduPilot

1 Like

thanks Peter - i did think about the rssi pin but wasnt too sure how to assign it.

I did in fact get it to work as a serial connection - i had to solder the ttl pad on the back of the sonar unit and changing the baud rate to 9600 looks to have done the trick. So happy - have spent so long trying to get it to register.
will give it a try tomorrow and see if i can get it to route around obstacles - i have been reading that the current version probably wont work for routing around obstacles - I will do a bit more reading to see if i can get bendy ruler on this board.

this was my second board i tried - first bought the radiolink board - but couldn’t even get rover firmware loaded - no one in Australia seems to carry the pixhawks - but if i think i will work on it further a more capable board might be on the cards.

thanks for the help everyone !!!

1 Like