MLX90614 Infra Red thermometer

The MLX90614 is an calibrated Infra Red thermometer for non contact temperature measurements. The sensor can be configured output to I2C or PWM. This module only supports an I2C (10kHz - 100kHz) connection.

MLX90614

Wiring

Device Pin Espruino Note
GND / - GND
PWR 3.3 Available in 3V (2.6 to 3.6V) or 5V (4.5 to 5.5V)
SCL B10 or any other SCL pin
SDA B3 or any other to SCL corresponding SDA pin

Don't forget the I2C pullups. The common GY-906 breakout does not have pullups on the board.

Usecases

Initialisiation

The maximum I2C bitrate is 100 kHz and the minimum is 10 kHz.

I2C2.setup( { scl: B10, sda: B3 } );
var mlx = require('MLX90614').connect( I2C2 );

The sensor does not work with I2C1 on an Espruino Pico, (http://forum.espruino.com/conversations/280634/). Any help is welcome. I2C2 and I2C3 work without a problem. I2C1 works with an original Espruino board.

Read Ambient (chip) temperature and object (IR) temperatures

I2C2.setup( { scl: B10, sda: B3 } );
var mlx = require('MLX90614').connect( I2C2 );

console.log( "Chip = " + mlx.readAmbientTemperature() + "°C" );
console.log( "IR   = " + mlx.readObject1Temperature() + "°C" );

Power Supply Voltage Compensation

The measured temperature is dependent from the power supply voltage (0.6°/Volt). If you have a voltage other than 3.3V you can compansate this dependency:

I2C2.setup( { scl: B10, sda: B3 } );
var mlx = require('HTU21D').connect( I2C2 );
mlx.voltage = 3.0;
// ...

Many breakout boards have a voltage regulator to 3.3v and use the 3V-version of the MLX90614. Don't change mlx.voltage even if the power supply of the breakout is higher e.g. 5V.

Configure object emissivity

As a standard, the MLX90614 is calibrated for an object emissivity of 1 (black body). If you want to measure the temperature of objects with other emissivity you have to configure the sensor with their emissivity first. Otherwise you will not get the right temperature:

I2C2.setup( { scl: B10, sda: B3 } );
var mlx = require('HTU21D').connect( I2C2 );
mlx.setEmissivity( 0.8 ); // Emissivity of snow → 0.8, Aluminium → 0.18, plastics → 0.84 … 0.95

The emissivity will be stored in EEPROM cells. It's not necessary to set the emissivity after every POR but it's not dangerous: Only a changed value will be stored.

Enter Sleep Mode

The MLX90614 can enter in Sleep Mode (typ. 2.5µA). The mode is not available for the 5V supply version.

I2C2.setup( { scl: B10, sda: B3 } );
var mlx = require('HTU21D').connect( I2C2 );

mlx.enterSleepMode();

There are two ways to put MLX90614 into power-up default mode:

  • POR
  • By Wake up request → SCL pin high and then SDA pin low for at least 33ms.

After wake up the first data is available after 0.25 seconds (typ).

Buying

References

/* Read the ambient temperature from the sensor. The ambient temperature is the internal chip temperature.
 * @returns {number} Ambient temperature in °C
 */
MLX90614.prototype.readAmbientTemperature = function () { ... }

/* @returns {number} temperature in °C
 */
MLX90614.prototype.readObject1Temperature = function () { ... }

/* Some variants of MXL90614 have a second IR sensor with a different field of view (angle).
 * If the second sensor element is not available the sensor does not answer and you will get an I2C error.
 * @returns {number} temperature in °C
 */
MLX90614.prototype.readObject2Temperature = function () { ... }

/* Enter the sensor into sleep mode (typ. 2.5µA). Afterwards the sensor doesn't answer I2C requests anymore.
 * There are two ways to put MLX90614 into power-up default mode: 1) POR or 2) By wake up request (SCL pin hight and
 * then SDA pin low for at least 33ms). Wakeup is currently not implemented.
 *
 * This function is not available in 5V supply version.
 */
MLX90614.prototype.enterSleepMode = function () { ... }

/* Read the current configured object emissivity from the sensor in the range from 0.0 to 1.0.
 * @returns {number} configured object emissivity
 */
MLX90614.prototype.getEmissivity = function () { ... }

/* Write a new object emissivity persistent into the sensor. The value will be stored in EEPROM.
 * It is not necessary to erase the memory before. This is done internally.
 * A read write operation will only be done if the value has changed.
 * @param emissivity new object emissivity in the range from 0.0 to 1.0
 */
MLX90614.prototype.setEmissivity = function (emissivity) { ... }

MLX90614.prototype.convertRawToCelcius = function (raw) { ... }

MLX90614.prototype.read16 = function (reg) { ... }

MLX90614.prototype.write16 = function (cmd, value) { ... }

// Calculates CRC-8: x^8 + x^5 + x^4 + 1
MLX90614.prototype.crc8 = function (bytes) { ... }

exports.connect = function (i2c, address) { ... }

ToDos

The following features are currently not supported:

  • Work with I2C1 on a pico
  • Wakeup from Sleep mode
  • Configure FIR and IIR parameter
  • Read chip id

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.