How to make the TFMINI rangefinder talk I2C

Hi.

Almost done.

I’ve made a minor modification to the arduino sketch in order to only toggle LED state every 5 samples read from the TFMini. Without this, LED keeps always on.

1 Like

Hello @ppoirier,

Could you please give a recommendation for the min and max signal strength thresholds that you use and if you use a range limit? I seem to be having trouble with false intermediate-distance noise readings on arduplane causing incorrect ground distance readings momentarily.

I am able to send commands, but I’m not entirely sure what the best settings are. I’m also a bit confused about what to enter with the commands based on the user manual. EE and FF thresholds aren’t the most clear to me.

As of now, I am entering the following:
42 57 02 00 00 00 01 02 (Enter configuration mode)
42 57 02 00 00 00 04 06 (Pixhawk format)
42 57 02 00 00 00 07 11 (Long distance mode)
42 57 02 00 50 50 01 19 (Range limit enabled, threshold 50??)
42 57 02 00 50 00 00 20 (Lower limit of threshold 50??)
42 57 02 00 20 00 00 21 (Maximum signal strength threshold 200??, 0cm sent when max)
42 57 02 00 00 00 00 02 (Exit configuration)

Is this correct?

Ideally, I only need a very reliable reading between 0-6m. Right now even at 5m, I’m getting random noise down to 1.5m, etc. I am connected to a serial port, but my understanding is that the data should be the same.

It really depends on the use case; but basically what is the surface are you flying over ?
Did you check the signal with the Benewake GUI to confirm you have these glitches on the same surface ?
On the same interface you can see as well the signal strength, that may help setting values, but generally it works as factory default.
Most of my tests are done using a quadcopter tat low velocity (5-10 M/s) over grass and I can fly up to 6 Meter no problem.

Grass and 2m tall corn. I can’t seem to repeat the behavior on the ground with the GUI. I’m flying at 10-15 m/s

Just make sure you power supply to the TFMINI is stable (might some filtering like 100 microfarad capacitor).
15 M/S might be too fast for the ToF reading averaging, try to correlate noise-vs-speed on the logs

I’m powering it with a Mauch BEC. I’ll have to run more tests. Do you think my settings are appropriate and correctly sent?

There is just one way to know for sure, looking at the log

wow learned a big lesson today.
When running the lidar, make sure its on it’s own 5vdc bec. I have been struggling for weeks with a quad that won’t measure current and today I disconnected the lidar and current sensing started working.

Tomorrow it will be on it’s own supply…dang

Curious to see if you get this working for Arduplane landing.

I suspect the short outdoor range ot the TFMINI - 6 Meter- is not sufficient for optimal airplane landing assist

That is what I suspected to be the case – I have not seen anyone successfully use it for this.

We got it working for arduplane flare assistance. Longer range would be ideal, but it works as intended.

1 Like

Good to know as i have one of these that I want to use for the same purpose. This was using i2c as per this thread? Were there any special settings that you used?

Hello, friend, if you interested in TFmini with I2C interface, we have an open task to develop/add the I2C protocol to the latest firmware for APM developer, welcome to check.

TFmini I2C version Datasheet:
02_TFmini-I²C-Datasheet V1.1 EN.pdf (401.6 KB)

Pls check my another Blog for more info:

1 Like

Hi everyone!

I just received a test batch of TFmini I2C versions.
Anybody managed to get these to work?
Seems that regardless of the RNGFND_ADDR set to (0x10 = 16) and setting the RNGFND_TYPE to any of the available I2C versions, it just dosn’t want to output any sonar values.

Hi

Does this method also work for the TF mini plus as well?

Thank you

Probably, if not you may need to reduce the data rate

Thank you for your help pporier, and just confirming this has been successfully used on a pixRacer if you’re using a UBEC or similar for power?

No need for UBEC if its just one TFMINI

Hello,

I am struggling with connecting the TFMINI Plus to Pixhawk Mini. I decided not to use UART version, due to lack of serial ports on my PX, but I2C.
I found out that the I2C does not work out of the box (on my Pix at least). I found the command 5A 05 0A 01 can switch the interface from serial onto I2C. Pressed the button and the data on serial port stopped updating. Looks like the working interface is now I2C.
Unfortunately ArduPlane that I am using still does not see it at any option withing I2C in rangefinders.
Any ideas how to properly set the TFMini Plus to talk to Pix directly via I2C (skipping the Arduino Pro Mini).

Thank you in advance for your help and support.
Hubert

Hardware:
Pixhawk MINI by 3DR (ArduPlane V3.9.4)
TFMini Plus

1 Like