LiDAR with Arduino - TF-Luna Sensor

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to another diy engineers video in this video i'll be going over lighter and how to use it with arduino we'll be basing the video on the use of the been awake tf luna lighter sensor in the video we'll be going over the basics of the sensor a few basics on lighter how to connect to an arduino uno as well as how to connect to a node mcu of course we'll be going over how to program with arduino including details on which library to use and how to download it finally we'll be running a test using our lighter sensor and we'll show you the test we're doing and show you the results at the same time so you can make sense of it so let's go ahead and get started so this is the lighter sensor already connected to the arduino we can see here's where the light or laser is emitted from here we have the circuit board that comes with it it's all embedded one part here's where we connect the cables and here we have two holes that can be used to attach to some other component that you might have like a 3d printed part to to hold your laser so it's pretty lightweight so i like it a lot so here's the lighter sensor i just showed you now you might be wondering what does lighter even stand for lighter is light detection and ranging and is used to measure distance it uses the time-of-flight constant which basically uses the time it takes for a light signal to travel to then determine the distance to an object based on the fact that we already know the speed of light the light signal will be emitted from the sensor and will return by traveling twice the distance between the sensor and the object so it goes from the sensor to the object and then back to the sensor and then since we know the speed of light which is 3 times 10 to the 8 meters per second we can use these two to calculate the distance to the object here we have six pins that come from the bottom of the sensor pin number one which goes the number one is the left and six the one on the right so it goes from left to right number one is your five volt power supply you can actually range from a range of voltages but 5 volts is the pretty standard you can actually put anything between 3.7 and 5.2 pin number two will be your rxd sda basically you're receiving a data pin then you have txd and scl for your clock or transmitting number four will be ground and number five will be a configuration input basically if you ground it you will be running your sensor in i2c mode if you have it disconnected or 3.3 volts it will be in serial mode in this example that i'm going to show you next i'll be using it on i2c mode then we have pin number six which is a multiplexing input sorry output and it's either on on off mode for output or i2c mode this pin i'll have it unplugged on the example i'll be showing you so now a little bit more about the sensor it can measure anywhere between 0.2 meters to 8 meters or 7.8 inches all the way to 26 feet and has a resolution of one centimeter or 0.4 inches the sensor accuracy is 6 centimeters when measuring less than 3 meters or less than 9.8 feet and 2 when measuring between 3 and 8 meters so between 9.8 feet and 26 feet meaning that when measuring 8 meters the accuracy will be 16 centimeters or 6.3 inches so now this is what i was mentioning earlier let's say i'm using a lighter sensor in a car to measure the distance to the car in front of me i know that the distance traveled by the light which is from the sensor to the object and then back is 2 times d d being the distance i want to measure and t being the time it takes to travel distance divided by 10 will be your speed in this case the speed of light time being the time it took for that specific interval that i'm measuring so if we already arrange this we get that d equals c t divided by two so this is essentially in concept just for so you can better understanding is the equation that defines the distance measured by our sensor so now based on the pins that i showed you earlier this is how we configure uh our connections between the tf luna sensor that we've been going over and arduino so again we ground pins four and five we put five volts on the first one and then the other two since again i'm grounding the one for the mode and then putting an i2c mode i'm gonna connect your pins two and three to the relevant i2c pins on your arduino uno and then the same applies if you want to use the node mcu just different pins for your i2c mode now we're going to go ahead and test the code for this example using the tf luna lighter sensor so to do that go ahead and go to diy engineers.com specifically follow the link in the description to this video and you will find sections as arduino code copy this code and paste it in your arduino ide note that to do that you will have to have the right libraries you should have already the wire in the arduino but make sure to also go ahead and download the tf luna i2c library as i'm going to show you next now the first step once we get to the arduino ide is to go to sketch and let's go to include library and manage library once that everything loads up you want to type tfl i2c and install the one shown here i cannot install it since i already have it installed but this is the one you need let's go ahead and click install now in this code we basically include our required libraries initialize tf loan i2c we initialize the variables for the distance that we're going to be using and also the default i2c address we initialize the serial port that we'll be using and we begin wire under the setup and then we go into the main loop where we basically start taking our measurements and if we get data we want to print it into the serial monitor so that's what this if statement is about and then we'll have a minute delay and it will then keep iterating so go ahead and click the upload button once you have set up the proper communications port for your arduino device and click run and then you'll start getting readings on your serial monitor so now let's go ahead and do that so here we're testing at five feet from the object being measured as you can see on the roughly 60.2 inches so next we'll test at four feet from the object being measured or equivalent to 48 inches we're getting somewhere around 48 inches 47.6 we had a 48.4 or so before so and now we'll do two feet right now we're getting 24.2 now we're getting 23.2 that's equivalent to roughly 60 or 59 centimeters this concludes this video i hope you enjoyed it if you did please give us a thumbs up and consider subscribing thank you very much for watching and see you in the next one bye
Info
Channel: DIY Engineers
Views: 18,415
Rating: undefined out of 5
Keywords: LiDAR, lidar sensor, lidar scanner, lidar technology, lidar technnology, LiDAR Arduino, LiDAR with Arduino, LiDAR programming, TF-Luna, Benewake TF-Luna, Benewake, LiDAR testing, Lidar Arduino Programming, DIY LiDAR, LiDAR connection to Arduino, Intro to LiDAR, LiDAR explained, LiDAR NodeMCU, LiDAR I2C, TF-Luna I2C, LiDAR Arduino I2C, LiDAR Accuracy, LiDAR Range, LiDAR Connection to Arduino, TF-Luna Pins
Id: QMW1H0owzdY
Channel Id: undefined
Length: 8min 7sec (487 seconds)
Published: Thu Jun 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.