Arduino LiDAR Quick Start Guide with the TF-Luna

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody i hope you're having a fantastic day if you've ever had one of those arduino starter kits you have absolutely run across the hcsr04 ultrasonic sensor the first time i saw one of these it was kind of a revelation to me you sit there and shoot out some ultrasonic sound and you come back and receive it calculate the time and you get an idea of the distance of something in front of the sensor and that was so cool and i thought of all kinds of applications for it but the reality was every time i tried to put one of these things in a real project i got enough crazy readings or enough inaccuracy that it made it not really that useful to me so i was in the market for something better for a project that i can't really talk about but i came across this it is the tf luna and i bought it on amazon and it is a lidar which is basically a laser uh rangefinder sensor and so this was about 25 bucks on amazon which is not cheap but what it does is pretty awesome so it shoots out lasers and uh does uh rangefinding that way and it's extremely accurate and it has some advantages over this type of sensor it deals with 3d objects a lot better it deals with misshapen objects it deals with softer objects because it doesn't get absorbed the way that the sound waves do from here and it's just overall a really accurate sensor now the thing that i found though is that compared to something like this information about this is pretty dang spotty now the first thing you need to know about these kinds of sensors is that there's a lot of different versions of them and so they're broken down into a couple different things the first thing is the distance that they're made to measure now there's generally long range medium range short range and this is a short range one which means it's basically able to measure up to eight meters um and so that's a reasonable 24 25 foot range uh but that's what this one does then you can buy ones that can go you know up to 100 meters and even up to 200 meters and those are more expensive and that's just not what i needed here now the other thing you need to watch out for is how they communicate and so the various versions of this sensor communicate over different protocols now this one can do uart which is serial you're used to doing your serial monitor on your arduino or it can do i squared c uh there are other ones that use the can bus and all kinds of other buses and things like that so if you order one of these you definitely need to pay attention to which version you got so this one uses the serial bus now because of that i've decided to use a mega now i could use an uno and do what they call software serial but the mega actually has four built-in serial ports on the mega itself so you'll see that i've got this thing hooked up with just four wires so it's the same number of wires that you use to hook this up it looks a little messier because i'm using some jumpers here but you're hooking up four wires you've got to send a receive a power and a ground so although it looks complicated and it sounds complicated it's really not much more complicated than one of these things so i've got it hooked up and the way that it works is that i'm communicating serial to my arduino over pins 17 and 18 which on the mega is known as serial 2. and so i'm going to show you a little bit of the code and give you a little bit of an idea how it works and then i'll come back here and play with it now the magic that makes this thing work is this tf mini plus library by a guy named bud and fortunately this library is available in the arduino ide the best way to find this library is to actually search directly for tfm plus and this is the one that works with the tf mini s and the tf luna which is the one that we have and it does not work with the tf mini so i've got it installed i'm using version 1.5 now the first thing you'll notice is that when you go to the examples there is no example in here for this library but it is actually there so if you go into your arduino folder which is in my documents on my windows 10 pc and you go into arduino and libraries and then you come down here to the tf what is it called the tfm plus you will see that there is an example in there and there's a couple of important things here the first thing is that there is a file in here called printf.h now you're going to need that so i'm going to double click this example and i'm going to load it up in the arduino ide and i'm going to do a save as and we're going to stick it somewhere else so we're just going to call it uh let's call it another maker so now that i've saved it i want to go back to my arduino folder under my documents and double click the thing i just saved and i want to copy that printf file into that folder because it's going to need that in order to upload the sketch now at this point you can actually upload the sketch as is if you have an arduino mega you hook the the pins up to 17 and 18 and power and ground and you can just upload it and you will see that it will work just right off the bat so i've uploaded it and i'm going to open up my serial monitor and set it to 115.2 i'll reset it so you guys can see it from the beginning it gives you the example thing and a little bit of firmware information and then all of a sudden we're getting uh 201 centimeters this flux is sort of the accuracy how um how well it thinks that it has received a signal and then this is the temperature of the chip itself and you see as i bring my hand closer all of a sudden we're down to one two centimeters and it goes up accordingly so that is it to get the thing working there's a couple little tricks but overall it's pretty easy to get up and running with the lidar so that is the basic setup of how to use the lidar sensor on the arduino of course i'll also give in the description my uh code for using the screen on there and getting a nice little display i'll have the links in the description and overall though i am very happy with how well this thing works how it works with soft objects how it works with people how it works at long distance um i expected it to be a lot more difficult to set up but once i worked through those few hurdles i showed you in the earlier section it wasn't hard at all and it does exactly what i needed to do so again got it from amazon cost about 25 bucks which is not cheap compared to the sr04 but when you need accuracy and when you need longer distance and you need it to just work this tf luna seems like a pretty good way to go so hey thanks for watching have a great day
Info
Channel: AnotherMaker
Views: 46,289
Rating: undefined out of 5
Keywords: lidar, tf-luna, tf-mini, benewake, arduino rangefinder, arduino range finder, arduino lidar, arduino laser, arduino laser range finder, arduino laser rangefinder
Id: 5AFgg6C7hxg
Channel Id: undefined
Length: 6min 45sec (405 seconds)
Published: Sat Oct 23 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.