Servers by jDrones

Avoidance Experiments with the POC and Benewake TFMINI

(ppoirier) #15

Well, look at google for arduino experiments with sonar, experiment with it and when you you gain experience, you could probably try to adapt this experiment Basic Obstacle Stop System-Build Log and firmware

(Deepanshidrone) #16


I am trying to do a similar project but instead of the TFMINI I am using Maxbotix I2CXL sonars and instead of an Arduino Mini Pro I am using an Arduino UNO. Once the Arduino UNO is ready to send the Mavlink DISTANCE_SENSOR message, how should I connect it to the Pixhawk?

Thank you,


(ppoirier) #17

Its connected using serial port and you set the PixHawk port to Mavlink with 115k baud

(Deepanshidrone) #19

Thanks a lot again, you are helping me alot.
But I still have not clear which would be the “wire diagram”. Which “pin out” of the Arduino should connect the Serial port of the Pixhawk?

(looninho) #20

Hi Mister Poirier,

Thank you for sharing your beautiful POC. Before building mine, i have a question about the baudrate in the Attiny sketch : if I understand TFMini connect to Attiny85 by serial with bRate = 115200. But in the sketch (line 60) mySerial.begin(9600). Should I change to 115200?


(ppoirier) #21

Yes you can change the speed to 115200.
The reason I changed the TFMINI speed to 9600 (Using the TFMINI speed setting commands) is to reduce the risk of data overruns because there is no buffer on the SoftwareSerial.h

(looninho) #22

Oh I see. I’m waiting for my 5 TFMINI ordered yesterday.
Thank you

(Dpsoftware) #23

Hi Mister Poirier,
Thank you for sharing your POC . I have a general question for you. Before to assembly the hardware necessary I tried to use SITL with an Arduino to emulate the proximity sensor . Simply Arduino send the mavlink message for distance sensor to SITL through the serial. When I use loiter mode work fine, but in althold or guided mode the avoidance control don’t work. Wiki explain that avoidance control it’s possible in althold, loiter and guided mode. Does it possible to simulate the behaviour in SITL ? Did you perform some test in guided mode ?

(ppoirier) #24

Hello, I don’t think having tested in guided. Incidentally I am revisiting the avoidance library theses days with a new setup, and I will try this mode and report back

(Dpsoftware) #25

Oh thank for your answer I will stay tuned!

(RickyG) #26

Hey Patrick
IS there a document on how to actually build this thing. Would love to give it a try.

(ppoirier) #27

The POC ?

Well the blog is pretty self explain it all…

(MartinKeilloh) #28

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

(Vabe) #29

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?

(ppoirier) #30

Yes for indoor only it would work.

(Marcel Essers) #31

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?

(ppoirier) #32


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:

(Marcel Essers) #33

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!

(ppoirier) #34

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

(Marcel Essers) #35

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