Hi, welcome to Arduino tutorial from Robojax. my name is Ahmad Shamshiri
I'm presenting this tutorial from Canada. this tutorial we are going to learn how
we can use two or more VL 53 l0x laser distance sensor with Arduino. we're
going to display the text the distance on the screen but you can use it for
other purpose for example 4 of of this can be used for a robotic arm or a car
that can measure the surrounding distance. let me now explain the code
may 5 on this pen these are also I square seats and it responds perfectly
and if I put it to the ceiling it shows out of range you can get the code for
this by clicking at the link below the video in the description which will take
you to www.robojax.com/learn/arduino let's get started
with this.
I've separate video explaining all these modules with datasheet and full code
explanation the link for my those videos or below this video in the
description. Using the Xshut pin you can turn on of the sensor about a year ago I
had another video explaining how to assign I2C address to this
module the link for that video is below this video in the description. but
here if you shut this down if you put this pin too LOW that device will be
shut down so if you're connecting multiple of this you can reset or shut
one of the device off and keep the other one on assign I2C address to it
then shut that off and then shut this turn this on by setting this to high and
a find separate I2C address to this one i sorry to this one this
way you can have different I2C address and you can have multiple of
these devices. Here is on the data sheet that shows the Xshut pin is a
digital pin it's active LOW. if you want to shut down the device you have to keep
it LOW or zero volt. and to turn it on keep it HIGH. I've seen a lot of requests in
offering a solution for this VL 53L 0 X to measure the distance because in many
robotics applications especially for smart car or some robotic arm that that
can go in multiple directions you want to know the distance in a surrounding
area we can use this such that for example if this was your a smart car can
use four of these one at the front at the back at the left and the right so
your robot is aware of the surrounding distances. this solution will work for all
of these modules as you can see this type and it is sold in this shape
or in this shape or a little larger or like this so the code will work with all
of this. I'm using Adafruit library so you can download it and use it easily if
you have not press the subscribe button please do so now so you can get a piece
of my upcoming videos
Wiring explained
if you need a wiring diagram for this it is available as part of my Arduino
course as you the middle comp if you want to learn Arduino I have a best
seller course on udemy where you can learn Arduino from ground up with
hundreds of projects all course material library codes wiring diagram everything
available in one place the link for my Arduino course is below this video in the
description. let me explain the wiring I've used this same color for the sensor
and for this wire because for these modules because for these modules we
need I2C pins even though I have here two extra I2C pins, then A4
and A4, this this pin, these are also I squared C I'm using a breadboard
because you might face this challenge to connect four five six or more for that
purpose I am using this breadboard so I'm using the same color here and here
the orange is connected five volts at this point
yellow is ground and then I'm using blue so this blue or green or flat meaning
green is the last one but here it is at the last second and blue which is last
second done here this isn't in the last portion because the module and the
sensor is arranged this way. over here on the module you need to use VN this will
be connected to 5 volts GND, ground will be connected to ground and then we
have SCL and SDA. SDA is A4 and SCL is A5 have arranged them in
this color and we will just connect it exactly the way they are. and then here
the last pin which we need in this module Xshut is her labeled of X we
will connect this wire at this point the last pin here the pink one. but if you're
using this one then we have X shut here the last one this is the XShut you must
connect it otherwise it will not work and also here is choose Xshut on this
module and if you're getting this black module here X is in here. I'm
connecting I'm connecting one module here as you can see oranges here I've
used the same wire I'm just inserting in same line four of those and then this is
the other one again orange inserting them here in the same order. the last one
for this one this will be connected to the 6 of Arduino this will the other
one will be connected to pin 7 I'm correcting the other one 7 and the
other one to pin 6 so the one that you are connecting to pin 7 is your sensor 1
the one that you are connected to pin 6 is your sense of - but you can play with
this and find out which one is which and if you have if you and if you have more
devices and if you have more sensors you can connect 5 4 3 up to 2 and also you
can go here mmm 8 9 10 up to 13 and even if you run out of that you can go also
to pin A0 to A3, four more pins here they can be used as a digital pin
as well.
Code explained
let me now explain the code this is a short explanation this is the
explanation of two sensor code for full detail and explanation on how to use it
for more than two it is available as part of my Arduino course at udemy calm
first you need to download the library I've used the other fluid library here
I'll provide you the link of the zip file click on this clone or download and
then select download zip or the link that I provide you then save it as a zip
file in your computer. after that go to sketch->include library and then add
dot zip library and then pointed to where you have saved it. for example my
computer it might be inside downloads and tutorial and this could be zip files
dot zip and select open. once you click open make sure to close
arduino ide and then reopen it. then click on File-> examples and then scroll
down until you see Adafruit VL53L0X and here are some examples under the
middle one it says it saves VL53L0X_DUAL click on that and open
it so this is a code. this LOX1_ADDRESS address we're defining address this is
I2C address for first sensor and that is for the second sensor where we
have a LOX2_ADDRESS. and then we are defining the XHUT pin LOX1
for the first sensor this is a digital pin 6 and 7. you will define it. and
here this measure1.RangeMilliMeter this will give you the range
and you can use it for any purpose you want and this is for the sensor number 2
Demonstration
and here is the demonstration. I'm just going to test it with one of this
because the wiring is exactly the same the same open label is the same as I get
this closers you can see that they show sensor one and sensor 2 these are the
distance and it responds perfectly and if I put it to the ceiling
it shows out of range
Subtitle typed and corrected by Ahmad Shamshiri on Jun 6, 2020
I did my part to help you learn.
you can subscribe to my channel and thumb up 👍 the video and say "thank you " in the comment secction.
The link to my PayPal account if you want to send cash donation is below this video.
I would like to thank my Patrons from Patreon.com
you
thank you for watching this world how to use two or more VL53L0X with
Arduino to measure distance. if you learn something and found this useful
please thumb up 👍 as this will help my video in the search algorithm of YouTube.
if you have comment or question posted at the comment section below I try to
answer and reply. if you want to get updates of my upcoming videos make sure
to subscribe. if you want to learn Arduino I have a best seller course on
udemy.com where you can learn Arduino from ground up with hundreds of projects
all course material library codes wiring diagram everything available in one
place. the link for my Arduino course is below this video in the description.
Extra clips
the solution that I'm offering will work for this type of module either this
module or a result like this black one or like this one so it will work for all
of them because the main sensor is the same