Raspberry Pi Pico & VL53L0X for MicroPython

Поділитися
Вставка
  • Опубліковано 31 лип 2024
  • Raspberry Pi Pico & VL53L0X for MicroPython - Want to get the VL53L0X Time of Flight sensor working with the Pico and MicroPython? Then this is the video for you.
    In this video I show you how to set the board up with I2C, the VL53L0X MicroPython library and some demo code. If you want the code - look in the repository below.
    GitHub Repository
    github.com/kevinmcaleer/vl53l0x
    For more information, tutorials, parts and more visit:
    www.smarsfan.com​
    Enjoy this video? Buy me a coffee!
    www.buymeacoffee.com/kevinmca...
    Chapters
    00:00 Raspberry Pi Pico & VL53L0X for MicroPython
    01:36 Session overview
    02:15 The VL53L0X can be used in the SMARS Mini
    03:09 VL53L0X Time of Flight Sensor
    03:24 VL53L0X - What is it?
    04:15 How the VL53L0X works
    06:23 VL53L0X Specifications
    08:16 Cost & Where to Buy a VL53L0X
    09:10 How to use the VL53L0X with MicroPython and the Raspberry Pi Pico
    12:35 Demo Time
    14:16 VL53L0X MicroPython Library
    21:53 VL53L0X test program in MicroPython
    27:05 Bench demo
    30:18 Small robot of the week
    Music by Epidemic Sounds
    www.epidemicsound.com/referra...
    PicoCat MicroPython Code on GitHub:
    www.github.com/kevinmcaleer/p...
    #Pico​ #MicroPython​ #Robotics
  • Розваги

