I had planned that my next article would be part two of the series on line following (part one is here), however a new sensor from a company call PULSEDLIGHT (http://pulsedlight3d.com/) caught my attention. Basically this sensor (the LIDAR-Lite) provides a relatively low cost laser based range finder that provides centimetre resolution with a maximum distance of up to 40m and a sample rate of around 50Hz. The sensor uses an i2c interface and is relatively compact. It seemed to me that if I could make it talk to the EV3 and arrange some sort of rotating mechanism then it could be used as the basis of a low cost LIDAR sensor.
The actual sensor is shown above. I will post more details of the device in a follow up article. To get things working I’ve had to rework the leJOS low level i2c code and I built 3 versions of a rotating scanner before coming up with one I was happy with. But for now here is a video clip of some initial testing, this thing is very cool!
Nice job. That’s pretty impressive. I’m thinking of trying to get one working with ev3dev. Do you have details you can post of how you physically conected it to the ev3 sensor port?
The sensor is an i2c device. The tricky part is that it has built in 10K pull up resistors. This causes problems with the EV3 as the data line has a protection resistor in series with the pin. This in effect forms a potential divider with the pull up resistor when the EV3 tries to pull the data line down to zero volts and means that the sensor does not see a zero volt level. I worked around this by adding an extra pull down resistor of around 8K (I think), which enabled the logic zero to be detected but still allowed logic one to work. Ypu may need to experiment a bit to find a value that works for you. To get the device to work at high speed I reworked the leJOS i2c driver. I may write a further article about that at some point, but the weather is too good at the moment. I’m busy riding my bike rather than writing articles! If you want to discus this further please post on the leJOS forum as I think that is a better place for a discussion than here.
I would love to see more on this, the circuit and code? Are you ok to share this in the future?
I may write more on this in the future, but for now the hardware issues are very similar to those discussed here:
http://www.lejos.org/forum/viewtopic.php?f=20&t=8107
As to the software it is pretty much as you would expect from the data sheet, just a case of reading values from it. If you have further questions please post on the forum. It is much easier to answer stuff over there.
Hy, I try to measure a distance with my Lidar lite v3. I was already able to measure distances with the lidar connected to an arduino. However I need to connect my lidar to my EV3 robot operating with lejos 0.9.1. But I canno figure out how to measure distances using I2C between my Lidar and EV3. Could anyone help me with some example code please?
Thanks
I think you will struggle to get this working. To begin with you will need to use the updated i2c code that only exists in the master/ developers snapshot of leJOS, this code is not in the 0.9.1 release. But more importantly both V2 and V2 have revised i2c hardware (it is faster) and as far as I am aware no one has been able to make this work with the EV3. I only have the original version of the sensor and so can not really help. If you are familiar with i2c and hardware and have access to a scope you may be able to get things working by playing around with the pull down resistor. The following article https://lejosnews.wordpress.com/2016/01/15/i2c-on-the-ev3/ provides some details of the techniques used, but as I say I know that others have tried to get this updated code working with a v2 sensor and have failed. Your best bet may be to build an adapter that uses a arduino or similar and sits between the EV3 and the sensor. If you have further questions please post them on the leJOS forum.
Oke thanks. I’m not very familiar with i2c and hardware, but I know just enough in order to be able to use i2c with the arduino. However, shouldn’t it be possible to use basic I2C code? (so what I mean is using another way of sending the bytes to the EV3). Do you maybe know another way (propably more difficult) for me to sent those bytes to the Lidar lite v3?
Thanks
As I have already said this is a hardware issue with the EV3 and many i2c devices (especially faster ones that use a lower pull up resistor), if I knew a way to fix it I would have told you. I have already suggested that you could use a Arduino or some other device to act as an adapter between the two. As I also said if you want to discus this further please post on the leJOS forum. This is not a good place to have a discussion.