Contactless Temperature Sensor MLX90614

Contactless Temperature Sensor MLX90614 © GPL3+

+ LCD/OLED can be used to measure body temperature or to detect movement... in Celsius and Fahrenheit!

  • 3,714 views
  • 3 comments
  • 20 respects

Components and supplies

About this project

Video tutorial if needed

Hello, and welcome to this tutorial, here I’ll use a MLX90614 (GY906) Infrared non contact temperature sensor, I’ll use it with a LCD i²c screen and OLED display, and I’ll measure temperature in °C and °F.

So, each object emits infrared waves depending on its heat, and these waves are detected using a thermopile which get hotter and hotter, in the same time converting the excess heat to electricity, you can learn more if you want read this Article.

Here are some information about the MLX 90614 sensor:

  • Range for ambient temperature: -40 to 125 ˚C (-40 to 257 °F)
  • Range for object temperature (non contact): -70 to 380 ˚C (-94 to 716 °F)
  • Resolution: 0.02 °C
  • Accuracy: 0.5°C for (0-50 °C) both ambient and object

You can use this sensor for medical and healthcare applications, home automation, or measure surfaces using a non invasive method.

Parts

Test

First we test with serial monitor only, I placed my hand over the sensor, you can see the difference

Test with LCD screen, and measure in Celsius

Test with OLED screen, and measure in Fahrenheit

Issue:

The issue about this module is that the temperature readings changes a lot when moving only few centimeters from the object ( you can check it in the video). So you should be pretty close or fix a distance from you want to measure and calibrate the module...

Code

MLX90614_LCD_Celsius.inoArduino
This code uses LCD and in Celsius
/* This code works with MLX90614 (GY906) and LCD ic screen
 * It measures both ambient and object temperature in Celsius and display it on the screen
 * Please visit www.surtrtech.com for more details
 */

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <Adafruit_MLX90614.h>

#define I2C_ADDR 0x27 //I2C adress, you should use the code to scan the adress first (0x27) here
#define BACKLIGHT_PIN 3 // Declaring LCD Pins
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  
  mlx.begin();
  lcd.begin (16,2);
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH); //Lighting backlight
  lcd.home ();

}

void loop() {
 lcd.setCursor(0,0);
 lcd.print("Ambient ");
 lcd.print(mlx.readAmbientTempC());
 lcd.print(" C");
 
 lcd.setCursor(0,1);
 lcd.print("Target  ");
 lcd.print(mlx.readObjectTempC());
 lcd.print(" C");

 delay(1000);

}
MLX90614_OLED_Fahrenheit.inoArduino
This one with OLED and displays in Fahrneheit, you can combine both
/* This code works with MLX90614 (GY906) and OLED screen
 * It measures both ambient and object temperature in Fahrenheit and display it on the screen
 * Please visit www.surtrtech.com for more details
 */

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

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET    -1 // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); //Declaring the display name (display)
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {  
  mlx.begin(); 
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //Start the OLED display
  display.clearDisplay();
  display.display();

}

void loop() {
  display.clearDisplay();
  
  display.setTextSize(1);                    
  display.setTextColor(WHITE);             
  display.setCursor(0,4);                
  display.println("Ambient"); 
  
  display.setTextSize(2);
  display.setCursor(50,0);
  display.println(mlx.readAmbientTempF(),1);
 
  display.setCursor(110,0);
  display.println("F");
  
  display.setTextSize(1);                    
  display.setTextColor(WHITE);             
  display.setCursor(0,20);                
  display.println("Target"); 
  
  display.setTextSize(2);
  display.setCursor(50,17);
  display.println(mlx.readObjectTempF(),1);
  
  display.setCursor(110,17);
  display.println("F");
  
  display.display();
  
  delay(1000);

}

Schematics

With Serial monitor only
Wiring 1 yddnym2fkg
With LCD i²c
Wiring 2 n4cxl7e6hh
With OLED
Wiring 3 wa0mwjxzup

Comments

Similar projects you might like

DHT11 Humidity + Temperature Sensor with 16x2 LCD display

Project showcase by

  • 14,400 views
  • 4 comments
  • 32 respects

Arduino Based Digital Temperature Sensor

Project showcase by Abishek Bhalaaji

  • 11,884 views
  • 0 comments
  • 11 respects

Arduino Temperature - Humidity - Rain Sensor

Project showcase by Rick_Findus

  • 10,820 views
  • 6 comments
  • 17 respects

Ultrasonic Sensor with Alarm, LCD and Temperature

Project tutorial by MichDragstar

  • 7,296 views
  • 7 comments
  • 21 respects

Temperature sensor

Project tutorial by Grant

  • 18,454 views
  • 6 comments
  • 32 respects

Temperature Sensor To control Servo Motor

by Jasleen

  • 6,407 views
  • 2 comments
  • 10 respects
Add projectSign up / Login