ejshea
Published © GPL3+

LiDAR-Lite Module

Use a LiDAR-Lite module to measure distance with better accuracy, precision, and range.

BeginnerFull instructions provided14,945
LiDAR-Lite Module

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Adapter Plate

Schematics

Circuit Schematic

Code

LiDAR-Lite No Bias

Arduino
//Interface LiDAR-Lite module and display distance on LCD
//Without receiver bias corrections

#include <LiquidCrystal.h>
#include <Wire.h>
#include <LIDARLite.h>

//variable declarations
int distancecm;
int distancein;
const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7;

LiquidCrystal lcd(RS,EN,D4,D5,D6,D7);   //set Uno pins that are connected to LCD, 4-bit mode
LIDARLite lidarLite;

void setup() {
  lcd.begin(16,2);            //set 16 columns and 2 rows of 16x2 LCD
  lidarLite.begin(0, true);   //set config to default and I2C to 400kHz, starts I2C
  lidarLite.configure(0);     //there are 6 different configs available, 0 is default
}

void loop() {
  distancecm = lidarLite.distance(false);    //without bias correction, faster distance measurements performed
  distancein = distancecm*0.3937;           //1cm = 0.3937in
  
  //display distance to LCD
  lcd.clear();
  lcd.print("Distance: ");
  lcd.print(distancecm);
  lcd.print("cm");
  lcd.setCursor(10,1);
  lcd.print(distancein);
  lcd.print("in");
  delay(1000);
}

LiDAR-Lite Bias

Arduino
//Interface LiDAR-Lite module and display distance on LCD
//With receiver bias corrections

#include <LiquidCrystal.h>
#include <Wire.h>
#include <LIDARLite.h>

//variable declarations
int distancecm;
int distancein;
uint8_t i = 0;
const int RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7;

LiquidCrystal lcd(RS,EN,D4,D5,D6,D7);   //set Uno pins that are connected to LCD, 4-bit mode
LIDARLite lidarLite;

void setup() {
  lcd.begin(16,2);            //set 16 columns and 2 rows of 16x2 LCD
  lidarLite.begin(0, true);   //set config to default and I2C to 400kHz, starts I2C
  lidarLite.configure(0);     //there are 6 different configs available
}

void loop() {
  distancecm = lidarLite.distance();     //with bias correction
  distancein = distancecm*0.3937;        //1cm = 0.3937in
  
  //display distance to LCD
  lcd.clear();
  lcd.print("Distance: ");
  lcd.print(distancecm);
  lcd.print("cm");
  lcd.setCursor(10,1);
  lcd.print(distancein);
  lcd.print("in");
  delay(1000);

  for(i = 0; i < 100; i++){
    distancecm = lidarLite.distance(false);     //with bias correction
    distancein = distancecm*0.3937;             //1cm = 0.3937in
  
    //display distance to LCD
    lcd.clear();
    lcd.print("Distance: ");
    lcd.print(distancecm);
    lcd.print("cm");
    lcd.setCursor(10,1);
    lcd.print(distancein);
    lcd.print("in");
    delay(750);
  }
}

Credits

ejshea

ejshea

16 projects • 30 followers

Comments