Hi, welcome to Arduino tutorial from Robojax. in this video we are going to
see how we can use this VL53L0X the pink module with 6 pins to measure the
distance like this. you can get the code for this project by clicking on the link
at the description which will take you to www.robojax.com/learn/arduino
o let's get started with this this. is the module usually it's
shipped with this 6 pin headers that you need to solder and the module is
very tiny they have VCC we have ground that
clock (SCL) and then that data (SDA) output and this is IO and then XSHUT
sorry X-SHUT. so there's a protective sticker here when you use it you remove it so it
can measure accurately. the width of this module is 12 millimeter I learned from
these points yes 15 point 3 millimeter
and the total length is twenty three point seven millimeter she went through
the weight it's around one gram 0.7 ground with a ten header one gram oh I
have further depends such that the world should be on this side and the sensor is
here. so the sensor has actually transmitter and receiver both this has
the laser will go will hit an object and reflect back the wavelength for this
laser is 940 nanometer and will head from one of this we can see there were
two small dots one is large one is small so from this one from this one will emit
the laser object that will come back and the other one it will receive and do
that calculation for us. this sensor convert with a 2.6 V to 3.5V.
independently but when it's used in this module we have a voltage regulator here
that can work with 5 volts so you can connect it to 5 volts and it will
internally regulate and so you don't have to worry about that. now let's have
a look at the data sheet so VL 53 and 0 x time of flight that this is really
smallest. the wavelength of the laser is 940 nanometer and then this the
size is 4 point 4 by 2 points 4 by 1 millimeter this margin that's a size for
this one. and it can measure up to 200cm that's very important to keep in mind
other than that is the operating voltage 2.6 to say 3.5 V. and the
operating temperature is from minus 20 to 70 degrees Celsius keep that also in
mind. an i2c communication or I squared C communication frequency is 400 kilo
Hertz that's very fast so this is the block diagram and these are the pin out
of the device and here is the explanation.
I've connecting it. XShUT can be active low. and here is the suggestion
must always be driven to avoid leakage so it means this
pin should not be left unconnected. so you must connect it. So pullup is
needed so that's why I put pull-up resistor and this can be left
unconnected GPIO one they suggest 10 kilo ohm but internally this also for
Arduino is also good. the rest is not of our concern because these are for people
who are designing actual device with this.
Wiring explained
the wiring the VCC and grounds are connected these two are connected to 5
volts and the ground in here and then we have SD and and SCL and SDA. SCL
clock is SDA is data.I'm using an Arduino that has SDA and SCL is
to pin if you are ordering doesn't have this SEL SDA is connected to A4 and
and SCL is connected to A5. just connected and then this GPIO will be not
used so just leave it like that. then then XSHUT, is connected
to pin 12 here.
Code explained
the pin configuration of an explained the wire is for I squared C or I2C
communication this is internal Arduino header files you don't need to
do anything about it. this is from I have provided this Adafruit library you just
download this the link will be provided in within the code that I provide on our
website robojax.com you must have this after including everything
then we you can run this. this line gets that header file name that you see here
that is a main object and we are creating object called sensors I can put
robojax whatever you wish so. this case is just a sensor and then
this 12 input pull up is needed for pen 12 that xshot is connected and then we
set it to high the pen 12 and there will 9600 baud for this serial monitor this
must match otherwise you cannot read the text. and then wire.begin()
this is initializing the I squared C or i2c communication. and then
here we are initializing sensor.ini this as a function inside this object we
have created here. and then we say the timeout for 500 millisecond there is
milliseconds if it does not see or does not find measurement and 500 millisecond
it will have timeout you will see it that will display time . So if your
application has in a situation that some time to time there will be out of range
or there is no measurement increase this so it can not timeout quickly because
when it's timeout you have to restart again or you have to send a command to
restarted by sending that pin to LOW. and then we set the mood continuous so this
goes continuously under research sensor read read range continuous millimeter
this will return it in the value in millimeter and then the value
will be stored here. now we have that an integer type and here we go to the
repenteth text we print that distance we have. and then I then we print
millimeter and then here we set if timeout occurs then we say timeout
so that timeout that we set here. and then the loop continues like that
without any wait. so if you want to delay it you can also put a delay here 100
millisecond or 200 millisecond something like that. now as you can see the scroll
is a little slower getting closer.
Distance measurement demonstration
we'll demonstrate now this has a measurement here and had the surface of
this is the reference point so I'm putting it close to the zero and then
let me put this at 100 millimeters as you can see 302 209 fluctuates so one
way to fix this would be if you need very exact values to get the average let
say 10 or 20 measurement and then get the average or maybe 50 measurement and
get the average let me go to the 5 this is 50 millimeter so 52 to 55 that's very
close maybe 3 millimeters deviation from the value. now I'm going to 19 cm
195. thank you for watching. this was introduction on how to use this VL53L0X
with 6 pin on this module as you can see this is offered in different
variety of types but this number of pin is important and this shape because
people are offering it in different ways. I'm gonna create more videos related to
us to display them seven segment display and also video to display the LCD and
LED so make sure to subscribe so you can get updates of those
Subtitle typed on August 22, 2020
I did my part to help you learn. Now it is your turn.
You can subscribe to my channel, thumb up 👍 the video and type a comment by saying thank you.
If you don't skip ads it will also help you .
My PayPal Account link is in the description if you want to make cash donation. Thank you