Servers by jDrones

How to make the TFMINI rangefinder talk I2C

(ppoirier) #162

It shows that you are not reading TFMINI serial stream or its not in right format.
I asked before but are you 100% certain that you connect TFMINI TX to Arduino RX ?

(Grant Erickson) #163

Yes I am 100% sure the TFMINI’s TX is connected to the Arduino’s RX

(Grant Erickson) #164

I solved the problem. I substituted my Arducam PRO Mini Atmega328 Development Board with an Arduino Uno and the program emulated correctly. It looks like it was a hardware compatibility problem. Thanks for your patience

(chris rey) #165

thanks @ppoirier, now migrated from serial to I2C, a summary of the procedure find on this blog:

Load the sketch BeneWake_TFMINI_I2C_Maxbotic_Outdoor_Limit (for me)
Upload it to the Arduino Pro board (FTDI connected)
A4 is SDA A5 is SCL
Open TF GUI connect TFMINI via FTDI
The command of standard output is 42 57 02 00 00 00 01 06 Arduino Compatible
Modify output unit to mm output: 42 57 02 00 00 00 00 1A
Connect to MP and apply the following settings:
RNGFND_TYPE 7 (LightWare)
RNGFND_ADDR 112 (70 Hex is 112 Dec)
Reboot the FC and it works perfectly

(chris rey) #166

did you try your code with a Pico?

(ppoirier) #167

No, does the Pico expose bothe the Serial and the I2C ?

(chris rey) #168

Do not know, just seen this and was impressed by the very small size:

(ppoirier) #169

Did you know that I made the Multi-Sector TFMINI detector using ATtiny ?

(chris rey) #170

:clap: yes, WITH and Arduino Pro Mini as controller as I can read in your blog…

(ppoirier) #171

The Arduino acts a a multiplexer for the I2C bus and sends the rangefinder distance and corresponding angle signals to the FC over serial MavLink.

(.) #172

Hi to all.

I have a question about the arduino code for translate the serial output to i2c.
At the state of the art i can only read the distance measured from the lidar.
If it’s setted as “proximity sensor”, the drone can reach at minimum the distance written in the code.

Is it possible to upgrade the arduino code in order to send the readed distance to a pixhawk and let the drone to maintain that distance?

Thanx to all.

(ppoirier) #173

This is basicslly what avoidance is doing. Take a look on ardupilot avoidance wiki to see how to setup rangefinder and parameters

(.) #174

i can set the rangefinder as:

  1. terrain following;
  2. object avoidance

Setted on 1, it means that the drone maintain the heigh (for ex. during translation).
Setted on 2, it means that the drone doesn’t go nearest than the distance setted.

In other words, with option 1) the drone follow the terrain trend (maintain a distance); with option 2) the drone doesn’t follow the wall trend (avoid a distance < than the one setted).

Am i wrong?
If it doesn’t, the question is: Is there a way to implement a code that let the drone to maintain the setted distance, when it is on “proximity sensor” ?

Thanx to all.

(ppoirier) #175

Yes , I have one of my quad with 2 TFMINI installed and I set I2C address 70 to altitude and address 71 to avoidance.

Have you look at avoidance library ?

(.) #176

I try to redo my question in a better way.

If i install a lidar as altitude holder (pointing on the ground), and i move in a transaltion motion, the drone follows the ground and maintain the altitude.

If i install a lidar as proximity sensor pointing on the wall), and i move in a traslational motion, the drone doesn’t follow the wall. It only avoid to reach at least a distance from the wall, but it can get away form the wall (direction not parallel with the wall, wind gusts, etc…).

The question is: Is it possible to maintain constant the distance from the wall, during a translation?

Thanx to all.

(ppoirier) #177

Altitude is ‘‘easy’’ to detect because the IMU has a fixed vector called Gravity.
In the case of a wall following, it is different matter, because this surface is not in a fixed plane so in this case, you could use a scanning Lidar that would allow this type pf avoidance.

I suggest you open a new discussion in the forum, because the question is not directly related to the subject and you would benefit from more input with a new discussion

(Siya Liu) #178

Hi, friends on Ardupilot. I’m rather regret that we Benewake team did not reply your questions for long time, cause we are facing network connection problems all the time, even now, we still can not login when we are in office, and finally I’m able to log in here with my PC at home.

If you need any assistance from Benewake, pls contact in case we did not reply in time. Thank you : )

(Alfonso) #179

I only write here to thank everyone and especially to ppoirier the work done. Of course to thank also the whole community that makes Rover easier. I have only been with Pixhawk + Rover for a few months and it has been relatively easy for me to connect my TFMini to Pixhawk 1 through the I2C port and verify that it distanced from the wall in front of it.
PD1 .: To correctly configure the TFMini and from its WINCC TF V1.1.2 application, I had to enter the start cmd, wait for sampling to pass to 0, standard output cmd, output cmd to mm, and finally abandon cmd.
PD2 .: In Arduino sketch BeneWake_TFMINI_I2C_ProMini_Maxbotic_Fast_Blink I had to modify “uint8_t Scaling = 13;” because it means more than what the tape measure showed.
The next step is to put another TFMini in the back of the Rover.

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

Hi everybody.
Just one question.
¿ This I2C aproach will work with standard arducopter 3.5.7 directly out of the box on my pixhawk 2.1 or a driver mod is needed ?

Thanks in advance.

(ppoirier) #181

Yes it is because it emulates a standard I2C device