Welcome to MicroPython MLX90614 Library’s documentation!

Contents:

mlx90614 module

MLX90614

class mlx90614.MLX90614(i2c[, address])

The basic class for handling the communication with the sensor.

The i2c parameter is an initialized I²C bus, and the optional address specifies which sensor to connect to, if you have more than one and have changed their addresses with the Addr pin.

All temperatures are returned in Celsius.

read_ambient_temp()

Get the ambient sensor temperature

read_object_temp()

Get the object temperature from the first or only thermopile

read_object2_temp()

Get the object temperature the second thermopile, if it exists

Usage Examples

Connect your sensor in following way:

  • vin3V
  • gndgnd
  • sclgpio5
  • sdagpio4

Now, to make basic measurement:

import mlx90614
from machine import I2C, Pin
i2c = I2C(scl=Pin(5), sda=Pin(4))
sensor = mlx90614.MLX90614(i2c)
print(sensor.read_ambient_temp())
print(sensor.read_object_temp())
if sensor.dual_zone:
    print(sensor.object2_temp)

To perform continuous measurement:

import time
while True:
    print(sensor.read_ambient_temp(), sensor.read_object_temp())
    time.sleep_ms(500)
There are some useful properties:
  • .dual_zone - set to True if the sensor has two thermopiles
  • .ambient_temp - equivalent to read_ambient_temp(), also works for object and object2

Indices and tables