Giter Club home page Giter Club logo

vl53l1's Introduction

VL53L1

Arduino library to support the VL53L1 Time-of-Flight ranging sensor with advanced multi-zone and multi-object detection.

API

This sensor uses I2C to communicate. And I2C instance is required to access to the sensor. The APIs provide simple distance measure and multi-object detection in both polling and interrupt modes.

Examples

There are 2 examples with the VL53L1 library.

In order to use these examples you need to connect the VL53L1 satellite sensor directly to the Nucleo board with wires as explained below:

  • pin 1 (Interrupt) of the VL53L1 satellite connected to pin A2 of the Nucleo board
  • pin 2 (SCL_I) of the VL53L1 satellite connected to pin D15 (SCL) of the Nucleo board with a Pull-Up resistor of 4.7 KOhm
  • pin 3 (XSDN_I) of the VL53L1 satellite connected to pin A1 of the Nucleo board
  • pin 4 (SDA_I) of the VL53L1 satellite connected to pin D14 (SDA) of the Nucleo board with a Pull-Up resistor of 4.7 KOhm
  • pin 5 (VDD) of the VL53L1 satellite connected to 3V3 pin of the Nucleo board
  • pin 6 (GND) of the VL53L1 satellite connected to GND of the Nucleo board
  • pins 7, 8, 9 and 10 are not connected.
  • VL53L1_Sat_HelloWorld: This example code is to show how to get multi-object detection and proximity values of the VL53L1 satellite sensor in polling mode.

  • VL53L1_Sat_HelloWorld_Interrupt: This example code is to show how to get multi-object detection and proximity values of the VL53L1 satellite sensor in interrupt mode.

Note

The maximum detection distance is influenced by the color of the target and the indoor or outdoor situation due to absence or presence of external infrared. The detection range can be comprise between ~40cm and ~400cm. The library should work also with standard Arduino boards. In this case you just need to adjust the code in the sketch in order to use the correct Wire instance and the correct pin number for XSHUT and GPIO1 pins.

Documentation

You can find the source files at
https://github.com/stm32duino/VL53L1

The VL53L1 datasheet is available at
https://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl53l1.html

vl53l1's People

Contributors

cparata avatar dhebbeker avatar fpistm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vl53l1's Issues

VL53L1_Sat_HelloWorld.ino needs additional clear interrupt with ESP8266?

Using the current version (bdd6387) of the VL53L1_Sat_HelloWorld.ino example I do not get any data from the sensor unless I add an additional clear interrupt.

The program execution is stuck in this loop:

do
{
  status = sensor_vl53l1_sat.VL53L1_GetMeasurementDataReady(&NewDataReady);
} while (!NewDataReady);

status is always 0 and !NewDataReady == true.

But if instead I modify the end of the setup procedure as follows:

-   sensor_vl53l1_sat.VL53L1_StartMeasurement();
+   sensor_vl53l1_sat.VL53L1_ClearInterruptAndStartMeasurement();

Then everything works as expected: I get correct data.

But according to the user manual UM2133 rev 6 fig. 6 the original procedure in the code is correct:

  • StartMeasurement in the setup phase
  • ClearInterruptAndStartMeasurement at the end of the loop

So I wonder, where is the error?

I have this issue only with an ESP8266 (NodeMCU board). I also tested it with a Nucleo Board:

start code at this line Nucleo F401RE NodeMCU
VL53L1_StartMeasurement() works as expected ✔️ no data ❌
VL53L1_ClearInterruptAndStartMeasurement() works as expected ✔️ works as expected ✔️

In order to use it with the NodeMCU I obviously had to use a different pin for XSDN_I.

I know that the VL53L1_Sat_HelloWorld.ino is designed for a Nucleo Board. But due to the abstraction by the Arduino Library I would have expected to work for both boards.

[question] How to reduce memory usage when controlling multiple devices?

I am using this library to control 4 VL53L1 devices. For this I defined 4 objects of the class VL53L1. Unfortunately each object uses 9kB dynamic memory. This meets my expectations from the information given in the user manual UM2133 (8kB).

I am compiling with xtensa-lx106-elf-g++ (GCC) 4.8.2 and -Os.
I defined VL53L1_MAX_RANGE_RESULTS to 1.

These 4 objects use nearly half of the RAM available on the ESP8266 I use.

Do you have any recommendations on how to safe some memory? I only need simple range measurement data from each device.
Is it a good idea to use only one object and switch between the devices? What are the drawbacks?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.