VL6180 Time of Flight Range Finder

/media/uploads/sburg/12785-01.jpg

The VL6180 works by measuring the time it takes for light to bounce off of a distant surface. This is a more accurate method than using reflected light intensity or a reflected angle measurement. It is available from Sparkfun.

Hello World

main.cpp

//updates the pc terminal with range readings twice a second
#include "VL6180.h"
#include "mbed.h"

VL6180 rf(p9, p10); //I2C sda and scl
Serial pc(USBTX, USBRX); //USB serial

int main() {
    float reading;
    while(1) {
        reading = rf;
        pc.printf("Read %4.1f cm\n", reading);
        wait(0.5);
    }
}

Import programVL6180_Hello_World

Hello world program for the VL6180

Library

Import libraryVL6180

Library for the VL6180 time of flight range finder.

Pinout

VL6180 breakout boardmbed
VccVout
GndGnd
sdap9
sclp10
IO0NC
IO1NC

Images

300

Connection of breakout board to mbed.

/media/uploads/sburg/capture.png

Screen capture showing output of hello world program.

Usage

To use the VL6180 breakout board, connect it to mbed according to the pinout above. Then, create a VL6180 object in the C++ code. The constructor automatically handles initialization of the device. The read() function returns a float ranging from 0.0cm to 25.5cm according to the distance the range finder read. The maximum range is approximately 20cm. When this distance is reached, the read() function will return 25.5cm instead.

Notes

Although the VL6180 chip requires 2.8V to work properly, the Sparkfun breakout board includes a 2.8V voltage regulator. This allows the board to run off of mbed's 3.3V supply. The breakout board also includes the pull-up resistors necessary for I2C to work properly.

How It Works

Datasheet wrote:

The VL6180X is the latest product based on ST’s patented FlightSense™ technology. This is a ground-breaking technology allowing absolute distance to be measured independent of target reflectance. Instead of estimating the distance by measuring the amount of light reflected back from the object (which is significantly influenced by color and surface), the VL6180X precisely measures the time the light takes to travel to the nearest object and reflect back to the sensor (Time-of-Flight).

Additional Resources

VL6180 Datasheet

VL6180 Application Note

Breakout board schematic


Please log in to post comments.