TFmini 360°(almost) lidar

Hi,

after using servos to sweep the TFmini was no durable solution (I burnt a lot of servos), I now made the TFminis beam rotate in 360°. Other solutions I found on the internet used belts and sliprings and a host of other hardware. I wanted it as simple and compact as possible, so I did it like this:

A stepper motor is turning a mirror made from a harddrive platter angled at 45°. The stepper motor is driven by a Easydriver module. The whole thing is controlled by a STM32 blackpill, which transmits the ranging data via mavlink to the autopilot. Scanning is slower than commercial products, but it is fast enough for a rover.
Sorry, I can not show the lidar in operation right now. The TFmini decided to break. A TFmini-plus is on its way.

4 Likes

Hello sorry im writing here, i didn’t know how to contact you directly. i have read your old thread about getting old data from Tfmini but there wasn’t clean solution for it. Can u explain me how did you solve it? Did you were only openning and closing serial port in loop{}?

Hi,

to get rid off the softserial stuff, I used a Teensy3.2. But any board with more than one serial port or a TFmini with I2c should solve the problem.

i’m using mega 2560 but my TFmini comunicates by UART without softwareserial so maybe it’s the problem. Thank you.

Good day, im doing some tests with few tf mini s…, maybe it’s not necessary add an extra board for set multiple tf mini as 360… stay tune

Hi, what value do you put in PRX_TYPE & RNGFND1_ORIENT? Basically, how do you setup tfmini as a 360 lidar? Cheers

The sketch on the controller submits mavlink “distance_sensor” messages. The orient field value gets updated depending on where the mirror is facing at that moment. PRX_TYPE is mavlink (2), rangefinder is not used.

@count74 might I suggest using OBSTACLE_DISTANCE instead of DISTANCE_SENSOR. https://mavlink.io/en/messages/common.html#OBSTACLE_DISTANCE

OBSTACLE_DISTANCE was meant for such 360-degrees sensor, and does a good job in building the “proximity boundary” used for avoidance.

Hi,

I’m using a similar setup as your with TFmini, but with a 3d printed mini tower, servo and 2 gears (50 grams with everything). I’m a bit confused with the setup: I understand that there are 2 ways of obstacle avoidance, rangefinders & proximity sensors. In your case, you’re going the second way and you use PRX_TYPE=2 (Mavlink), I suppose it’s for using mavlink messages for communicating between the tfmini & the flight controller. My confusion is about the softserial stuff (no idea what it is), Teensy3.2 (do we need a separate Arduino board to communicate in this setup?) and the rest of the parameters needed to setup in order to work. How do we know the position of the TFmini or we just don’t care about it and the copter just uses stop command (not gliding)?
I will be very grateful if you share you knowledge and experience!


Kris

2 Likes

For my TFmini setup using a servo, I moved the servo to 3 ( front-left/front/front-right ) or more positions and submitted the “distance_sensor” message for the orientation the servo/TFmini was pointing. Controlling the servo, reading the distances and sending the results via mavlink was first done by a arduino nano and then by a Teensy 3.2. The nano only has one hardware serial port, so I had to use the softserial library to get a second port for the TFmini.

Hi,

I tried to use the “obstacle_distance” message, but it messed up the timing for the stepper motor, making it run slow and rough.

Hi, I’m using a continuous servo mapped to the channel 10 for on/off(turns around 120rpm), so there is no need to really control it. In mavlink analyser, I see well the values for distance_sensor and obstacle_distance. Why do I need to send obstacle_distance message, given that they are already read in the FCU? So in order to send the results, the only way is to use arduino nano/Teensy 3.2(or other board)? The part I don’t understand is how to link the servo position (is it possible for a continuous servo?) with the tfmini reading, so I can know Tfmini’s sensor reading to which direction is related. Do you use a script? Thanks a lot for your quick reply.

To get the position of a continuous rotation servo you will need an external rotation sensor or a servo with an integrated sensor and an output for it. There is no way of doing it with the FC alone, you will need an extra controller like an arduino i.e.

Thanks a lot Sebastian, sounds logic. I’ll buy a Teensy and will read a bit more to figure out a solution for the sensor.

Do not buy a Teensy. I would go with a STM32 bluepill or a blackpill. Teensys are expensive and only 3.3Volt on all pins.

Parallax makes a feedback servo:

Thanks a lot @count74 for your help and the recommended items! It’s definitely something that could be useful also for other people learning about obstacle avoidance systems.

Hey out there.
Anyone have a 3d file for a TF Mini Plus…STL or perhaps a SKP.
Looking to put the mini in a drone I am working on and want to design the frame to properly support it.

Cheers

Stp and STL attached from GrabCad. I converted the STL from the STP so not sure if it will work for you. TF Mini.zip (497.6 KB)

Awesome DAve thanks very much