Home LCD Projects MLX90614 and OLED display example

MLX90614 and OLED display example

by shedboy71

In this example we will connect a MLX90614 to our ARduino and display the output on a 128 x 32 I2C OLED LCD display, you could use a different type of LCD or a bigger OLED variety but that is what we had at hand here

The MLX90614 is an Infra Red thermometer for non contact temperature measurements. Both the IR sensitive thermopile detector chip and the signal conditioning ASIC are integrated in the same TO-39 can.  Integrated into the MLX90614 are a low noise amplifier, 17-bit ADC and powerful DSP unit thus achieving high accuracy and resolution of the thermometer.

I used a module for MLX90614, see the links at the bottom but here is a picture of a typical one

mlx90614

mlx90614

Now both the OLED display and the MLX90614 are I2C devices and both require 3v3 and GND, so the wiring is pretty straightforward for this project. Here is a layout drawn up in fritzing to give you the general idea

MLX90614 and OLED_bb MLX90614 and OLED_bb

Code

This example requires a couple of libraries, which make development a little easier. Both are from Adafruit and are the MLX90614 and SSD1306 libraries, using newer Arduino IDEs you can search for these but here are the links if you need to download them and manually import them

MLX90614 library

SSD1306 library

[codesyntax lang=”cpp”]

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <stdint.h>
#include <Adafruit_MLX90614.h>

#define OLED_RESET 4

Adafruit_SSD1306 display(OLED_RESET);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup()   
{                
  Serial.begin(57600);
  Serial.println("Adafruit MLX90614 test");  
  mlx.begin();  
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
}


void loop() 
{
    // Clear the buffer.
  display.clearDisplay();

  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("Ambient: ");
  display.print(mlx.readAmbientTempC()); 
  display.print(" c");
  display.setCursor(0,10);
  display.print("Object: ");
  display.print(mlx.readObjectTempC()); 
  display.print(" c");
  display.display();
  delay(2000);

}

[/codesyntax]

 

 

Output

Now all going well you should see something like this on your OLED display

MLX90614 output

MLX90614 output

 

Links

The sensor module costs about $10
MLX90614 Contactless Temperature Sensor Module For Arduino

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More