Short Range LIDAR with the VL6180X

ST Electronics recently released a new chip, the VL6180X, as well as a evaluation kit to demonstrate how it works.  The eval kit (as of 11/19/2014) is available from Mouser Electronics as part number EVALKIT-VL6180X for less than $20.  The chip itself sells for $6.25 in single units.  The eval kit seems to be in short supply as of the moment, but I was able to get one in a recent order.  The eval kit consists of two boards.  One is an Arduino-compatible shield that contains the VL6180X, a 4 digit, 7 segment display and power ale level shifting circuitry to drive the VL6180X.  The kit also includes a ST's NECLEO board, which is an Arduino-like micro controller board based on the STM32 F401RE microcontroller in an LQFP64 package.  Here's a picture of the two boards side by side:

Click image for a larger view

The VL6180X is an interesting beast.  It's actually two functions on one.  One part can be used an an Ambient Light Sensor (ALS), like those used in smart phones to adjust screen brightness in response to ambient conditions.  The other part is a ranging module that uses a IR VCSEL (Infrared Vertical Cavity Surface Emitting Laser) and some type of time of flight measuring technology called FlightSense to measure the distance from chip to an object in its line of sight.  The range it can normally measure, 100mm, is rather small, but the data sheet says that somewhat larger ranges are possible under some condition, but are not guaranteed.

I tried to get the eval kit working with the NUCLEO board but was unsuccessful, as the NUCLEO board does not come preprogrammed and the software needed to set it up and upload code only runs on a PC and, being a Mac guy, I don't own one.  I emailed ST support for help, but never got a response back.  So, I decided to write my own code using an Arduino UNO to replace the NUCLEO board.  Fortunately, the eval kit contains information on how the various parts on the VL6180X shield board connect to Arduino pins.  In addition, ST's app note on the VL6180X, describes the code needed to operate the ranging function.  With a bit of work, I managed to get the ranging function working and also cobbled together some code to drive the 7 segment lED display so that I could use the demo board as originally intended (the source code for this is available at the bottom of this page.

The demo code I wrote displays the range to the detected object in millimeters.  If nothing is in range, the display shows the maximum reading possible, 255.  Here's a short demo video showing the VL6180X shield in action: