Servers by jDrones

Avoidance Experiments with the POC and Benewake TFMINI

The POC ?

Well the blog is pretty self explain it all…

Hi Patrick hope you and your family are well and a very merry xmas to you all,like Ricky g I would love to do this im woundering if you could maybe do a laymans /idots guide on how to implement this and thank you for all your hard work,ile buy new benewakes with I2C if that makes things easier


I know that the VL53L0X has a too small range to be useful, but what about the VL53L1X?
Because it would bring the cost down significantly…
Are 3 meters enough for a useful obstacle avoidance?

Yes for indoor only it would work.

Dear Patrick,
I´m pretty impressed of your TFMini POC ! So I tried to (re)build it according to your instructions. I got 5 TFMini (one facing downwards) and attached them each to a Attiny85, flashing those worked after some troubleshooting, so most of the hardware is set up and ready. But I can´t get the ProMini to work, compiling the ino-file in Arduino 1.8.9 is always stopped by error message that “mavlink_msg_distance_sensor.h” was not found. I used several mavlink libraries from github, but none of them works.
So, I´m stuck here. Any idea what I´m doing wrong?


You need to build this header file from a recent copy of MavLink using the python script in order all the new messages and modifications.
Refer to this excellent blog for detailed instructions:

Please note that mavlink site has moved here:

Ok, I was able to generate a new library with mavlink generator. I used regarding to the mentioned instructions c as language and ardupilotmega as xml-file. I copied the folder as “mavlink” into the library folder of Arduino IDE. mavlink is shown as library in Arduino IDE, but compiling still hangs up with the error message “mavlink.h not found”. Indeed there is no mavlink.h in the root directory. There are serveral mavlink.h files in the subfolders named ardupilotmega, common and others. The distance-sensor-header file is located in commons.
So, what do I need to add? Copying those files in mavlink root folder doesn´t work, including mavlink library into the ino-file adds following header files to the code, but with no effort:
#include <checksum.h>
#include <mavlink_conversions.h>
#include <mavlink_helpers.h>
#include <mavlink_types.h>
#include <protocol.h>

Thanks for help in advance!

To make things simpler I added my mavlink library == look at the last line of the blog
Enjoy !!

1 Like

Copied your library and it compiled instantly like a charm! Many thanks to you and your efforts!


Yesterday I tried playing a bit with Mavlink messages but I couldn’t get it to work, so I decided to give the code on Github a try but also that I wasn’t able to run…
I’ve tried different baudrates and swapping RX and TX cables but nothing solved the problem.
I’ve used an arduino mega and since I don’t have the attiny etc. I just placed constant values for distance…

Any idea what I could be doing wrong?
Thanks in advance

Hello Mister Poirier,

I am very interested in your project about avoidance. I have tried to implement it on my pixhawk with the code that you specified about using arduino. But the results of the radar in the mission planner did not show any changes. I am very confused about anything from mavlink from Arduino to Pixhawk to nothing. Yet when I use raspberrie for communication with Pixhawk, it can happen well. I don’t know where is my fault, can you help me solve my problem?

This code runs on an Arduino only.
You have to validate that the systems is sending MavLink messages using the Mavlink inspector tool (CTRL-F on Mission Planner)

I’ve tried the mavlink inspector, and the results are still not there. I just copied pasted yout code on Github, nothing I changed. i use radiolink pixhawk 2.7 and it runs on arducopter 3.6. Does the type of pixhawk and software also affect?

Btw, my arduino is promini 5v, we know pixhawk have level power 3.3v,
does it matter?

You have to confirm the code is working ok on promini : you must have data going out at the serial port, you should see MavLink binary message output on Arduino monitor

I’ve tried to see the serial output from Promini in serial monitor. but I can’t read it because it only shows binner code in the form of boxes and occasional question marks

That is ok , then just make sure you set both serial speed correctly and get tx-rx connection. Then you should configure to read proximity message from MavLink
Proximity Type 2

Revisiting the POC with a Q330 and 5 TFMini covering full 180 Deg

Actually it is 6 TFMini there is one looking down acting as altimeter as well:


Avoidance set to 2 Meter

Here is the video of test (Sorry for poor quality and messy background…)


very cool as always
Keep up the cool and interesting work

1 Like

That’s very interesting ! Thank you for the update. :revolving_hearts:

I think TFmini Plus (12m, FOV 3.6°, 1-1000Hz, IP65) also works ?

Servers by jDrones