MLX90614 contactless temperature sensor

  • Contest Winner

    In case somebody can be interested (I've not seen any old posts talking about it), I've just tested this contactless temperature sensor from aliexpress ( which is pretty cool.

    It reports BOTH the ambient temperature and the object temperature (the latter ranging from -70 to +380 C), has a standard i2c interface and works great with this library:

    The price is also pretty interesting, being around 3.5$.

    It can be used in many applications to e.g. measure the temperature of a body, the temperature of an oven, the temperature of a board, or whatever object could make sense in your project.

  • Mod

    @user2684 What's your experience on the measurement distance?
    Posts on the internet suggest it is only a few cm's without using a lense, which would make practical use very limited IMHO.

  • Contest Winner

    It starts "sensing" e.g. the human body when around 50cm away but the real measurement happens only when less than 10 cm away. Agree this is not the best scenario but could be still probably useful for something line on-demand body temperature measurement or when the absolute value has a relative importance (e.g. when a significant variation has to be detected).

  • Hi guys,

    I made a battery powered sensor with MLX90614 to check my furnace's temp. It needs Adafruit's MLX90614 library. I'm using RFM69 radios, so please make sure you chose the right one.

     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     * Created by Henrik Ekblad <>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list:
     * Documentation:
     * Support Forum:
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     * Version 1.0 - Henrik Ekblad
     * Pressure sensor example using BMP085 module  
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #include <SPI.h>
    #include <MySensors.h>  
    #include <Wire.h>
    //MLX90614 library from Adafruit
    #include <Adafruit_MLX90614.h>
    Adafruit_MLX90614 mlx = Adafruit_MLX90614();
    #define MY_PARENT_NODE_ID 0
    #define TEMP_CHILD 0
    #define TEMP2_CHILD 1
    #define BAT_CHILD 2
    int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
    int oldBatteryPcnt = 0;
    // Sleep time between reads (in ms). Do not change this value as the forecast algorithm needs a sample every minute.
    const unsigned long SLEEP_TIME = 60000; 
    float lastTemp=-1;
    float lastTemp2=-1;
    float lastBat=-1;
    boolean metric;
    MyMessage tempMsg(TEMP_CHILD, V_TEMP);
    MyMessage temp2Msg(TEMP2_CHILD, V_TEMP);
    MyMessage batMsg(BAT_CHILD, V_VOLTAGE);
    void setup() {
    //  metric = getConfig().isMetric;
          // use the 1.1 V internal reference
     //       pinMode(5, OUTPUT);
    #if defined(__AVR_ATmega2560__)
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("MLX90614", "1.0");
      // Register sensors to gw (they will be created as child devices)
      present(TEMP_CHILD, S_TEMP);
      present(TEMP2_CHILD, S_TEMP);
      present(BAT_CHILD, S_MULTIMETER);
    // Loop
    void loop() {
      Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); 
      Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
        int sensorValue = analogRead(BATTERY_SENSE_PIN);
          int batteryPcnt = sensorValue / 10.23;
          float batteryV  = sensorValue * 0.003363075;
      #ifdef MY_DEBUG
        Serial.print("Battery Voltage: ");
        Serial.println(" V");
        Serial.print("Battery percent: ");
        Serial.println(" %");
        if (oldBatteryPcnt != batteryPcnt) {
            // Power up radio after sleep
            oldBatteryPcnt = batteryPcnt;
        send(tempMsg.set(mlx.readAmbientTempC(), 2));
        lastTemp = mlx.readAmbientTempC();
        send(temp2Msg.set(mlx.readObjectTempC(), 2));
        lastTemp2 = mlx.readObjectTempC();
        send(batMsg.set(batteryV, 2));
        lastBat = batteryV;

  • Contest Winner

    Hi, in case can be useful, this sensor is also available through NodeManager ( as SENSOR_MLX90614.

  • Positioning would be critical, but these sensors always make me think of a sort of automated health diagnostic system. It checks your temperature and reports if you have a fever.

Log in to reply

Suggested Topics

  • 87
  • 7
  • 6
  • 5
  • 9
  • 2