myrahm
Posts: 1
Joined: Sun Jun 18, 2017 5:02 pm

Re: Lidar Lite V3 - Raspberry Pi - Python

Sun Jun 18, 2017 5:04 pm

Here is the confirmed fix to get Lidar v3 working with raspberry pi 3

1) Rollback kernel to 4.4.38 via instructions here: https://isahatipoglu.com/2015/09/29/how ... berry-pi2/
2) Use the following python code to confirm valid readings

Code: Select all

import smbus
import time
bus=smbus.SMBus(1)
addr=0x62

while True:
    bus.write_byte_data(0x62,0x00, 0x04)   
    val_high=bus.read_byte_data(0x62,0x0f)   
    val_low=bus.read_byte_data(0x62,0x10)   
    dist_cm=val_high*256+val_low
    print `dist_cm` + " cm   "
    time.sleep(1)

wkf94025
Posts: 2
Joined: Thu Nov 30, 2017 12:42 am

Re: Lidar Lite V3 - Raspberry Pi - Python

Thu Nov 30, 2017 12:55 am

I am trying to bring up a LidarLite V3 on a new Pi Zero W. I've read everyone's fixes, theories, etc., posted above. I am a bit new to the Pi environment, and am brushing ~20 years of rust of my unix/Linux skills. I have the LLv3 wired to 5v, GND, (1000uF 16V cap between 5V and GND), and SCL and SDA connected to the appropriate pins on the 40pin GPIO on the Pi Zero W. The i2c detect function works, showing a device at address 62. No other devices on I2C. total wire length from LLv3 to GPIO is about 12", with cap soldered in about halfway along 5V/GND. If wire length is in fact problematic, that could be my problem. I can detect the LLv3, but I only get zero's from the test program by Sanderi44 on GitHub. I tried switching clock and data, just to make sure I didn't have them wrong, but when I switch them I2C detection fails. I don't yet know how to check kernel version, and downgrade, per guidance by one of you here. I am also wondering if the 40pin GPIO 5V has enough punch to drive the LLv3 effectively. Just for grins, I pulled the 5V line, and when I plug it back in, it reboots the Pi Zero W. My guess is that LLv3 plus big cap draw voltage too low for Pi's liking.

Any further insights on kernel downgrade, wire length or other I2C bus corruption issues?

Also, FWIW, other I2C devices (temp + pressure), IMU, work on I2C, and give non-zero data back.

Thanks in advance for any guidance.

Kelly

User avatar
Hove
Posts: 1183
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Lidar Lite V3 - Raspberry Pi - Python

Thu Nov 30, 2017 9:37 am

I'm still using the setting previously listed in the post as I don't think Garmin has made any attempt to fix their I2C bug which the RPi exposed when its own I2C was upgraded back in March. This is what works for me:

Jessie Lite kernel 4.4.50-v7+ from end February 2017 (I think that's named 2017-03-02-raspbian-jessie-lite.img)
Wiring < 10cm
No 680uF capacitor

Sorry I can't help more.
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

wkf94025
Posts: 2
Joined: Thu Nov 30, 2017 12:42 am

Re: Lidar Lite V3 - Raspberry Pi - Python

Sat Dec 02, 2017 1:43 pm

One does not need to roll back to an early 2017 or 2016 kernel to solve the problem. Check out the discussion of this problem on github. https://github.com/raspberrypi/firmware/issues/828

One simply needs to modify the I2C settings that the OS uses. My LidarLite is now functioning properly. No changes to my wire length or capacitor location were required. i2cdump returns reasonable values consistently, which was not the case before applying the above fix.

The kernel rollback doesn't work for Pi Zero W, or at least it didn't for me. The Pi Zero W booted, but no WiFi or Bluetooth.

Kelly

Return to “Beginners”

Who is online

Users browsing this forum: fluffysheap and 59 guests