TF Mini LIDAR el-cheapo LIDAR
from DFROBOT Benewake

Why?

The newest LidarLite is around $US150, and around $AU250 by the time it gets down under. I picked this TF Mini LIDAR up from Little Bird for $AU62 plus postage.

Issues - the good

Supposedly the TfMini will read up to 12m indoors, and around 6m outdoors depending on the lighting conditions and the reflectivity of the object. 6m (outdoors) will actually work pretty well for obstacle avoidance (though probably not so well for navigation and mapping around the farm). So this looks like a promising mechanism to try.

Issues - the bad

The TfMini supposedly makes 100 readings per second, and sends the readings via TX serial at 9 bytes per reading. So this is around 900 bytes per second, ie 9000 bits per second including stop and start, and hence should (just be manageable at 9600 baud, and easily doable at 19200 baud. However, by default it communicates via a TX serial at 115200 baud. This is a problematic speed - it's just too fast for reliable bit-bashing on an Arduino. Even if a standard Arduino (such as the Nano) could receive on one pin at that speed, it wouldn't be able to do much else - like communicating with the host, or operating a sweeper motor.

There is not much written about this on the hobby sites, but there are several solutions:

  • Just try it on a small Arduino such as a Nano and see what happens. Hope that the checksum mechanism picks up the errors in the sent packets
  • Use an Arduino Mega (or 2650 based board) with multiple hardware serial ports
  • Get a cheap USB/Serial converter, and run it into a USB port on a SBC (Raspberry Pi)
  • Run it directly into the SBC (RPi) on the RX pin (GPIO pin 10 AKA GPIO-15 on the RPi).
In testing, sure enough, the Arduino Nano didn't receive reliably at 115200 baud. However it is possible to change the RX speed on the TF Mini Lidar by sending it an incantation of 8 bytes at 115200, which is easy from the RX pin of a Raspberry Pi. (The RPi uses 3V3 on the output pins, but has a 5V supply pin, making it suitable for transmitting. There are circuits on the interweb with RX and TX of a 5V Arduino connected directly to the TX and RX of the TF Mini Lidar, but I couldn't actually find anywhere in the documentation explicitly stating that the RX on the TF Mini Lidar was 5V tolerant, so this might be risking the TF Mini Lidar).

With the LidarLite-V1 Sweeper it was possible to handle all the turret sweep and the Lidar reading just with a Nano, and just send data to the (RPi) host via the USB/Serial interface, so clearly that is the goal.

Issues - the ugly! Don't let this happen to you!

The TF Mini LIDAR is cheap in more ways than one! Inserting the cable broke the socket/header right off the PCB! Poor eyesight and lack of care contributed to this, but fundamentally, the white header looks like it is fastened to the black case. It is not. Further, the fact that there is no back on the Lidar means a slight slip of the hand will make the header bend all the way back, and snap all of the pins. And at 1.25 mm spacing, good luck in soldering it back on! Life is like a pineapple: sometimes you get the sweet end, sometimes the spiky end.


... and this was the fix.

The soldering wiz at work used a steady hand and a good eye to re-solder the surface-mount pins, and I mounted the whole unit onto an odd piece of acrylic sheet. Now, if I push the plug in, I will be pressing the socket across the PCB instead of twisting it. A bit of care and things should be fine now. Clearly this is just a temporary mount until the proper robot bracket is constructed, and yes, it was tested and it works again!

Please ...

DO THIS MODIFICATION BEFORE USING THIS DEVICE! (sorry for the shouting).

Software

A simple starting point for the Raspberry Pi - RPiTfMiniLidar.java.

Testing

Before the melt-down the unit was working on the Raspberry Pi (honest!). It was reading well around the room. The ''strength'' reading was up at 1000+ for close bright objects, and get lower and lower for distant walls.

Lidar sweeper

See the lidar sweeper.



Cool links

Get Allegrobotics updates on twitter
Getting Started with LIDAR. A useful introductory video on different types of lidars from DroneBot Workshop.
There is now a library for handling the TF Mini Lidar for the Arduino called "TFMini" on github, which is shown in DroneBot's video above. I don't particularly like the logic in their code, but it works for them.

Conclusion

Conclusion

When the plug was resoldered to the board, the unit worked again, but when it was mounted into the sweeper, it never worked properly. It responded to configuration changes, and returned results, but the results (distance measurements) were wrong. It is not clear whether this is because it was damaged by the breaking of the pins, damaged by my clumsy attempts to mount it, or whether it just broke. Clearly it was not going to be covered under any warranty, so it is (for now) a parked system.

Leave a comment

Something I'm doing wrong? Solved my problems? Got a better idea? Got a similar problem?
Think I might have solved your problem? Ninety-nine problems, but your robot ain't one? Say so ..