Overview
The Adafruit TMF8806 Time of Flight Sensor is a great Time of Flight distance sensor from ams Osram in the TMF series of chips. The TMF8806 in particular can do 20mm to 5 meters at up to 30 Hz update rate, and a dedicated low-power 200mm mode. It also has a wider field-of-view.
The sensor contains a very tiny invisible laser source and a matching sensor. The TMF8806 can detect the "time of flight", or how long the light has taken to bounce back to the sensor. Since it uses a narrow light source, it is good for determining distance of only the surface directly in front of it. Unlike sonars that bounce ultrasonic waves, the 'cone' of sensing is narrower, in this case about 30° short range (under 200mm) and 21° above. Unlike IR distance sensors that try to measure the amount of light bounced, the TMF is much more precise and doesn't have linearity problems or 'double imaging' where you can't tell if an object is very far or very close.
One nice thing about this sensor is that while it does not require a firmware 'patch' on boot for 5 meter mode and the SRAM usage is also much lighter, so it fits easily in small memory boards like the ATmega328. You can use it on many 8-bit microcontroller devices. There is a 10 meter mode that does require a firmware patch but its only 3K and will also fit if you want it!
Please note: The TMF8806 datasheet/firmware implies it can do 10 meter ranging but we weren't able to get results past 5 meter even after the firmware upload step, and there may be an undocumented calibration step required. Either way, we would call this a 5m distance sensor and not a 10m.
The sensor is small and easy to use in any robotics or interactive project. Since it needs 3.3V power and logic we put the little fellow on a breakout board with a regulator and level shifting. You can use it with any 3-5V power or logic microcontroller with no worries. Works great with the 3.3V logic level of a Feather, or the 5V level of a ATmega, this breakout is ready to work with most common microcontrollers or SBCs. and since it speaks I2C, you can easily connect it up with two data wires plus power and ground.
As if that weren't enough, we've also added SparkFun qwiic compatible STEMMA QT connectors for the I2C bus so you don't even need to solder. Just wire up to your favorite micro with a plug-and-play cable to get ToF data ASAP. For a no-solder experience, just wire up to your favorite micro using a STEMMA QT adapter cable. The Stemma QT connectors also mean the TMF8806 can be used with our various associated accessories. QT Cable is not included, but we have a variety in the shop
Communicating to the sensor is done over I2C, check out our Arduino and CircuitPython/Python code to get started fast and read data over I2C in a jiffy.
Page last edited September 10, 2026
Pinouts
The default I2C address is 0x29.
Power Pins
- VIN - This is the power pin. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V.
- GND - This is common ground for power and logic.
I2C Logic Pins
- SCL - I2C clock pin, connect to your microcontroller's I2C clock line. This pin can use 3-5V logic, and there's a 10K pullup on this pin.
- SDA - I2C data pin, connect to your microcontroller's I2C data line. This pin can use 3-5V logic, and there's a 10K pullup on this pin.
- STEMMA QT - These connectors allow you to connectors to dev boards with STEMMA QT connectors or to other things with various associated accessories
Other Pins
- INT - the interrupt pin. It is an open-drain interrupt.
- EN - the enable pin. The pin is active high. If you pull the pin low, it turns off the TMF8806 and all memory content is lost
- IO0 and IO1 - these are general purpose input and output pins. They default to output low. They are 3V tolerant only!
Power LED and LED Jumper
- Power LED - In the upper left corner, above the STEMMA connector, on the front of the board, is the power LED, labeled on. It is a green LED.
- LED jumper - This jumper is located on the front of the board, the the right of the LED. Cut the trace on this jumper to cut power to the "on" LED.
Page last edited September 10, 2026
CircuitPython and Python
It's easy to use the TMF8806 with Python or CircuitPython, and the Adafruit_CircuitPython_TMF8806 module. This module allows you to easily write Python code to interface with the sensor.
You can use this driver with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.
CircuitPython Microcontroller Wiring
First wire up the breakout to your board exactly as follows. The following is the breakout wired to a Feather RP2040 using the STEMMA connector:
-
Board STEMMA 3V to breakout STEMMA VIN (red wire)
-
Board STEMMA GND to breakout STEMMA GND (black wire)
-
Board STEMMA SCL to breakout STEMMA SCL (yellow wire)
- Board STEMMA SDA to breakout STEMMA SDA (blue wire)
The following is the breakout wired to a Feather RP2040 using a solderless breadboard:
-
Board 3V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Python Computer Wiring
Since there are dozens of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported.
Here's the Raspberry Pi wired with I2C using the STEMMA connector:
-
Pi 3V to breakout STEMMA VIN (red wire)
-
Pi GND to breakout STEMMA GND (black wire)
-
Pi SCL to breakout STEMMA SCL (yellow wire)
- Pi SDA to breakout STEMMA SDA (blue wire)
Here's the Raspberry Pi wired with I2C using a solderless breadboard:
-
Pi 3V to breakout VIN (red wire)
-
Pi GND to breakout GND (black wire)
-
Pi SCL to breakout SCL (yellow wire)
- Pi SDA to breakout SDA (blue wire)
Python Installation of TMF8806 Library
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!
Once that's done, from your command line run the following command:
pip3 install adafruit-circuitpython-tmf8806
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!
CircuitPython Usage
To use with CircuitPython, you need to first install the Adafruit_CircuitPython_TMF8806 library, and its dependencies, into the lib folder on your CIRCUITPY drive. Then you need to update code.py with the example script.
Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the code.py file to your CIRCUITPY drive.
Your CIRCUITPY/lib folder should contain the following folders:
- adafruit_bus_device/
- adafruit_register/
- adafruit_tmf8806/
Python Usage
Once you have the library pip3 installed on your computer, copy or download the following example to your computer, and run the following, replacing code.py with whatever you named the file:
python3 code.py
Example Code
If running CircuitPython: Once everything is saved to the CIRCUITPY drive, connect to the serial console to see the data printed out!
If running Python: The console output will appear wherever you are running Python.
# SPDX-FileCopyrightText: Copyright (c) 2026 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import board
from adafruit_tmf8806 import tmf8806
i2c = board.I2C()
sensor = tmf8806.TMF8806(i2c)
print(f"Firmware version: {'.'.join(str(part) for part in sensor.firmware_version)}")
print(f"Serial number: {sensor.serial_number:#06x}")
sensor.start_measuring()
while True:
if sensor.data_ready:
distance = sensor.distance
if distance is not None:
print(f"Distance: {distance} mm")
You'll see the TMF8806 recognized over I2C by printing its firmware version and serial number. Then, distance measurements will begin printing whenever data is ready from the sensor.
Page last edited September 10, 2026
Arduino
Using the TMF8806 breakout with Arduino involves wiring up the breakout to your Arduino-compatible microcontroller, installing the Adafruit_TMF8806 library, and running the provided example code.
Wiring
Wire as shown for a 5V board like an Uno. If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the breakout VIN.
Here is an Adafruit Metro wired up to the breakout using the STEMMA QT connector:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Here is an Adafruit Metro wired up using a solderless breadboard:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
Library Installation
You can install the Adafruit_TMF8806 library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit_TMF8806, and select the Adafruit TMF8806 library:
If asked about dependencies, click "Install all".
If the "Dependencies" window does not come up, then you already have the dependencies installed.
/*!
* @file tmf8806_simpletest.ino
*
* Simple example for the Adafruit TMF8806 Time-of-Flight sensor.
* Reads distance continuously and prints results to Serial.
*
* Written by Limor Fried/Ladyada for Adafruit Industries.
* BSD license, all text here must be included in any redistribution.
*/
#include <Adafruit_TMF8806.h>
Adafruit_TMF8806 tof;
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(10);
}
Serial.println(F("TMF8806 Time-of-Flight Sensor Test"));
if (!tof.begin()) {
Serial.println(F("Failed to find TMF8806 sensor!"));
while (1) {
delay(10);
}
}
Serial.println(F("TMF8806 found!"));
// Print chip ID and revision
uint8_t chipId = tof.getChipID();
Serial.print(F("Chip ID: 0x"));
Serial.println(chipId, HEX);
Serial.print(F("Revision ID: "));
Serial.println(tof.getRevisionID());
// Print firmware version
uint8_t major, minor, patch;
tof.getVersion(&major, &minor, &patch);
Serial.print(F("Firmware version: "));
Serial.print(major);
Serial.print(F("."));
Serial.print(minor);
Serial.print(F("."));
Serial.println(patch);
// Read and print serial number
uint8_t serial[4];
if (tof.readSerialNumber(serial, 4)) {
Serial.print(F("Serial number: 0x"));
for (int i = 3; i >= 0; i--) {
if (serial[i] < 0x10) {
Serial.print(F("0"));
}
Serial.print(serial[i], HEX);
}
Serial.println();
}
// Configure sensor (optional - defaults work well)
tof.setDistanceMode(TMF8806_MODE_2_5M); // 2.5m mode (default)
tof.setIterations(400); // 400k iterations
tof.setRepetitionPeriod_ms(33); // ~30Hz
// Start continuous measurement
if (!tof.startMeasuring(true)) {
Serial.println(F("Failed to start measurement!"));
while (1) {
delay(10);
}
}
Serial.println(F("Measuring..."));
Serial.println();
}
void loop() {
if (tof.dataReady()) {
tmf8806_result_t result;
if (tof.readResult(&result) && result.reliability > 0) {
Serial.print(F("Distance: "));
Serial.print(result.distance);
Serial.print(F(" mm"));
Serial.print(F(" Reliability: "));
Serial.print(result.reliability);
Serial.print(F(" Temp: "));
Serial.print(result.temperature);
Serial.println(F(" C"));
}
}
delay(10);
}
Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You'll see the TMF8806 recognized over I2C. Then, the distance in mm, reliability of the measurement and die temperature in Celcius will be printed whenever data is ready.
Page last edited September 10, 2026
Downloads
Page last edited September 10, 2026