Build a Pocketable LiDAR Rangefinder (Size: 3.8*2.8*1.9 Cm)
by Adu_Echo in Circuits > Gadgets
4637 Views, 46 Favorites, 0 Comments
Build a Pocketable LiDAR Rangefinder (Size: 3.8*2.8*1.9 Cm)
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.
Downloads
Supplies
For the electrical material, you need these:
- TF-Luna Lidar sensor *1PC (Lidar sensor, range 0.2- 8.0M)
- 401030/90mAh/3.7V lithium battery *1PC (Power Supply)
- LT4054-4.2V lithium charger management IC *1PC (For lithium battery charging)
- 0.91 inch 128*32 OLED with SSD1306 driver *1PC (Display)
- 100nf/25V 0805 MLCC capacitor *1PC (for lithium battery charger IC LT4054)
- 10K 0805 resistor *1PC lithium battery (for lithium battery charging current setting ~100mA)
- 4.7K 0805 resistor *1PC (For limit charging status LED current)
- 3mm LED *1PC (For charging status indication)
- 2.5*2.5 mm push button *1PC (For Run/Hold function)
- Slide switch *1PC (For Mainpower switch)
- Micro USB connector *1PC (For Charging connector)
- STC8F1K08(s) MCU *1PC (Main controller)
- Some colorful thin cables
And for the HW tools, you may need these:
- Solder station
- Caliper
- Ruler
- Electronic protractor
- Scissors
- Utility knife
- Rubber gloves
- Electric drill
- Hot melt glue
- Tapes
- Two-component high temperature resistant glue
- A4 white paper with adhesive
- Printer
- USB to UART adapter(For programming STC MCU, I got one when I ordered the TF-Luna module)
- Windows PC
For the SW, you need:
- STC-ISP (free tool from STC MCU used for STC MCU flash programing)
- The Hex file for the MCU ("MiniLidar.hex") provided in step3.
For the enclosure, you may need:
- 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:
- Interest, patience and carefulness
Build the Enclosure
- Print the "Enclosure_Inside.pdf" with A4 white adhesive paper.
- 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.
- Past the printing adhesive paper on the metal of can, then cut it with sissor.
- Drill holes for the Lidar/LED/PowerSwitch/Button/MicroUSB/OLED, please be careful with the tools!!!
- Cut out the enclosure from the aluminum flakes with scissor
- Bend the flakes with tool(here i use a electronic protractor to hold the flakes)
- 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.
Downloads
Build Tiny Charger
- 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.
- 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.
- 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.
- After curing, check again that the charging circuit is functioning normally.
Program the MCU
- 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.
- Download the STC-ISP tool for windows: https://www.stcmicro.com/rjxz.html
- Download the "Minilidar.Hex" in the attachment
- 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.
- Remove the MCU from the programer, now the MCU is ready to work.
Downloads
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:
- 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.
- Connect the MCU's Pin8 with OLED's SDA, Pin7 with OLED's SCL,Pin2 with OLED's VCC, Pin4 with OLED's GND.
- 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.
- Connect the button via MCU's Pin3 and GND.
- 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.
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.
Make It Prettier
- Print the "Enclosure_Outside.pdf" with A4 white adhesive paper(To measure very short distances a ruler scale is placed on one side).
- 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)
Downloads
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.