Arduino LIDAR - Arduino Project Hub
Arduino LIDAR - Arduino Project Hub
One way to measure the time of flight for the light beam is to use a pulsed laser
and then measure the elapsed time directly. Electronics capable of resolving
picoseconds are required in such devices and they are therefore very expensive.
Another method is to measure the phase shift of the reflected light.
The sensor measures the phase shift between the transmitted and reflected
signals. The picture shows how this technique can be used to measure distance.
The wavelength of the modulating signal obeys the equation:
c = f ∙ τ
where c is the speed of light and f the modulating frequency and τ the known
modulating wavelength.
where A is the measured distance. B is the distance from the phase measurement
unit. The required distance D, between the beam splitter and the target, is
therefore given by
D = τ * θ / 4π
It can be shown that the range is inversely proportional to the square of the
received signal amplitude, directly affecting the sensor’s accuracy.
This time of flight sensor is actually used in our mobile phone to adjust the focus
of the camera.
Circuit Diagram
Arduino code
#include <Wire.h>
#include "Adafruit_VL6180X.h"
#include <Servo.h>
Adafruit_VL6180X vl = Adafruit_VL6180X();
Servo myservo;
float pos = 0;
const float Pi = 3.14159;
void setup() {
myservo.attach(9);
Serial.begin(115200);
while (!Serial) {
delay(1);
}
if (! vl.begin()) {
while (1);
}
}
void loop() {
for (pos = 0; pos <= 180; pos += .5) {
myservo.write(pos);
uint8_t range = vl.readRange();
Serial.println(String(range)+"p"+String(pos*Pi/180)+"p"+String(pos));
delay(10);
}
/*for (pos = 180; pos >= 0; pos -= .5) {
myservo.write(pos);
uint8_t range = vl.readRange();
{
Serial.println(String(range)+"p"+String(pos*Pi/180)+"p"+String(pos));
delay(10);
}
}*/
myservo.write(0);
delay(2000);
}
Processing code (refer other radar project if u need good radar interface)
change the Arduino port number (eg "COM 3") before running.
import processing.serial.*;
Serial myPort;
String val;
int range,i=0;float pos;
void setup(){
size(550,500);
The speed of sensor is limited to 10Hz and the response of servo is poor at higher
speed. If any one planning to make high speed LIDAR use stepper motor or DC
motors with feedback system. use slip rings for continuous rotation
(https://www.adafruit.com/product/736).