Combining Multiple Proximity Sensors Using a Single I²C Bus

By Europese uitgevers

Contributed By De Europese redacteurs van Digi-Key

During the past few years, there has been a rapidly growing interest in proximity sensors.  For example, today they are widely used in smartphones to deactivate the phone's touch-sensitive screen when the device is being used to make or receive calls because this reduces the smartphone's power consumption by disabling the touch-sensitivity when the user is not looking at the screen. It also minimizes the risk of an accidental disconnection if the phone makes contact with part of the user's body during the call. Until recently, proximity sensors consisted of an infra-red LED that emitted pulses of IR light and an infra-red detector that measured the amplitude of the light reflected back from the target. This technique allowed the host processor to estimate the distance between the sensor and the target.  However, its accuracy is limited by the fact that the amount of light reflected back from the target depends on several factors such as the color and smoothness of the target surface.

STMicroelectronics’ FlightSense™ technology takes an entirely different approach.  It accurately measures the time it takes for light to travel to the nearest object and be reflected back to the sensor. The advantage of this “Time-of-Flight” (ToF) approach is that the time it takes for the light to make the return journey is dependent only on the distance travelled, rather than the amount of light reflected back. Since the speed of light is known to a high degree of accuracy, the distance for the return journey is simply "speed of light" x "time delay".

The VL53L0X is a new generation of ToF laser-ranging module housed in the smallest package on the market today, providing accurate distance measurement over a very wide range of target color and reflectance characteristics.  The device can measure absolute distances up to 2 m, with accuracy as good as 3% depending on the chosen power consumption/accuracy trade-off.

Block diagram of STMicroelectronics VL53L0X ToF laser-ranging module

Figure 1: VL53L0X block diagram.

As shown in Figure 1, the VL53L0X integrates a 940 nm VCSEL emitter (Vertical Cavity Surface-Emitting Laser) that is totally invisible to the human eye. The laser is completely eye-safe, fully complying with the latest standard (IEC 60825-1:2014 - 3rd edition) for Class 1 laser devices.  Coupled with internal physical infrared filters, it enables longer ranging distance, higher immunity to ambient light and higher immunity to cover-glass optical cross-talk.  The reflected IR light is measured by a highly sensitive leading-edge SPAD (Single Photon Avalanche Diode) array, the technology of choice for state-of-the-art medical scanners.

Using multiple VL53L0X in a single design

Although the initial market for ToF ranging devices focused on a single device measuring only distance ahead of the sensor, many emerging applications such as robotics and gesture sensing require the use of multiple proximity sensors.  One of the issues that have to be considered in these applications is the demand this makes on the GPIO resources of the host processor.   

A single VL53L0x sensor needs four of the host MCU’s GPIO pins (Figure 1). Two of these provide the I²C serial clock (SCL) and serial data (SDA) signals, one (XSHUT) is used by the MCU to reset the sensor, and the fourth (GPIO1) provides the host controller with an interrupt in time-critical applications, or as a polled input when the application does not require a fast response to new distance measurements. 

However, this does not mean that two sensors require eight GPIO pins or three sensors require 12 GPIO pins because all of the sensors can share the same I²C clock and data lines.  When multiple sensors share the same I²C bus, they must have different bus addresses. These are assigned by the host MCU sequentially resetting each sensor and immediately issuing a WRITE command. Therefore, the MCU must be able to reset/reboot each sensor individually, either directly via one of its GPIO pins or via a GPIO expander chip.

Essentially, there are three basic scenarios, given that designers do not want to over-specify their MCUs in terms of GPIO count, package size and board complexity.

Scenario 1 covers the case when the number of available GPIO pins (given that two GPIO pins are already dedicated to the I²C clock and data signals) is at least twice the number of VL53L0x proximity sensors. In this scenario, no GPIO expander chips are needed and the XSHUT and Interrupt (GPIO1) pins of each sensor can be connected directly to the host MCU's GPIO pins.

The second scenario covers the case where there are not enough GPIO pins available to handle the XSHUT and Interrupt (GPIO1) signals for all of the VL53L0x sensors in the system. In this scenario, shown in Figure 2, a pair of GPIO expanders such as the Fairchild FLX6408UMX allow up to eight proximity sensors to share the I²C bus. One of the expanders is used to provide the XSHUT reset signals to the sensors, while the other receives the output ranging signals.

Diagram of I2C GPIO expander example

Figure 2: I²C GPIO expander example.

Finally, the third scenario covers the intermediate case where the board contains N sensors and the MCU has at least N+1 GPIO pins available, allowing the designer to dispense with one of the GPIO expanders. In this scenario, the preferred option is to use the GPIO expander (which would be U1 in Figure 2) to provide the XSHUT signals to the sensors while connecting the sensor outputs directly to the MCU's GPIO pins.  This allows the system to respond more rapidly to any changes in the ranging measurements by avoiding the time delay inherent in routing the interrupt signal through a GPIO expander.

Designing with the VL53L0x

To accelerate the development of VL53L0x applications, ST offers a variety of development boards such as the X-NUCLEO-53LAO1 expansion board for use within its STM32 MCU development environment, as well as the STSW-IMG005 API package. To allow the user to validate the VL53L0X in an environment as close as possible to its final application, the X-NUCLEO-53L0A1 expansion board is delivered with a holder in which 3 different height spacers of 0.25, 0.5 and 1 mm, can be used to simulate the air gap between the VL53L0X and the cover glass.

The VL53L0X API package provides a set of C functions controlling the VL53L0X, including sensor initialization and ranging data acquisition to enable the development of end-user applications. It is structured in a way that allows it to be compiled on any kind of platform through a well-isolated platform layer (mainly for low level I²C access).


Proximity sensing has entered a new era with the latest devices providing unprecedented levels of accuracy combined with hardware and software support tools that allow designers to quickly and affordably try out, prototype and industrialize new applications that exploit the ability to manage multiple sensors from a single control board.

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

Achtergrondinformatie over deze auteur

Europese uitgevers

Over deze uitgever

De Europese redacteurs van Digi-Key