Its been a few months now since I received my new LIDAR lite from the crowd funded campaign on Dragon Innovation but only now I have some time to play with it. I got interested in range finder hardware after doing this great Udacity course on Artificial Intelligence for Robotics by Sebastian Thrun (the new one is here). One of the key hardware components is a good inexpensive range finder and Pulsedlight is doing it.
I want to try it out on my Beaglebone Black, the first challenge are the data pins voltage, the LIDAR is working at 5V and the Beaglebone at 3V3.
(EDIT) Well, figures out that I was wrong about LIDAR lite I2C levels, even thought it works with the logic levels converter, it is not necessary to use it, check my new post here.
I have hanging around a 4-channel I2C-safe Bi-directional Logic Level Converter – BSS138 from Adafruit. It is perfect for this. Here are some photos of the connections, I’ll publish the wiring in a few days when I have more time:
Connection to the Beaglebone via ssh.
The Beaglebone is running Arch Linux, to install the i2c tools:
# pacman -S i2c-tools
Check if the LIDAR is there:
# i2cdetect -r -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- 62 -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Looking good! LIDAR Light detected at address 0x62. Now, from its manual, we need to write 0x04 at its address 0x00 to make a measurement:
# i2cset -y 1 0x62 0x00 0x04
and wait for a couple of seconds to make sure the measuring is finished, then read the measured value:
# i2cget -y 1 0x62 0x8f w
0x7500
so I’m getting 117cm. It works! And the distance from it to my wall is around that value. Can’t find my meter so I can’t check its precision right now. I made a simple script to make it run for a while and save the measuring in a file, I’ll let you know my findings about repeatability later. Here is the script:
#!/bin/sh
date >> lidar.txt
while :
do
i2cset -y 1 0x62 0x00 0x04
sleep 2
i2cget -y 1 0x62 0x8f w
i2cget -y 1 0x62 0x8f w >> lidar.txt
done
I couldn’t use the i2cdump command. Each time I do:
# i2cdump -y 1 0x62
I get an answer the first time with some values but if I do the i2cdump again the result is all zeros, it looks like something gets stuck and the LIDAR no longer responds. The only way to make it work again is to power down / up the LIDAR. I’ll investigate this another day.