Lithium ION
Published © GPL3+

Non-contact Infrared temperature sensor using Arduino

A sensor that can measure the outer temperature of any body, The MLX90614 infrared temperature sensor with proper circuit.

BeginnerFull instructions provided1 hour8,370
Non-contact Infrared temperature sensor using Arduino

Things used in this project

Software apps and online services

PCBWAY

Story

Read more

Schematics

Circuit diagram

Code

Code

Arduino
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 
#define SCREEN_WIDTH 128    // OLED display width, in pixels
#define SCREEN_HEIGHT 64    // 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);
 
#define laser 12
 
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
 
double temp_amb;
double temp_obj;
 
void setup()
{
  Serial.begin(9600);
  mlx.begin();         //Initialize MLX90614
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //initialize with the I2C addr 0x3C (128x64)
 
  Serial.println("Temperature Sensor MLX90614");
 
  pinMode(laser, OUTPUT);     // Connect LASER
 
  digitalWrite(laser, LOW);
 
  display.clearDisplay();
  display.setCursor(25,15);  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.println(" Thermometer");
  display.setCursor(25,35);
  display.setTextSize(1);
  display.print("Initializing");
  display.display();
  delay(5000);
}
 
void loop()
{
  //Reading room temperature and object temp
  //for reading Fahrenheit values, use
  //mlx.readAmbientTempF() , mlx.readObjectTempF() )
  temp_amb = mlx.readAmbientTempC();
  temp_obj = mlx.readObjectTempC();
  digitalWrite(laser, HIGH);
 
  //Serial Monitor
  Serial.print("Room Temp = ");
  Serial.println(temp_amb);
  Serial.print("Object temp = ");
  Serial.println(temp_obj);
 
  display.clearDisplay();
  display.setCursor(25,10);  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.println(" Temperature");
  display.setCursor(25,30);
  display.setTextSize(2);
  display.print(temp_obj);
  display.print((char)247);
  display.print("C");
  display.display();
 
  delay(1000);
}

Credits

Lithium ION

Lithium ION

51 projects • 33 followers
A passionate electronics DIY boy. Currently improving in Embedded systems, soldering and programming.

Comments