Introduction: Build a Pocketable LiDAR Rangefinder (Size: 3.8*2.8*1.9 Cm)

About: Electronics enthusiast who likes to make a series of useless things

I received my newly ordered lidar sensor (TF-Luna LiDAR module) when I saw this "Big and Small Contest", my kid was playing nearby with his remote control toy car, which was going quite fast. Then I thought a mini speed camera for toy car may be interesting, using this fast (250Hz) lidar module measure the distance(0.2-8m), then divide the distance by time, we can get the speed. But after a quick test, I found that the route of the RC car is not straight, and the lidar field of view is 2deg, so it cannot alway focus on the RC car when the car running on the floor. So the idea of a tiny speed camera was dropped.

Then I checked my drawer which full of e-waste, found a small lithium battery from a broken bluetooth earphone, a PCB from a face wash tool, and a tiny oled display from USB tester. I come out the idea to build a tiny Lidar range finder, which must be small and rechargeable. 

The circuit is quite simple, use a tiny MCU communicate with the Lidar sensor via UART, read out the sensor data and make simple plausibility check, avreage the measurement data, send the value to the Tiny display via IIC bus, so it has real time display. and a hold button is needed, to keep the display value when the user need to hold it. The lithium battery charger also needs a charge status LED. Details are shown in the schematic "Tiny RangeFinder.pdf" in the attachment.

Supplies

For the electrical material, you need these:

  1. TF-Luna Lidar sensor *1PC (Lidar sensor, range 0.2- 8.0M)
  2. 401030/90mAh/3.7V lithium battery *1PC (Power Supply)
  3. LT4054-4.2V lithium charger management IC *1PC (For lithium battery charging)
  4. 0.91 inch 128*32 OLED with SSD1306 driver *1PC (Display)
  5. 100nf/25V 0805 MLCC capacitor *1PC (for lithium battery charger IC LT4054)
  6. 10K 0805 resistor *1PC lithium battery (for lithium battery charging current setting ~100mA)
  7. 4.7K 0805 resistor *1PC (For limit charging status LED current)
  8. 3mm LED *1PC (For charging status indication)
  9. 2.5*2.5 mm push button *1PC (For Run/Hold function)
  10. Slide switch *1PC (For Mainpower switch)
  11. Micro USB connector *1PC (For Charging connector)
  12. STC8F1K08(s) MCU *1PC (Main controller)
  13. Some colorful thin cables

And for the HW tools, you may need these:

  1. Solder station
  2. Caliper
  3. Ruler
  4. Electronic protractor
  5. Scissors
  6. Utility knife
  7. Rubber gloves
  8. Electric drill
  9. Hot melt glue
  10. Tapes
  11. Two-component high temperature resistant glue
  12. A4 white paper with adhesive
  13. Printer
  14. USB to UART adapter(For programming STC MCU, I got one when I ordered the TF-Luna module)
  15. Windows PC

For the SW, you need:

  1. STC-ISP (free tool from STC MCU used for STC MCU flash programing)
  2. The Hex file for the MCU ("MiniLidar.hex") provided in step3.

For the enclosure, you may need:

  1. An empty can or a 3D print enclosure

in my case, many electrical parts are reused from e-waste, so in the following steps, there may be steps to remove parts from scrapped pcbs, which you may not use.

Last but not least:

  1. Interest, patience and carefulness

