LiDAR Precision Gauge: Measure Up to 12 m
on
Electric Resistance Welded (ERW) pipes are long pipes with a diameter of 300 mm or more and with a length of up to twelve meters. They are used in our power plant for ash slurry transportation. One day, while handling these long pipes for assembly line-up of ash slurry discharge pipelines, I found that my team had to measure each pipe precisely before taking them out through the exit gate. Every day, at least 30 to 50 times, someone has to devote time for doing these measurements. Out in the open under a 47°C scorching sun, holding the tape measure at one end and a supervisor on the other end, then recording the length, is a very tiresome job. The idea of creating a precision measuring gauge took birth here.
LiDAR Modules
The TFMini-S single-point ranging LiDAR (Figure 1) can take distance readings very fast (100 Hz) and very precisely (1 cm resolution, 1% accuracy) up to 12 m, which is exactly right for the job. There’s also a Plus version which is faster (1 kHz) and has an IP65-rated enclosure. Both come with a serial interface.
Placing the LiDAR at one end of the pipe and then directing it towards the edge plate on the other end will give an accurate length of the pipe. Both versions of the LiDAR have a Field of View (FOV) of 3.4 degrees; therefore, pointing it properly is very important for getting correct readings. To make this easier, we added a push-button-operated laser pointer to our system.
I used an ESP32 module for controlling the LiDAR and for doing the calculations. A small OLED display was added to show the distance readings. Incorporating a running average of a few measurements increases precision. Then the result can be printed as a floating-point value, but for speed and simplicity we have kept it as a plain integer value.
The TFMini LiDARs use the reflection of invisible infrared laser light from the surface of the object that they are aimed at. In case the object does not reflect or completely absorbs or defuses the incoming laser light, the reading will be erroneous. For instance, avoid water and slanted and highly reflective glass windows. Most other objects reflect enough light and measurements are taken easily, even when the object is moving.
Constructing the Range Gauge
When building the device, I had to keep in mind that it had to be portable to allow my team to use it out in the field. The device must therefore be battery powered. The circuit I ended up with is shown in Figure 2. Both the LiDAR and the laser diode that I used for pointing need 5 V. The ESP32 WROOM module needs only 3.3 V. Therefore, I added a mini boost converter which can generate a 5 V supply out of an input voltage of as low as 2 V. I connected a low-dropout HT7333-A voltage regulator to the 5 V output to make 3.3 V for the ESP32. If you use an ESP32 module with on-board voltage regulator, then you don’t need the HT7333-A. The complete setup runs from two 1.5-volt batteries or from a 3.7-volt LiPo battery. Note that the HT7333-A is a surface-mount device (SMD); therefore, be careful while mounting it.
A Word About the Software for TFMini-S LiDAR
The software I wrote for the device is an Arduino sketch and can be downloaded from Elektor Labs. It requires the TFMini library and Adafruit’s GFX SSD1306 libraries that are available from the Arduino IDE’s library manager.
The LiDAR and the ESP32 communicate with each other over a serial port (Serial1). Every 25 ms, a new data point is requested. All the hard work is done by the TFMini library, while the sketch simply provides a user interface. Distance- and signal strength values are printed on the OLED screen and are also transmitted on the “Arduino” serial port (Serial0).
Using the Device
After assembling all the parts on a general-purpose PCB (Figure 3), position the LiDAR on the edge of the board such that it has a clear view of the object. The laser pointer is a plain red laser diode controlled by a push button. If possible, fix it on top of the LiDAR with hot glue (or something similar) such that both point in the same direction.
The minimum distance the TFMini-S LiDAR can handle is 30 cm. Therefore, point it at an object or wall somewhere in the range of 30 cm to 12 m. Measure the distance and cross check with a tape measure. Eventually you will find that the reading is precise up to a centimeter.
The second line on the display indicates the strength of the received signal. As the object moves away, the strength diminishes.
It uses the TFLidar and U8g2 libraries, available from the Arduino IDE’s library manager. The software can easily be extended to add Wi-Fi or Bluetooth connectivity and to control the Automator’s relay and LEDs. It can be downloaded from here.
Discussion (0 comments)