Drivers for MLX90614 Long-range Infrared Sensor

These drivers support the MLX90614 Single and Dual Zone Infrared Thermometer.


This is a long-range infrared camera that can measure temperatures between -70 °C and 380 °C with an accuracy of 0.5 °C.


  • Linux device with an MLX90614 connected via I2C, such as any version of Forward Loop Zero with the optional long-range infrared.
  • (Optional) Docker on the Linux device. We recommend you check out floop, our simple, open-source tool for working with embedded Docker on multiple devices at the same time.


In order to use the drivers with floop, you configure the drivers and your application on a host device then push the source code and build instructions to each target device using floop.

On your host, install floop using pip:

pip install --upgrade floopcli

Clone the driver repository:

git clone --recursive

The clone needs to be recursive in order to clone the appropriate I2C drivers.

Change directory into driver directory:

cd mlx90614

Configure floop to allow access to I2C devices on the target device. For example, if you have one target device available over SSH at the address, your floop.json in the mlx90614 directory could be:



Notice that privileged is true, so floop has access to target device hardware.

In order to check that installation succeeded, you can run the simple example included in the driver repository. You will need to tell the driver which bus holds the MLX90614.

Edit the file

BUS=1 # change this value to match the i2c bus where your mlx90614 is connected
mkdir -p /drivers/i2c/
mkdir -p /drivers/mlx90614/
cp /floop/include/i2c/linux/*.h /drivers/i2c/
cp /floop/mlx90614/*.h /drivers/mlx90614/
g++ /floop/example/main.cpp -I/drivers -o /floop/mlx90614/mlx90614 && \
    MLX90614_BUS=$BUS /floop/mlx90614/mlx90614

Make sure to change the value of BUS to match the bus to which your MLX90614 is connected. The value of BUS is the same as the integer that corresponds to the /dev/i2c-* entry for your device.

Now run the example:

floop run -v

If the example returns with no error, then the installation succeeded.

You can install the C++ header files for use in your own applications.

In order to use the drivers with Linux, you need to install some I2C dependencies:

sudo apt-get install -y python-smbus python-dev i2c-tools libi2c-dev

You need to install the MLX90614 and I2C headers, then include them during compilation of your application. Inside of your application folder, you can install both headers at the same time:

mkdir -p ./floop/i2c/ && \
mkdir -p ./floop/mlx90614/ && \
wget -O ./floop/i2c/i2c.h && \
wget -O ./floop/mlx90614/mlx90614.h

When you compile your application, make sure to include the path to the driver headers. For example, add -I./floop/ during compilation. You can then access the drivers by including the mlx90614 header:

#include "mlx90614/mlx90614.h"

Note that you can also use these steps to install the drivers inside of a Docker container.


The example shows the major functionality of the drivers.

#include "mlx90614/mlx90614.h" //drivers
#include <stdlib.h> //getenv

int main() {
    // Initialize I2C resources using BUS in
    MLX90614 mlx90614(getenv("MLX90614_BUS")[0] - '0');

    // After initialization, check that I2C started correctly
    if (mlx90614.error()) {
        printf("Error: MLX90614 did not initialize\n");
        return 1;

    printf("MLX90614 initialized\n");

    // Set emissivity
    if(!mlx90614.setObjectEmissivityCoefficient(1.0)) {
        printf("Error: Set object emissivity coefficient failed\n");
        return 1;
    printf("Object emissivity coefficient: %f\n", mlx90614.objectEmissivityCoefficient());

    // Set object temperature range
    if(!mlx90614.setObjectTemperatureMinMax(0.0, 380.0)) {
        printf("Error: Set object minimum and maximum temperature failed\n");
        return 1;
    printf("Object minimum temperature: %f\n", mlx90614.objectTemperatureMin());
    printf("Object maximum temperature: %f\n", mlx90614.objectTemperatureMax());

    // Set ambient temperature range
    if(!mlx90614.setAmbientTemperatureMinMax(0.0, 50.0)) {
        printf("Error: Set ambient minimum and maximum temperature failed\n");
        return 1;

    // Read temperature values in °C
    double ambTemp = mlx90614.ambientTemperature();
    printf("Ambient Temperature: %f\n", ambTemp);

    // For single zone sensors, only this value is accurate
    double objTemp1 = mlx90614.objectTemperature1();
    printf("Object Temperature 1: %f\n", objTemp1);

    // For single zone sensors, this value is not accurate
    double objTemp2 = mlx90614.objectTemperature2();
    printf("Object Temperature 2: %f\n", objTemp2);

    printf("MLX90614 install succeeded\n");
    return 0;

API Documentation

Driver interface for MLX90614
Source Code
Our MIT license lets you use, change, and sell the drivers for free
Forward Loop Docs
Check out other drivers, develop tools, and code