Skip to content

Time of Flight Wireling Tutorial

This Wireling features a VL53L0X Infrared Time-of-Flight sensor, most often used for distance detection between 2cm and 2m!

Technical Details

VL53L0X Time-of-Flight Sensor Specs

  • Fully integrated miniature module
    • 940 nm laser VCSEL
    • VCSEL driver
    • Ranging sensor with advanced embedded micro controller
  • Fast, accurate distance ranging
    • Measures absolute range up to 2m
    • Reported range is independent of the target reflectance
    • Advanced embedded optical cross-talk compensation to simplify cover glass selection
  • Eye safe
  • I²C
    • Compatible with 400 kHz (FAST mode)
    • Address: 0x52

TinyDuino Power Requirements

  • Voltage: 3.0V - 5.5V 
  • Current:
    • Hardware Standby: 5uA
    • Software Standby: 6uA
    • Timed Ranging Inter Measurement: 16uA
    • Active Ranging Average Consumption: 19mA

Pins Used

  • A5/SCL - I²C Serial Clock line
  • A4/SDA - I²C Serial Data line


  • 10mm x 10mm (.393 inches x .393 inches)
  • Max Height (from the lower bottom of Wireling to upper top Wireling Connector): 3.70mm (0.15 inches)
  • Weight: 1 gram (.04 ounces)


Programming Cable
Arduino USB A to B Cable
Raspberry Pi


Hardware Assembly

Depending on the development system you choose, you will need to put together a TinyDuino stack using the 32-pin tan connectors, or you will just need to plug in your Wireling to Port 0 using a Wireling Cable. (You can change this port in the included Arduino Sketch using the selectPort() function)

Software Setup

The library needed for the Time-of-Flight Sensor is included in the Arduino sketch zip file included under Software. Download the zipped folder and open the sketch in the Arduino IDE.

Make the correct Tools selections for your development board. If unsure, you can double check this help page that mentions the Tools selections needed for any TinyCircuits processor.

Upload Program

The VL53L0X is very accurate up to 2m, past that results will be approximate while still being exceptionally good.

 * Time of Flight Distance Sensor Wireling Example
 * This example shows how to use continuous mode to take, and print
 * range measurements with the VL53L0X Wireling. It is based on
 * vl53l0x_ContinuousRanging_Example.c from the VL53L0X API.
 * The range readings are in units of mm.
 * Hardware by: TinyCircuits
 * Modified by: Laveréna Wienclaw for TinyCircuits 
 * Last Modified: 12/18/19

#include <Wire.h>       // For I2C communication
#include "VL53L0X.h"    // For interfacing with the Time-of-Flight Distance sensor
#include <Wireling.h>   // For interfacing with Wirelings

VL53L0X distanceSensor; // Name of sensor 
const int tofPort = 0;  // Port # of sensor (Found on Wireling Adapter Board)

const int averageCount = 1;
int average[averageCount];
int averagePos = 0;

#if defined(ARDUINO_ARCH_AVR)
#define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB

void setup() {
  delay(200);              // Sensor Startup time
  SerialMonitorInterface.begin(115200); // Set Baud Rate
  Wire.begin();            // Begin I2C communication

  // Enable power & select port
  // Select the port of the distance sensor (this number corresponds 
  // with port #'s on the Wireling adapter board)

  // Initialize the distance sensor and set a timeout

  // Start continuous back-to-back mode (take readings as
  // fast as possible).  To use continuous timed mode
  // instead, provide a desired inter-measurement period in
  // ms (e.g. sensor.startContinuous(100))

void loop() {
  // Calculate the average position of the distance sensor
  unsigned long averageRead = 0;
  average[averagePos] = distanceSensor.readRangeContinuousMillimeters();
  if (averagePos >= averageCount)averagePos = 0;
  for (int i = 0; i < averageCount; i++) {
    averageRead += (unsigned long)average[i];
  averageRead /= (unsigned long)averageCount;

  // Print the average position to the TinyScreen and the Serial Monitor

Results will print out in mm.

Contact Us

If you have any questions or feedback, feel free to email us at or make a post on the forum.

Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it!

Thanks for making with us!