Home Circuitpython Adafruit Feather M0 and TMP006 thermopile sensor circuitpython example

Adafruit Feather M0 and TMP006 thermopile sensor circuitpython example

by shedboy71

In this example we connect a TMP006 thermopile sensor to an Adafruit Feather M0 running Circuitpython

This is the sensor that I will be using, link below to buy the sensor

Lets look at some information regarding the sensor

Texas Instruments’ TMP006 is the first in a series of temperature sensors that measure the temperature of an object without the need to make contact with the object.

This sensor uses a thermopile to absorb the infrared energy emitted from the object being measured and uses the corresponding change in thermopile voltage to determine the object temperature.

Infrared sensor voltage range is specified from -40°C to +125°C to enable use in a wide range of applications. Low power consumption along with low operating voltage makes the part suitable for battery-powered applications.

The low package height of the chip-scale format enables standard high volume assembly methods, and can be useful where limited spacing to the object being measured is available.


Complete single-chip digital solution, including integrated MEMS thermopile sensor, signal conditioning, ADC and local temperature reference

Digital output:
Sensor voltage: 7 µV/°C
Local temperature: -40°C to +125°C
SMBus™ compatible interface
Pin-programmable interface addressing
Low supply current: 240 µA
Low minimum supply voltage: 2.2 V


Parts List


Name Link
Adafruit Feather M0 Express Adafruit (PID 3403) Feather M0 Express – Designed for CircuitPython – ATSAMD21 Cortex M0
TMP006 TMP006 Contact-less IR Thermopile Sensor Sensor Module
Connecting cables Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire



An easy device to connect since its an I2C one, here is a layout

feather and tmp006 layout

feather and tmp006 layout


I used Mu for development

The following is based on a library , I copied the TMP006 library to the lib folder to my Feather M0 Express – https://circuitpython.org/libraries

import time
import board
import busio
import adafruit_tmp006
# Define a function to convert celsius to fahrenheit.
def c_to_f(c):
    return c * 9.0 / 5.0 + 32.0
# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_tmp006.TMP006(i2c)
# Initialize communication with the sensor, using the default 16 samples per conversion.
# This is the best accuracy but a little slower at reacting to changes.
# The first sample will be meaningless
while True:
    obj_temp = sensor.temperature
        "Object temperature: {0:0.3F}*C / {1:0.3F}*F".format(obj_temp, c_to_f(obj_temp))



Here is what I saw in Mu REPL window

Press any key to enter the REPL. Use CTRL-D to reload.soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

main.py output:

Object temperature: 22.422*C / 72.359*F

Object temperature: 22.446*C / 72.402*F

Object temperature: 22.341*C / 72.213*F

Object temperature: 22.317*C / 72.170*F




You may also like

Leave a Comment