Benewake TFmini-S: How to issue commands to change from UART to I2C?

IT still requires some form of code to run doesn’t it.

Patrick I assume for this your using an arduino Pro mini.
If so what are you using for the interface to talk to the tf mini. Is it still the Benewake Tf gui. I either need to revert mine back to UART or check the address. Tomorrow I am going to see if the external LED I have on the quad is colliding with the lidar.
But if not then I need to convert back to UART

Hello

Just to make sure, once you sent commands to switch to I2C, the signal stopped on the serial port?

And then you connect scl to scl and sda to sda ground and vcc between TFMINI and Flight Controller?

Well now that you mention it I just assumed the connector was setup for a pixhawk…its the right type of connector for an I2C hub or port.
But I think the SCL and SDA are reversed on this
This is the pixhawk I2C buss pinout


This is the TFMini…DOH
image

@rickyg32, may I ask what Flight Controller you use ? I am using a Holybro Pixhaw 4. I am just trying to find out what our setups have in common to not work where others seem to be working including the tests of @ppoirier.

Thanks
Jan

If that can help

please note the green-white are criss-crossed

So here is how to get the TF Mini Plus working on Pixhawk I2C.
Connect your TF Mini via the supplied cables to a TTL to USB adapter.

image
Connect via the USB cable to your PC.
If you have not already downloaded the TFMini Gui…do so from http://en.benewake.com/support
Open the Gui

  • Set the product type to TFMini Plus
  • Select the correct Com Port
  • Click connect.

You should start seeing distance information on the graph in the gui.
image
Using the command line function issue the following two commands by pasting each in the command line and pressing send
image
5A 05 0A 01 6A
5A 04 11 6F
The first sets the device to I2C and the second forces a save.
Nothing should appear on the graph from this point on.
Next you need to connect it to your Pixhawk or I2C hub.
Please note that the pinout on the supplied connector has the SCL and SDA reversed. You need to pull out the pins and swap them.
image
Please note the SCL and SDA are reversed.

You need to configure a few settings in Arducopter.
RNGFND1_ADDR,16 This is the I2C address for the Lidar
RNGFND1_GNDCLEAR,34 This the distance from the Lidar to the ground…easiest way to set it is to have the drone report the distance to the ground when sitting on your workbench and then enter that distance.
RNGFND1_MAX_CM,600 Set this as the max distance the device will be used.
RNGFND1_MIN_CM,30 This is the minimum distance for the lidar.
RNGFND1_ORIENT,25 This is telling Arducopter that the lidar is pointing down
RNGFND1_TYPE,25 This sets the lidar type to TFMini I2C
It should be working now.
Good luck

Thank you @ppoirier for all your help and patience.

4 Likes

I am using the Pixhawk mini in this instance. Please check the setup doc I just posted that might help. I consolidated all the information thats been provided into one spot. It works I did it this morning successfully.

1 Like

Thank you both @rickyg32 and @ppoirier. I have different values for RNGFND1_GNDCLEAR, RNGFND1_MIN and RNGFND1_MAX but my values work if I use it as UART, the other values are the same. I am using the I2C A port on my Pixhawk 4. I will do some more troubleshooting on a R-Pi, I have no clue what else to try.

Regards
Jan

PS: Also just to mention, the TFmini S has the following pin out, I did swap the connectors around so they match up with the Pixhawk:

If you have an Arduino , you may try this

1 Like

I am not a coder, I feel way more at home on a Linux CLI than an Arduino. I try the Linux approach 1st and see what happens :wink:

Thanks
Jan

Did raise a question in Mission Planner tag - no response. Looking at the app history nothing has happened with it in years.

Not sure if people noticed, but when implementing this I also added a script to switch the mode back and forth from UART <-> I2C. See Tools/scripts/tfminiplus.py in ArduPilot’s repo.

Thanks Lucas
Here is the link

Well finally this whole thing inspired me to push for this

1 Like

How are you making out Patrick

1 Like

Did you read the blog?

Yes very cool.
You tried very hard to hit your garage door with no luck. lol.
What would be interesting at some point is to design a drone with this hardware taken into account. So the drone looks like its a drone and not a drone wearing a big hat hahaha.

Please add comment on blog and I will answer there

i fricking love you guys. i was beating my head against the wall trying to make my tfmini plus work on i2c last night. i thought i bricked it so i exchanged it and was about to give up when i found this thread. thank you @ppoirier and @rickyg32

1 Like