A quick recap, I brought a cheap LiDAR from Ebay for around £30, see Pt1 for more details.

I started by removing the tiny plugs and fitting DuPont 2.54 headers(female) to the cables.

The next job was to make a converter board, so I would be able connect the LiDAR to a serial port, power it and connect the motor to the control circuit as according to the data sheet.

bottom of the converter

I connected an USB serial cable and started PuTTY, no magic smoke was released so far good. next I tapped ‘b’ and the top of the RiDAR start spinning and began spitting out data on the screen. hitting ‘e’ stopped the top spinning. I copy the output and pasted into a HEX editor to look at the data and could only see garbage!

LiDAR serial output with PuTTY
data in hex editor showing garbage

I next tried a some incomplete Python code written by partner in crime Rob, I butchered it, printed the data to PuTTY screen and saved the output, this look promising but still did not look right and looked to have errors and/or missing data.

Finally I done what I should have done at the start, I wrote a simple Python program that read the serial data and writes the data to a file.

import serial
import time

startTime = time.time()

with serial.Serial('com3', 230400) as ser:
    print('Start spinning')

    while (startTime + 20) > time.time():
        data = ser.read()

    print('Stop spinning')


The code basically, opens the serial port, send the start command to start the sensor spinning and outputting data, then reads the data from the serial port and writes the data to a file. after 10 seconds it stops collecting data and sends the stop command.

correct data!!!!

Once again loaded the file into a HEX editor and the data looks to be correct with no errors! on this high note, I will end this post. In part 3, I will try to extract meaningful data form the data set! wish me luck!