- Wed Jan 17, 2018 11:47 am
#197934
I am currently working on a project for a class that involves distance measurement between parked cars. Recently, I purchased a Lidar-Lite V3 sensor from Sparkfun to use for measuring this distance. I followed the hookup guide linked below for the sensor's setup. After setting up the sensor as depicted on the hookup guide (over I2C) and installing the Lidar-Lite V3 Arduino library, I ran tests to see if the distance measurements were accurate. The serial monitor, though, printed distance values about 10 cm off at lower ranges (0 cm - 50 cm) and varying differences in distance from the actual distance for 50+cm values. The product will likely never need to reach beyond 4m, so around the +/- 2.5 cm resolution at this range listed on Garmin's website is what I would like to achieve. I have attempted to work with HC-SR04 ultrasonic sensors and Sharp IR sensors, but both also had fairly similar problems with inaccurate measurement. Am I doing something wrong, or are all sensors in this price range this inaccurate? Are there modifications I could make to the code to create more accurate results? I am looking into calling Sparkfun support on the issue soon, too. I'm fairly new to sensors, Arduino, etc., so any help with getting accurate distance measurements would be appreciated
tl;dr: I'm having trouble getting the Lidar-Lite V3 to print accurate distance values below 5m. Am I doing something wrong, or are distance sensors at this price range always inaccurate by +/- 10cm?
https://learn.sparkfun.com/tutorials/li ... okup-guide
Here's the code I'm currently using with my sensor from the hookup guide
tl;dr: I'm having trouble getting the Lidar-Lite V3 to print accurate distance values below 5m. Am I doing something wrong, or are distance sensors at this price range always inaccurate by +/- 10cm?
https://learn.sparkfun.com/tutorials/li ... okup-guide
Here's the code I'm currently using with my sensor from the hookup guide
Code: Select all
/**
* LIDARLite I2C Example
* Author: Garmin
* Modified by: Shawn Hymel (SparkFun Electronics)
* Date: June 29, 2017
*
* Read distance from LIDAR-Lite v3 over I2C
*
* See the Operation Manual for wiring diagrams and more information:
* http://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf
*/
#include <Wire.h>
#include <LIDARLite.h>
// Globals
LIDARLite lidarLite;
int cal_cnt = 0;
void setup()
{
Serial.begin(9600); // Initialize serial connection to display distance readings
lidarLite.begin(0, true); // Set configuration to default and I2C to 400 kHz
lidarLite.configure(0); // Change this number to try out alternate configurations
}
void loop()
{
int dist;
// At the beginning of every 100 readings,
// take a measurement with receiver bias correction
if ( cal_cnt == 0 ) {
dist = lidarLite.distance(); // With bias correction
} else {
dist = lidarLite.distance(false); // Without bias correction
}
// Increment reading counter
cal_cnt++;
cal_cnt = cal_cnt % 100;
// Display distance
Serial.print(dist);
Serial.println(" cm");
delay(10);
}