Servers by jDrones

Avoidance Experiments with the POC and Benewake TFMINI

(cthill24) #10

@ppoirier Thanks for the work done on the TFMini! I was an early buyer and ran into trouble until I followed your posts.

Given lack of documentation, I have been pilfering through code and discussion for better understanding. I really want to try and get examples of the TFMini POC and the VL53 up and running. I have most of what I need except the ATTinys’.

It appears you are using pins 2 and 3 on the ATTiny for RX and TX, and pins 7 and 5 for SCL and SDA to the ProMini, correct? For the most part, everything else looks pretty clear.

As for the VL53L0X setup, I don’t know where else to post questions to. If there is a dedicated thread for it please point where for any future questions.

I read through whatever documentation I could find on how you set this up, but I am left with a couple of questions.

Is the setup running on two different arduino boards, Mega for Mavlink distance messages and Mini for setting ID/addresses via xshunt pin? I see what appear to be .ino files for both.

Is there a photo or diagram for your setup showing where each sensors xshunt pin corresponds to on the Mini?

These are the only things I am really unclear on before attempting to set one up.

(ppoirier) #11

You can have more info here:
Basically all you need to know is in the code

This code is pretty simple and you can see the shunt pins and the VL53L0X addressing here:

//#define XSHUT_pin6 A7 //not required for address change
//#define XSHUT_pin5 A6
#define XSHUT_pin4 A3
#define XSHUT_pin3 A2
#define XSHUT_pin2 A1
#define XSHUT_pin1 A0

//ADDRESS_DEFAULT 0b0101001 or 41
//#define Sensor1_newAddress 41 not required address change
#define Sensor2_newAddress 42
#define Sensor3_newAddress 43
#define Sensor4_newAddress 44
#define Sensor5_newAddress 45
#define Sensor6_newAddress 46

(cthill24) #12

I knew I was a bit rusty on Arduino IDE, but I had no idea. After updating the IDE, all my libraries and spending a couple of days reading through a myriad of discussions, I was finally able to compile basically everything in your repo for obstacle avoidance.

If this goes into the wiki it could certainly use some further elaborating on in regards to the Mavlink libraries and header files for the novice programmer.

Once I get everything wired up and running I will post my results for anyone else who may be interested.

Thanks for everything you have contributed on this so far!

(ppoirier) #13

@cthill24 good to know, and Yes , you can share your results so other can benefit

(Deepanshidrone) #14

Sorry for my ignorance, but I still don’t know how to I have to do it to connect my sonars Maxbotix I2CXL EZ4 to the Pixhawk (collision avoidance system). Should I connect them to an arduino board and use your code TFMINI_I2C_Mavlink to send the DISTANCE_SENSOR message to the pixhawk? But then how I connect the arduino to the Pixhawk?

Again, sorry for my ignorance, I am quite new in this world. Thank you so much for your time.

(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.