Mictronics - DIY Electronic projects and more.

Laser distance meter hack

I'm finally hacked a cheap laser distance meter from Amazon. Arduino Mini is taking control. Someone else tried before but gave up on this. Mine looks the same like the KKMOON but has no brand marking.

Laser distance meter under hack.
Laser distance meter under hack.
Bench setup for development.
Bench setup for development.

Taking the laser distance meter apart.

Battery box and backside label.
Battery box and backside label.
Init screen.
Init screen.
Operational screen.
Operational screen.
Laser distance meter open.
Laser distance meter open.
Main board front.
Main board front.
Keyboard markings.
Keyboard markings.

While there are no outside markings, the inside reveals the manufacturer - SNDWAY. Seems to be an SW-A40.

Optic board marking.
Optic board marking.
Main board back with two missing chips.
Main board back with two missing chips.

Hackaday.io has a description of several pads on the main board.

Description of pads on main board. Origin hackaday.io.
Description of pads on main board. Origin hackaday.io.

The keypads on my device main board are different to the description above.

Keypads on main board. No all keys available.
Keypads on main board. No all keys available.

Debugging pads on the main board backside providing acces to the STM32 SW debug port. I tried with an ST-Link V2 just to find the chip being locked in protection level 1. So one can not read the firmware. However, there are two chips missing on the main boards back side. So I probed the with an oscilloscope. Found three pins with activity on which is an unidirectional SPI bus.

Missing chip pinout for data bus.
Missing chip pinout for data bus.

Details about the bus that I found so far:

Single 68 bytes frame.
Single 68 bytes frame.
Single frame length 16.6ms.
Single frame length 16.6ms.
Frames with 2Hz rate.
Frames with 2Hz rate.
2Hz frames with additional frame right after measurement end.
2Hz frames with additional frame right after measurement end.
WTwo consecutive frames after measurement.
WTwo consecutive frames after measurement.
Start of frame with first three bytes.
Start of frame with first three bytes.
First byte of frame.
First byte of frame.

Before you connect any hardware to the LCD bus of the laser distance meter make sure it runs at 3V signal levels! The Arduino Mini by default is not! Solutions are either level converters or, what I did, simply exchange the linear voltage regulator IC1 on the Arduino Mini board to an 3V version.

Running the Arduino Mini at 3V brings also the advantage that you can power the device main board directly from the Arduino Mini. Doing so requires an additional capacitor of at least 1000uF/6.3V connected to the power input (where the battery wires were connected) to buffer any power surge when the device and laser will be switched on.

Next I coded a quick and dirty sketch for a Arduino Mini board. It uses the circular buffer library from https://github.com/rlogiacco/CircularBuffer.

This code reads two frames then sends them via serial interface. It ignores the very first short pulse leading each data byte. The result looks like this:

10 00 C0 00 00 0A 00 02 00 00 05 58 00 00 00 00 00 10 01 C0 00 00 06 00 02 00 00 03 F0 00 00 00 00 00 10 02 C0 00 00 02 00 02 C0 00 C5 70 00 00 40 00 00 10 03 C0 00 00 00 00 42 00 00 07 58 60 00 06 00 00
10 00 C0 00 00 0A 00 02 00 00 05 58 00 00 00 00 00 10 01 C0 00 00 06 00 02 00 00 03 F0 00 00 00 00 00 10 02 C0 00 00 02 00 06 C0 00 C5 70 00 00 40 00 00 10 03 C0 00 00 00 00 42 00 00 07 50 60 00 06 00 00
10 00 C0 00 00 0A 00 02 00 00 05 58 00 00 00 00 00 10 01 C0 00 00 06 00 02 00 00 03 F0 00 00 00 00 00 10 02 C0 00 00 02 00 02 C0 00 C5 70 00 00 40 00 00 10 03 C0 00 00 00 00 42 00 00 07 58 60 00 06 00 00

Each 68 bytes frame contains 4 sub-frames of 17 bytes starting with:

10 00 C0
10 01 C0
10 02 C0
10 03 C0

These are command bytes (first bit = 0) while the remaining 14 bytes are LCD data (first bit = 1). This bus is driving the LCD.

2F 34 B1 1E B2 0F 14 A0 94 68 3D 88 88 88 88 60 E3
10 00 C0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 10 01 C0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 10 02 C0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 10 03 C0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF
10 00 C0 FF FF FF DF FF FF FF FF FF FF FF FF FF FF 10 01 C0 FF FF FF F7 FF FF FF FF FF FF FF FF FF FF 10 02 C0 FF FF FF FB FF FF FF FF FF FF FF FF FF FF 10 03 C0 FF FF FF F3 FF FF FF FF FF FF FF FF FF FF

First line is configuration data for the LCD driver while the two lines with all byte 0xFF are showing all the LCD segments and symbols that we can see for a short moment on the power on screen.

The following sub-frames are showing all symbols of the lowest LCD line, where the actual measured distance is shown including its unit.

10 00 C0 00 00 00 00 00 00 00 FF FF 00 00 00 00 00
10 01 C0 00 00 00 00 00 00 00 FF FF 00 00 00 00 00
10 02 C0 00 00 00 00 00 00 00 FF FF 00 00 00 00 00
10 03 C0 00 00 00 00 00 00 00 FF FF 00 00 00 00 00

So we can break down the distance look-up process into 2 bytes per sub-frame, 8 bytes in total or 64 bit. The look-up table for each number per digit, sign and unit is available for download below.

Lookup Table

This Arduino code will simply read out the distance and sends via serial interface.

Bench setup for development.
Bench setup for development.

Final code to control and read the SW-A40 laser distance meters.

👈 Home