dm00280486

AN4846
Application note
Using multiple VL53L0X in a single design
Introduction
The purpose of this document is to give an example of how multiple VL53L0X devices can
be placed on a board design while only using a single I2C interface to interact with the
devices.
Figure 1. VL53L0X device
May 2016
DocID029133 Rev 1
1/7
www.st.com
7
Contents
AN4846
Contents
1
Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2
Multiple VL53L0X application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3
2/7
2.1
VL53L0X control management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2
VL53L0X API management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
DocID029133 Rev 1
AN4846
1
Purpose
Purpose
The purpose of this document is to give an example of how multiple VL53L0X devices can
be used on a board design while only using a single I2C interface. The VL53L0X is a
ranging sensor that uses time of flight principle to measure distance to an object. The
control and output interface is an I2C interface. Each VL53L0X device has both a XSHUT
pin and an interrupt (GPIO1) pin, which will be used in this design setup for using multiple
devices.
The uses for multiple VL53L0X on a single design can include the following:
2
1.
Distance sensing in multiple directions
2.
Robotics with multiple sensors
3.
Gesture Detection
4.
and much more!
Multiple VL53L0X application
This chapter shows how multiple VL53L0X devices can be used on a board design while
only using a single I2C interface to interact with all the devices.
Each VL53L0X device has both a reset pin and an interrupt pin, which can be used to
enable a multiple device setup.
2.1
VL53L0X control management
1.
Figure 2 is a typical example schematic using a VL53L0X device. Since the VL53L0X
can have the I2C device address changed by doing an I2C write once it is booted, a
unique reset pin would be needed for each VL53L0X used in a design. Each device is
then taken out of reset one at a time, and then the I2C Device Address is changed to a
new unique address. This can be done by using multiple GPIO pins from the
microprocessor on the board.
DocID029133 Rev 1
3/7
7
Multiple VL53L0X application
AN4846
Figure 2. VL53L0X typical application
9''
9//;
$9''9&6(/
$9669&6(/
*1'
*1'
;6+87
*1'
*1'
$9''
6&/
6'$
'1&
*3,2
5
N
;6+87
9//;
*3,2,17
5
N
&
&
—)
Q)
6'$
6&/
2.
4/7
For a board with multiple VL53L0X used in the design, if there are a limited number of
GPIO pins available on the microprocessor, the recommended options for the use of
these GPIO pins available are:
a)
If only one GPIO is available from the micro-processor with multiple VL53L0X
devices, then two I2C GPIO expanders would be used, where the first would be
for resetting the devices (XSHUT) and the second would be used for the
interrupts. An example schematic is shown in Figure 3.
b)
If (x) VL53L0X devices are being used, and (x+1) GPIOs are available, then it is
recommended to use a GPIO expander for the resetting (XSHUT) of the VL53L0X
devices, and connect each individual interrupt to the microprocessor. Since the
interrupt of each VL53L0X is going directly to the microprocessor, time is saved
when an interrupt is triggered directly to the microprocessor instead of going
through a GPIO expander IC.
c)
If (x) VL53L0X devices are being used, and (2x) GPIOs are available, then no
GPIO expander chips are needed, and all reset (XSHUT) and interrupts pins
would be connected directly to the microprocessor.
DocID029133 Rev 1
AN4846
Multiple VL53L0X application
Figure 3. I2C GPIO expander application
9
5 N
,QWHUUXSWWRKRVW
+RVW,&FRQWURO
$GGUHVVPDQDJHPHQW
WR9''RU966
9''
3
,17
3
6&/
3
6'$
3
$
3
$
3
$
3
966
3
*3,29//;>@
*3,29//;>@
*3,29//;>@
*3,29//;>@
*3,29//;>@
*3,29//;>@
*3,29//;>@
*3,29//;>@
8ELWV*3,2H[SDQGHU
9
+RVW,&FRQWURO
$GGUHVVPDQDJHPHQW
WR9''RU966
9''
3
,17
3
6&/
3
6'$
3
$
3
$
3
$
3
966
3
;6+879//;>@
;6+879//;>@
;6+879//;>@
;6+879//;>@
;6+879//;>@
;6+879//;>@
;6+879//;>@
;6+879//;>@
8ELWV*3,2H[SDQGHU
2.2
VL53L0X API management
See also “VL53L0X_API_Integration Guide.pdf” on www.st.com/VL53L0X in “Design
Resources” page.
In vl53L0x_platform.h API file
•
Set VL53L0x_SINGLE_DEVICE_DRIVER macro to 0 so that API implementation will
be automatically adapted to a multi-device context.
•
Define VL53L0xDev_t type as a structure pointer holding any data required for multidevice management. A mandatory field is an instance of VL53L0xDevData containing
ST API private data.
•
Then
–
define, “N” the number of VL53L0X (Struct MyVL53L0xDev_t BoardDevs[N])
–
Put all devices under reset
–
Enable VL53L0X one after the other and set their I2C address through
VL53L0X_SetDeviceAddress (&BoardDevs[i], FinalI2cAddr)
DocID029133 Rev 1
5/7
7
Revision history
3
AN4846
Revision history
Table 1. Document revision history
6/7
Date
Revision
23-May-2016
1
Changes
Initial release.
DocID029133 Rev 1
AN4846
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2016 STMicroelectronics – All rights reserved
DocID029133 Rev 1
7/7
7