Distance Measurement using VL6180X & ESP32

This post is just to document using a VL6180X Satellite module to measure distance to a range of 100mm (about 4 inches).

The VL6180X Datasheet can be found here and the VL6180X Satellite can be found here.

VL6180X Satellite
VL6180X Satellite

The VL6180X Satellites come in a little package from ST Micro.  Inside are two identical VL6180X modules.  Each module has a voltage regulator, a bunch of passive parts, and the VL6180X chip.

Here are a couple things to know about the chip:

  • Communicates using i2c.
  • Operates on 2.7V (hence the regulator).
  • Has a range of 100mm (about 4 inches).
  • Can output ambient light levels and distance at about 10Hz.
  • There are ready made libraries available inside the Arduino IDE.  Simply search for the libraries using the keyword “VL6180X”.  Adafruit, among others, should pop right up.  This post uses the library from Pololu that can be found here.  Note, it is simpler to use the library manager inside the Arduino IDE to install this software, as compared to, installing using the provided link.

One of the modules was hooked up to a ESP32 module as can be seen in the following picture.

VL6180X Testing
VL6180X Testing

The connections between the ESP32 and the VL6180X include:

  • 3.3v and Gnd
  • i2c Clock to G22 (add 4.6k pull-up resistor to 3.3V)
  • i2C Data to G21 (add 4.6k pull-up resistor to 3.3V)

For testing, the Pololu continuous pooling example worked well.  It is attached here for reference.

InterleavedContinuous.ino.zip

The following plot of the streaming data shows consistence distance measurements even as light levels change.  This is a result of using “time-of-flight” for distance calculations instead of reflected light levels.

Light Level vs Distance
Light Level vs Distance

Bottom line, nice little 4″ sensor that updates at 10Hz.  Oh, and the sensor uses very little power (less than 2mA) during operation.

Leave a Reply