Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino Uno VL53L0X: Show Distance on SSD1306 OLED | ShillehTek

April 24, 2026 27 views

Arduino Uno VL53L0X: Show Distance on SSD1306 OLED | ShillehTek
Project

Build an Arduino Uno distance meter using the VL53L0X ToF sensor and SSD1306 OLED to display real-time millimeter readings, with parts from ShillehTek.

30 hr Beginner3 parts

Project Overview

Arduino Uno + VL53L0X + SSD1306 OLED: In this tutorial, you will use an Arduino Uno with a VL53L0X time-of-flight distance sensor and an SSD1306 OLED display to measure distance and show live millimeter readings on the screen.

The VL53L0X uses infrared laser time-of-flight technology to measure distances up to 2 meters with millimeter precision.

  • Time: 30 minutes to 1 hour
  • Skill level: Beginner
  • What you will build: A real-time distance measuring device that displays measurements in millimeters on a small OLED screen.
Arduino Uno connected to a VL53L0X time-of-flight sensor and an SSD1306 OLED display showing distance readings
The finished project: a VL53L0X sensor feeding live distance data to an OLED display via Arduino.

Parts List

From ShillehTek

External

  • USB cable - to connect the Arduino to your computer
  • Computer with Arduino IDE installed
  • Arduino Uno R3 - reads the sensor and drives the OLED

Note: Both the VL53L0X and the SSD1306 OLED use the I2C bus (SCL and SDA), so they share the same two data lines on the Arduino. Their default I2C addresses are different (0x29 for the VL53L0X and 0x3C for the OLED), which means they can operate on the same bus without conflicts.

Step-by-Step Guide

Step 1 - Gather the Components

Goal: Collect all the parts you need for this project.

What to do: You will need an Arduino Uno (or any Arduino board with I2C support), a VL53L0X time-of-flight laser ranging sensor module, an SSD1306 0.96-inch I2C OLED display, and jumper wires for the connections. Both modules communicate over I2C, which keeps the wiring simple with only four connections each.

Arduino Uno, VL53L0X sensor module, SSD1306 0.96-inch OLED, and jumper wires laid out for the build
All the components needed for this project.
Close-up of VL53L0X time-of-flight sensor module and SSD1306 I2C OLED display module
Close-up of the VL53L0X sensor and OLED display modules.
VL53L0X laser time-of-flight distance sensor module PCB
The VL53L0X sensor module: a compact laser-based distance sensor.

Expected result: All parts are ready on your workbench.

Step 2 - Wire the Circuit

Goal: Connect the VL53L0X sensor and the OLED display to the Arduino over I2C.

What to do: Both modules use the I2C protocol, so they share the same SCL and SDA lines. Make the following connections:

OLED Display:

  • GND to Arduino GND
  • VCC to Arduino 5V
  • SCL to Arduino SCL (A5 on Uno)
  • SDA to Arduino SDA (A4 on Uno)

VL53L0X Sensor:

  • GND to Arduino GND
  • VCC to Arduino 5V
  • SCL to Arduino SCL (A5 on Uno)
  • SDA to Arduino SDA (A4 on Uno)
Wiring diagram showing Arduino Uno sharing the I2C SCL and SDA lines with a VL53L0X sensor and an SSD1306 OLED display
Both modules share the I2C bus: connect GND, VCC, SCL, and SDA from each to the Arduino.

Expected result: Both modules are wired to the Arduino and share the SCL/SDA lines.

Step 3 - Install the Required Libraries

Goal: Add the necessary Arduino libraries for the VL53L0X sensor and the OLED display.

What to do: Open the Arduino IDE and go to Sketch > Include Library > Manage Libraries. Search for and install:

  • Adafruit_VL53L0X - for communicating with the VL53L0X sensor
  • Adafruit_SSD1306 - for driving the OLED display
  • Adafruit_GFX - required graphics library for the SSD1306 driver
Arduino IDE open and ready to install libraries and upload code to an Arduino Uno
The Arduino IDE ready for programming.

Expected result: All three Adafruit libraries are installed.

Step 4 - Upload the Arduino Sketch

Goal: Program the Arduino to read distance from the VL53L0X and display it on the OLED.

What to do: Create a new sketch and paste the following code.

#include <Wire.h>
#include <Adafruit_VL53L0X.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(9600);
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 failed"));
    for (;;);
  }
  display.clearDisplay();
  display.display();
  if (!lox.begin()) {
    Serial.println(F("VL53L0X failed"));
    while (1);
  }
  Serial.println(F("VL53L0X ready"));
}

void loop() {
  VL53L0X_RangingMeasurementData_t measure;
  lox.rangingTest(&measure, false);
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("Distance:");
  if (measure.RangeStatus != 4) {
    display.setTextSize(3);
    display.setCursor(0, 30);
    display.print(measure.RangeMilliMeter);
    display.println(" mm");
    Serial.print("Distance: ");
    Serial.print(measure.RangeMilliMeter);
    Serial.println(" mm");
  } else {
    display.setTextSize(2);
    display.setCursor(0, 30);
    display.println("Out of");
    display.println("range");
  }
  display.display();
  delay(100);
}

This sketch uses lox.rangingTest() to get distance measurements. When valid (RangeStatus not 4), it shows the distance in mm on the OLED. Otherwise it shows "Out of range".

Arduino Uno connected to VL53L0X sensor and SSD1306 OLED modules on a work surface
The VL53L0X and OLED display components connected and configured.
I2C wiring connections showing SDA and SCL shared between Arduino Uno, VL53L0X sensor, and SSD1306 OLED
I2C bus connections between the sensor, display, and Arduino.
OLED text output setup showing distance label and numeric reading layout for SSD1306 display
Configuring the text display for the distance output.

Select Arduino Uno under Tools > Board, choose the correct COM port, and click Upload.

Arduino IDE board menu selecting Arduino Uno as the target board
Select Arduino Uno as the target board.
Arduino IDE compiling and uploading code to an Arduino Uno over USB
Compile and upload the sketch to the Arduino.

Expected result: The sketch compiles and uploads without errors.

Step 5 - Test the Distance Display

Goal: Verify that the OLED shows live distance measurements.

What to do: Once uploaded, the OLED should display the distance in mm. Place objects in front of the VL53L0X sensor and move them closer and farther. The VL53L0X measures from about 30 mm up to 1200 mm accurately.

Arduino Uno project running with VL53L0X sensor while SSD1306 OLED displays a live distance value in millimeters
The finished project in action: distance readings on the OLED in real time.

Expected result: The OLED shows distance in mm that updates as you move objects in front of the sensor.

Conclusion

You connected a VL53L0X time-of-flight distance sensor and an SSD1306 OLED display to an Arduino Uno over the shared I2C bus, creating a compact distance meter that displays readings in millimeters in real time.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something similar for your product, check out our IoT consulting services.

Credits: Photos and images are credited to RonFrtek on Instructables, which served as the reference for this version.