Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

Library for the Melexis Digital IR Thermometer Type MLX90614 (variants)

The MLX90614 Digital IR thermometer uses the SMBus™ Communication Protocol. This is similar enough to the I2C bus to enable the device to work with the Arduino Wire library with few functional exceptions.

Melexis home page
Datasheet

Written by: John Fitter
Date: Initial release 10feb2015
Revised: Jul2017 numerous updates

This is a very simple implementation having one class defined for just one specific sensor. The original reason for this defining this class was to enable the measurement of the temperature of brushless DC outrunner type motors used on Multicopters, for the purposes of mechanical data logging and telemetry.

The design of outrunner BLDC motors is such that the rotor is the outside of the motor. The stator, which is fixed, is in the centre of the motor. It is important to know the temperature of the rotor since the rotor contains the magnets. Why? Because when the magnets get too hot they stop being magnets - permanently. On a Multicopter this results in total loss of the aircraft if not fitted with an emergency retrieval system.

With the rotor spinning at high speed a remote sensing solution is well suited to this application. In normal use the device is placed close to the motor so that the rotor fills its field of view, yet the body of the device is exposed to the flow of cooling air directed onto the motor. This enables accurate ambient temperature correction in the device.

Because Multicopters can have many motors and this device can coexist on the I2C bus with many other sensors it is well suited to the application. Defining a class enables multiple instances of the device to be created in software dramatically simplifying the programming task compared to older non object oriented approaches.

This is the first step in the development of a base class and class hierarchy for sensors specific to remotely piloted aircraft, and in particular electric powered aircraft.

The thermometer uses 2 Pins, one for SDA and the second for SCL, in addition to power and ground. Some device variants require 3V power and some require 5V - be carefull. The 3V devices have zener diodes on the inputs allowing them to be 5V tolerant, however it would be prudent to insert current limiting resistors on these inputs (not too high a value as they slow the bus down).

An easy way to play with these devices is to get one off eBay. Just search for MLX90614 Contactless Temperature Sensor Module For Arduino Compatible. They seem to be fitted with the "BAA" variant which is a 3V part with wide field of view. A 3V regulator is onboard so they can run from a 5V power supply. The bus lines have pullup resistors fitted but no inline current limiting resistors.

Initial release February 2015: A repository for the most recent version was created at GitHub which can be found here: MLX90614 Library
To install the library download the RAR Archive from GitHub and extract it to the libraries Folder

Jul2017 revisions. Numerous revisions based on user feedback. The problem of zeroing the configuration register in some rare cases has been resolved. Several methods have had default parameters added to make them compatible with other libraries (classes) from the same author. The crc8 class has been improved.

Feel free to contribute your code or improvements to this library.