Servers by jDrones

How to make the TFMINI rangefinder talk I2C

(Luis Miguel González Fernández) #185


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.

(Nathan E) #186

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.

(ppoirier) #187

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.

(Nathan E) #188

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

(ppoirier) #189

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

(Nathan E) #190

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?

(ppoirier) #191

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

(RickyG) #192

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

(Marc Dornan) #193

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

(ppoirier) #194

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

(Marc Dornan) #195

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

(Nathan E) #196

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

(Marc Dornan) #197

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?

(Siya Liu) #198

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:

(Weiyao Lu) #199

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.

(Tom) #200


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

Thank you

(ppoirier) #201

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

(Tom) #202

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?

(ppoirier) #203

No need for UBEC if its just one TFMINI