Step 1: Build the Enclosure

  1. Print the "Enclosure_Inside.pdf" with A4 white adhesive paper.
  2. Cut the can with scissor to get the aluminum flakes, please don't forgot to use the gloves, since the can edge is quite sharp.
  3. Past the printing adhesive paper on the metal of can, then cut it with sissor.
  4. Drill holes for the Lidar/LED/PowerSwitch/Button/MicroUSB/OLED, please be careful with the tools!!!
  5. Cut out the enclosure from the aluminum flakes with scissor
  6. Bend the flakes with tool(here i use a electronic protractor to hold the flakes)
  7. Check the holes you made in step 4 is fit with the related components.(I forgot to drill the OLED windows in step4, and notice it after bending, that's why I get a ugly OLED window). The OLED module is longer than the enclosure, because I planned to cut the PCB of the OLED in the following step.

Step 2: Build Tiny Charger

  1. As mentioned before, in this project I reused many parts from e-waste, so here I cut off the Mirco USB connector from bluetooth earphone PCB, remove the LED/Button/LT4054-4.2 charge IC/thin cables from the facewash tool, these step may not relavant to you if you are using new components. And if you want to reuse the Micro USB connector as me, please make sure there is no short circuit on the micro USB PCB after cutting, because MLCC may shortcircuit due to bending, or the PCB trace/Vias may short during cutting.
  2. Soldering the micro USB connector, resistor, capacitor,LED, battery as the schematic in introduction, then test the charging current, it should be around 100mA by design, if the diviation more than 10mA, you need to check is there somenthing wrong.
  3. The charging circuit is cured in a heat-conducting and high-temperature-resistant(>170°C ) two-component glue for insulation and heat conduction. Here it is in an empty tablet capsule for shaping. Make sure to check that the glue used requires electrical insulation.
  4. After curing, check again that the charging circuit is functioning normally.

Step 3: Program the MCU

  1. Soldering the 7 tiny cables to STC8F1K08 or STC8F1K08S MCU, then connect the VCC/GND/TXD/RXD with the USB to UART board, the other 3wires(IIC+Button) please let them open, you can use either 5V or 3.3V to programe the MCU, the MCU working from 2.0V to 5.5V, and in this application case no decoping capacitor is needed.
  2. Download the STC-ISP tool for windows: https://www.stcmicro.com/rjxz.html
  3. Download the "Minilidar.Hex" in the attachment
  4. Select the correct COM port, load the Hex file in the STC-ISP tool, then press "Download/Program" button, reconnect the VDD pin between programer&MCU, the MCU will be flashed automatically after reconnect, you will get the complete notice in the STC-ISP tool.
  5. Remove the MCU from the programer, now the MCU is ready to work.

Step 4: Electrical System Connection and Testing

Now the electrical system is ready for system integration, please reference the schematics in the introduction section, and you may need additional wires for interconnection:

  1. Connect the battery output from Tiny Charger(step 2) to the OLED VCC/GND, please don't forgot to insert the main power switch as the schematic. Here the idea is using the OLED PCBs VCC/GND as the system power supply junctions points.
  2. Connect the MCU's Pin8 with OLED's SDA, Pin7 with OLED's SCL,Pin2 with OLED's VCC, Pin4 with OLED's GND.
  3. Connect TF-Luna Lidar sensor's VCC/GND with OLED's VCC/GND. Connect it's TXD with MCU's RXD(Pin5), RXD with MCU's TXD(Pin6). Please Notice, Sensor and MCU's TXD/RXD need cross connection.
  4. Connect the button via MCU's Pin3 and GND.
  5. Power on the main switch, the OLED will display the distance. if there is no display at all, please check the SDA/SCL pin connection of OLED. If you get a constant sleep logo with 1.2345M on the display, that means the Lidar is not working, please check the connection.

As mention in Step1, I need to cutoff the OLED PCB to let's it fit with the enclosure, it's may not relavant to you if you are using a larger enclosure. And in case of you also need to cut it, please reference the new connection points in the pictures, and make the isolation for the OLED PCB edge.

Step 5: Put the Circuit in the Enclosure

This step is a bit challenging, you need to fix the USB interface with hot melt glue, a little trick is to cover the USB hole with a small tape as shown in the picture, otherwise the hot glue may flow into the USB connector and block it.

Now that the base model is complete, you need to check that it functions properly and charges properly.

Step 6: Make It Prettier

  1. Print the "Enclosure_Outside.pdf" with A4 white adhesive paper(To measure very short distances a ruler scale is placed on one side).
  2. Cut it with scissor, then past it on the Enclosure, now make a full charge of the battery and prepared for testing.

The system current is around 80mA, it can working around 1 hour.(theoretically It can be improved to 6 hours or even longer with update the MCU's firmware, let the Lidar working in LowPower mode or user trigger mode)


Step 7: Field Test

The range specification of the lidar module is 0.2-8M, the measurement accuracy is +-6cm (0.2-3M), +-2% (3-8M). My MCU SW slows down the data rate to 10 Hz, and take every 5 effective samples averaged value as displayed value, so this helps the accuracy a little bit and reduced the noise.

Use tape to secure this pocketable Lidar rangefinder and laser rangefinder for performance checks(To protect the sticker on this mini range finder, I made a hat for it ), The real measuremnt range is 0.05M to 8.9M, and the performance is better than the sensor's specification, also performs well outdoors and in cellars, as well as on low reflectivity objects.

Big and Small Contest

Participated in the
Big and Small Contest