КОМЕНТАРІ • 44

  • @kevinmcaleer28
    @kevinmcaleer28  3 роки тому +1

    Have you been trying to get the VL53L0X range finder working with the Raspberry Pi Pico and MicroPython? Then this is the video for you!

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому +1

      @@jyvben1520 I’ll fix the typo, but leave the other up too

  • @Orionrobots
    @Orionrobots 3 роки тому +2

    Thank you - this is exactly the information I've been looking for. You have a subscriber! The Raspberry Pi Pico is an awesome device for making robots. I've been getting various sensors and devices working with it, only just scratching the surface. PIO is amazing.

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому +1

      Awesome! I'm very interested in what you're creating - have you joined my small robots group on Facebook?

    • @Orionrobots
      @Orionrobots 3 роки тому +1

      @@kevinmcaleer28 Now that could be interesting. Are you part of the Piwars community? Lots of small robot builders (it's nothing like Robot Wars - more autonomous, less fighty). One thing worth noting- if your board breaks out the xshut pin, ensure it is pulled up - otherwise the system will timeout when calibrating.

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому +1

      @@Orionrobots I’ll have a look into that! Thanks for the pin tip as well

  • @frankvanderborg
    @frankvanderborg Рік тому

    Great work, thank you very much. I have got the library and the code (with some small microPython adaptations) running on an ESP32 PICO Kit. This must have been quite a challenge looking at the complexity of the sensor and the size of the libarary. But it works very fast and without misreadings, like the UltraSonic sensors often do.

  • @arihirschman6884
    @arihirschman6884 2 роки тому

    Thank you. Very informative and clear. Thank you for the code. I hope to use this to help my challenged dog use his dog door (He refuses to go through the plastic flaps, so I will open them for him). With two of these cheap sensors on each side I should be able to tell humans vs. dog apart and not open the door every time a human goes near.
    Again, many thanks.

  • @tinussonnekus3344
    @tinussonnekus3344 2 роки тому +1

    Thank you! Very helpful.

  • @stevenhillman6376
    @stevenhillman6376 Рік тому +2

    Superb. You got me out of a spot with this.👍

  • @rahulm4182
    @rahulm4182 4 місяці тому

    Thanks bro. Very helpful video 👍

  • @thiennguyenduc8500
    @thiennguyenduc8500 3 роки тому +1

    i did , thanks so much

  • @zyghom
    @zyghom 3 роки тому

    I just built the automatic LED on/off on my stairs - super nice and accurate - perfect for such application - PIR is too wide, and ultrasonic is too big ;-)

  • @JCVENDING
    @JCVENDING 2 роки тому +1

    Hi there.
    Thanks for making this video, it was very educational, despite my very, very basic English.
    I have downloaded and used your library but found that it cannot measure beyond 50 cm (500 mm).
    Could you tell me what modifications to make to the library to reach 2 meters? or at least 1 meter which is what I need to use.
    Thank you.

  • @theinthanaung22
    @theinthanaung22 2 роки тому +1

    I still have memory allocation error while importing library with esp 8266.

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      I've not tested this code on the ESP8266 - it is quite an old chip so might not have as much ram as the Pico

  • @eyadalkhalifa1911
    @eyadalkhalifa1911 2 роки тому

    I'm trying to write a c code for adafruit vl6180 with Pi Pico, but I am getting nowhere.
    Would you help me please?
    thanks

  • @mihneaseuleanu9251
    @mihneaseuleanu9251 3 роки тому +1

    Hi, this is a great video. I am using Thonny IDE and RPI Pico, but I don't know exactly how to make the code work. Could you tell me, what exactly to do after downloading the github archive? Thanks!

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому

      I've updated the README.md for this project to make it more obvious as to how to use the files - have a look and let me know how you get on github.com/kevinmcaleer/vl53l0x

  • @quentindemory
    @quentindemory 3 роки тому +2

    Hi, I have been trying the code, it has worked well sometimes but others, I just get this:
    setting up i2c
    [41]
    Traceback (most recent call last):
    File "", line 17, in
    File "vl53l0x.py", line 117, in __init__
    File "vl53l0x.py", line 200, in init
    File "vl53l0x.py", line 356, in _spad_info
    TimeoutError:
    Any ideas as to what I could do to get it working everytime?

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому

      It might need a slight delay in the init function or possibly the reset function, a couple of hundred milliseconds should do it

    • @Orionrobots
      @Orionrobots 3 роки тому

      Depending on the vlx board you have, you might need to pull up the XSHUT pin. It will behave badly if that pin is floating.

  • @dougblanding8791
    @dougblanding8791 Рік тому +1

    Thank you Kevin for preparing this tutorial. I have gotten it all working exactly as you have described. However, I do have a further question related to the maximum distance (range) the sensor is able to measure. The datasheet says the sensor has a default range up to 1.2 meters but using your code, I am only able to measure below 0.5 meters. (Looking closely at your video, I see your values also confirm this in your setup.) Can you suggest how we can get the sensor to measure values beyond 499 mm?

    • @kevinmcaleer28
      @kevinmcaleer28  Рік тому

      If I remember there is a value you can change to make it work at a longer distance but with less accuracy

  • @0ox3r0xo0
    @0ox3r0xo0 3 роки тому +1

    24:00 , lines 24,32,35, values 40000,12,8. what exactly this numbers does?, if 40000 is lower will get faster readings?.

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому +1

      This is to do with how long the burst of light is, and how long it takes to read it back in. By adjusting the setting you can read longer distances, but at less accuracy - this enables you to optimise for the distances you intend to use it for.

  • @sdelquin
    @sdelquin 2 роки тому +1

    Thanks for the video. Really interesting! Do you think it will work with a LCD1602 display? Do you anticipate any problem?

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      Should be fine

    • @sdelquin
      @sdelquin 2 роки тому

      @@kevinmcaleer28 I worry about refresh rate...

  • @ubuntuub8340
    @ubuntuub8340 2 роки тому +1

    Nice but if one beginner like me then he should have microscope to see the connection of the sensor.

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      Yes - those solder pads are pretty small, however you can use something like the Pimoroni VL53L1X breakout board combined with a breakout garden hat to make this much easier - shop.pimoroni.com/products/vl53l1x-breakout?variant=12628497236051

  • @danholsapple7327
    @danholsapple7327 2 роки тому +1

    Kevin- I recently discovered the joy of Micro controllers and how to connect different sensors. I am new to programming and have basic knowledge of electronics. I have a question about the VL53L0X and the MicroPython code to run it on the PICO. Seems that a distance past its intended use starts to give random numbers. How could you filter this out if you were going to use the sensor to start and stop motors in small robot car? The setup I have used starts and stops the car at random times.
    Love your channel by the way. Seems great for advanced users and Noobs like myself.
    Dan

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      Hey Dan - are the random numbers generally above a certain threshold? You could also take say 10 readings add them together then divide by 10 to get an average, this is a quick and dirty filter algorithm

    • @danholsapple7327
      @danholsapple7327 2 роки тому +1

      @@kevinmcaleer28 Seems like anything over 8140mm causes some strange readings. So from the top of my work desk to ceiling was just enough. When pointing across the room the numbers become small or negative. I tried to average in my code but it just averages small or negative numbers. This causes the motors to stop and do strange things to find a wall or object closer. Again Im so new and only using bits that I have found on line or easy code I can understand to write myself.
      Thanks for the quick reply.

    • @danholsapple7327
      @danholsapple7327 2 роки тому +1

      Sorry Kevin- after further testing it seems to act strange after about 450mm. I tried on two VLs and got same results. If i back off past this number it causes trouble and then goes to 8140mm until I step away to read the wall. This is where it really goes crazy.

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому +1

      @@danholsapple7327 I had a look on Google and there are quite a few things that it could be forum.arduino.cc/t/vl53l0x-gives-wrong-reading-when-no-object-in-range/582075/9 how long are the wires you are using - are they soldered or breadboarded, and can you post a photo of the build and the code

    • @danholsapple7327
      @danholsapple7327 2 роки тому +1

      @@kevinmcaleer28 One is on breadboard and one is on a test vehicle that I have cobbled together to test out new things I have learned over the last month. The wires on the bread board at 12cm. I would post a few pictures but not sure how on here.

  • @brianmoore5454
    @brianmoore5454 3 роки тому +1

    Are you still working on the SMARS Mini??

  • @So-Now
    @So-Now Рік тому

    uF = Micro Farads, uS = Micro Seconds, uM = Erm........