The MLX90614 is a non-contact infrared thermometer with a measurement range from -70 to +380 degree Celsius. Just connect the four leads to your MBed supported device and you will have a accurate thermometer with a resolution of 0.01 and a accuracy of 0.5 degrees, or for that matter you can use any microcontroller that can communicate with it through it’s I2C interface.
Being an I2C device you simply need to connect to the SDA, SCL and choose a suitable GND and Vin. I used 3.3v to be safe, although the breakout states 3 to 5v.
This version I chose comes with a breakout board with all of the components needed for operation. Here is a picture of that breakout board
Features:
Small size, low cost
Mounted on a breakout board with two types of pins
10k Pull up resistors for the I2C interface with optional solder jumpers
Factory calibrated in wide temperature range:
-40 … + 125 ° C for sensor temperature and
-70 … + 380 ° C for object temperature.
High accuracy of 0.5 ° C over wide temperaturerange (0 … + 50 ° C for both Ta and To) High (medical) accuracy calibration
Measurement resolution of 0.02 ° C
Single and dual zone versions
SMBus compatible digital interface
Customizable PWM output for continuous reading
Sleep mode for reduced power consumption
Layout and Connection
I used the following connection from the module above to my Wemos Mini
LPC1768 Connection | Module Connection |
VOUT | VIN |
Gnd | Gnd |
SDA – Pin 28 | SDA |
SCL – Pin 27 | SCL |
Here is a layout
Code
You need to import the following library and code
[codesyntax lang=”cpp”]
#include "mbed.h" #include "mlx90614.h" I2C i2c(p28,p27); //sda,scl Serial pc(USBTX,USBRX); //serial usb config MLX90614 IR_thermometer(&i2c); float temp; //temperature in degrees C int main() { pc.baud(115200); while (1) { if (IR_thermometer.getTemp(&temp)) { printf("Temperature is %5.1F degrees C\r\n",temp); } //wait for device to produce next temperature reading wait(1.0); } }
[/codesyntax]
Using a terminal program you will hopefully see the following
Temperature is 24.6 degrees C
Temperature is 24.6 degrees C
Temperature is 24.7 degrees C
Temperature is 24.6 degrees C
Temperature is 24.6 degrees C
Temperature is 24.0 degrees C
Temperature is 23.6 degrees C
Temperature is 25.8 degrees C
Temperature is 27.6 degrees C
Temperature is 30.4 degrees C
Temperature is 48.1 degrees C
Temperature is 51.9 degrees C
Temperature is 44.0 degrees C
Temperature is 34.6 degrees C
Temperature is 32.6 degrees C
Links
Here is a link to the datasheet and also the breakout I purchased, come in at about $9 a piece.
MLX90614 datasheet
MLX90614 Contactless IR Infrared Thermometer Sensor Module IIC for Arduino