Using an ESP8266. Which mode of operation (single read vs. continuous) uses the most processor resources?
Hello,
I expect there to be more overhead with single measurements since you have to write a few registers to start each measurement. With continuous mode, you start the sensor once and then mainly just poll the status register to check when new data is available to read out. (You might be able to eliminate the polling too if you use the sensor’s data ready signal to trigger an interrupt instead.)
If you’re using our library, you can compare what the readRangeSingleMillimeters()
and readRangeContinuousMillimeters()
functions in VL53L0X.cpp do in particular.
Can you provide some details on how I would use the data ready signal?
When you configure the sensor in interrupt mode, the GPIO1 pin will send an interrupt signal when a new measurement is available. You can find more information about the GPIO1 pin and the connections our board makes to it in the product page description and in the VL53L0X datasheet, which is available on the product page under the “Resources” tab, but one important detail to note is that GPIO1 is not level shifted.
As for using GPIO1, you will need to identify which pins on the ESP8266 can use interrupt signals. We do not have any example programs demonstrating how to use the VL53L0X in interrupt mode, and our library does not have direct support for it. However, the VL53L0X API user manual (UM2309, which you can also find under the “Resources” tab) has information about that, and it should be possible to augment our library to add that kind of functionality since it is based on the VL53L0X API. If you are new to using interrupts though, it might be a good idea to read through some more general documentation/tutorials about them first.
- Patrick
Thanks for your timely responses.