DIY Arduino LIDAR

Help me by sharing this post


PREVIOUS PART       NEXT TUTORIAL



PART 4 - Arduino Code

Ok, the code is not that difficult. Downlaod it from below. You will also need the library for the VL53L0X sensor. So downlaod that from the link below as well adn install it to the Arduino. In the cose we make steps, make a measurement and print the angle adn distance to the serial communication and then we make more steps and so on till we get to 360 degrees. Then we use processing to read and plot the distance.




#include <Wire.h>       
#include <VL53L0X.h>        //Downlaod it here: https://www.electronoobs.com/eng_arduino_Adafruit_VL53L0X.php

VL53L0X sensor;             //Define our sensor
//If you uncomment any of lines below you activate that mode
#define LONG_RANGE
#define HIGH_SPEED
//#define HIGH_ACCURACY

//Outputs/inputs
#define dirPin 3      //Pin for direction of the stepper driver
#define stepPin 4     //Pin for steps of the stepper driver
#define Enable 5      //Pin for enable the stepper driver








PART 5 - Processing Code

Go to the official page here and download Processing. Then copy the code from below and paste it in processing. Connect the Arduino to the PC and see which COM you are using. Make sure you uplaod the Arduino code from above. Then run the processing code. The LIDAR will start rotating and ploting the distance to the screen.




  // List all the available serial ports
  printArray(Serial.list());
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[0], 9600);
  
  size(820, 820);
  noSmooth();
  background(0);
  translate(410, 410);
  stroke(255);
  strokeWeight(3);  // Default





PART 5 - All done

I hope you like this project....



Help me by sharing this post












yt_link
insta_link
fb_link
twitter_link

LIDAR DIY
page 2/2



PCBWAY PCB service

PCBWAY PCB service

PCBWAY PCB service