Servers by jDrones

How to make the TFMINI rangefinder talk I2C

(ppoirier) #102

:heart:️. Button below just push it

(Siya Liu) #103

Hello, everyone. Greetings from Siya ! If you have any questions regarding to the TFmini micro LiDAR, welcome to contact bw (at) benewake (dot) com for quick support too.

(George Cloud) #104


Quick question: did you have any success in using multiple lidars and pro mini’s with different hex addresses (ex. 112 and 113)? I am trying to implement two lidars at the moment and one works but the other does not. Not sure if this is a wiring issue or what, so wanted to see if you had any updates.

Thanks for your time

(rickyg32) #105

Hey Folks.
Anyone getting a bad Lidar health message in MP. I get it while the quad is on the bench. IT seems to report a height of .43 while sitting on the bench. If I move it over the edge I get 1 meter…which is about right.

Thinks that make you go hmmmm

(ppoirier) #106

@rickyg32 if you read the last paragraph of the blog , I wrote

TFMINI generate an error on low range (below 30 CM), this error make the signal going to longer distance (for example @ 20 cm , it output 40 cm), this error is intercepted by ArduPIlot as a momentary error, that does not affect the flight but is critical on takeoff. I have been told that Benewake is working on this issue

(ppoirier) #107

@gcloud Good question, I never tried , but I will :wink:

FIY I builded a multisensor avoidance system using TFMINI here:

(rickyg32) #108

Thanks Patrick. I had read that and suspected that was the case. But I had corrupted my FC firmware somehow and wanted to make sure all was good.

(looninho) #109

Bonsoir Patrick,

Merci beacoup pour ce super tuto;)

It seems that my TF Mini didn’t change to Pix Mode, so MP displays nothing (Voltage : 0) with LightWareI2C or MaxboticI2C.
With LightWareI2C here are my parameters:
RNG_ADDR = 112

I use Benewake TF GUI software and have data with default mode. when I check Pix Mode the graph freeze and no realtime data anymore.
I want to enter configuration mode with cmd 42 57 02 00 00 00 01 02 but no echo indicating successful sending. I also try to change to Pix Mode with 42 57 02 00 00 00 04 06 but same issue no echo.

So my question is what happens with MP if you let TFMini at default output configuration.

I check many times my connections : Pro Mini is powered by UBEC; Pro Mini powers TF Mini; Rx and Tx are as RobH’s sketch (the last one).

Can I send cmd with arduino?


(looninho) #110

FYI : I use Benewake version BW_DS_TFMini V1.1.2
Date 2017.12.11

(ppoirier) #111


Benewake TF GUI should indicate millimetric values in standard mode, if not ,cut&paste this command in the GUI send command window :
42 57 02 00 00 00 01 06
Do not expect an acknowledge fro the sensor, just restart the GUI and you should see the graph moving accordingly to distance.

The arduino sketch is reading data in standard mode. it expect binary values and a CRC check byte, If you can read clear text from a terminal when you connect to the TFMINI you are in PIX mode and you have to change to standard with the command string showed above.

(looninho) #112

It is in cm in default mode. Here is my screenshot:

So, if I understand :with my pixhawk I have to let my TF Mini in default (standard format) mode and change the unit to mm. Your sketch will do the rest.

after restart, the GUI still indicate cm unit in Y-axis. I send:
for std format: 42 57 02 00 00 00 01 06
then for mm unit : 42 57 02 00 00 00 00 1A

I try also with:
to enter config mode : 42 57 02 00 00 00 01 02
then : 42 57 02 00 00 00 01 06
then: 42 57 02 00 00 00 00 1A
finally to quit config mode : 42 57 02 00 00 00 00 02
Y-axis still in cm unit.

I don’t have my quad now, i will test at home later.


(ppoirier) #113

Looking at the GUI , it seems that you are correct because it reads mm from standard mode.
If it was cm the display would be in Meters.

(looninho) #114

It seems that I always in cm because I have the same problem as @rickyg32, MP shows 0.15 to 0.44.

I read TF Mini with arduino sketch of Benewake manual and it is in cm.

My problem is i can’t change anything on TF Mini.

I’ll try to write directly with Serial.write() but I have to convert the cmd to bytes, I think…

(ppoirier) #115

Worst case you can use RealTerm, its quite a powerfull Terminal Emulator, this is what I use for debugging. You can send binary strings like the Benewake Caommdns strings.

(looninho) #116

ça marche! Merci Patrick!

Finally with Benawake GUI, when I enter cmd 42 57 02 00 00 00 01 02, I have to wait sampling go down to 0 before sending other cmd (42 57 02 00 00 00 00 1A for mm unit and 42 57 02 00 00 00 00 02 for quit config)

Other question: MP allows 2 rangefinder only?

(ppoirier) #117

Good !!!
You should be able to use multiple sensor on I2C you need to change addressing both on Arduino and on ArduPilot Parameters.

(rickyg32) #118

Quick question., Is there a particular firmware level I should have the TF Mini at these days.

(ppoirier) #119


As for this I2C application , its not really important because we use the standard configuration.

(rickyg32) #120

Ok so I don’t need to worry about flashing it with up to date firmware. IS there a newer version of the Arduino ap. I notice there are two versions now.

I am just making sure this new build is up to date on everything.

(ppoirier) #121

I added an outdor release == BeneWake_TFMINI_I2C_Maxbotic_Outdoor_Limit
You can adjust the signal so it does not send ‘0’ when out of range (around 6-7 Meters).