Non-contact Infrared Temperature Sensor Using Arduino

by Lithium-ion in Circuits > Arduino

737 Views, 1 Favorites, 0 Comments

Non-contact Infrared Temperature Sensor Using Arduino

20220414_111354.jpg

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

Supplies

Breadboard or Custom PCB

Soldering equipments

Power supply

Wires and USB

Story

mini_20220414_111436.jpg

Hello guys, I want to make my own most accurate temperature meter. When coming to the high temperature measurements, PT1000, PT100 and K-type thermocouple can be the solution. But the problem is big and messy wires between the Microcontroller and sensor. These wires are not waterproof and heatproof. The analog sensors are not too much accurate and take a long heat-up and cooldown time.

So, keeping all the factors and requirements in mind. I decided to go with MLX90614 Infrared Contact-less temperature sensor. This infrared sensor can measure outer body temperatures by receiving infrared heat emitted from body or surface of object. Then we will convert this project in PCB project as the commercially available one. PCBWAY is the best PCB prototype service providing Company. And if you Sign-up using my link, you will get free coupons and newcomer gifts.

MLX90614:

mini_20220413_172953.jpg

The MLX90614 Temperature Sensor is capable of measuring the temperature of a particular object or surface without getting into contact with it. The sensor works measuring the amount of IR light emitted by an object towards which it is pointed at, it uses the principle of Stefan-Boltzmann Law which states that all objects including living being, emit IR energy based on the temperature of the object or the being. Hence by measuring the IR energy emitted, we can calculate the temperature of the object.

Features:

· Operating Voltage: 3.6V to 5V

· Operating Current: 1.5mA

· Temperature Range: -70°C to 382.2°C

· Accuracy: 0.02°C

· Package: TO-39

· When measuring the temperature, please maintain a measuring distance of 1 cm

· Small size, low cost

· Factory calibrated in a wide temperature range: -40 to 125 C for sensor temperature and -70 to 380 C for object temperature.

· Customizable PWM output for continuous reading

Working of Infrared Thermometers:

temp.gif
1_qtNOyBEx7ieqAT1CjBwuSQ.png

Similar to visible light, it is also possible to focus, reflect, or absorb infrared light. Infrared thermometers employ a lens to focus the infrared light emitting from the object onto a detector known as a thermopile.

The thermopile is nothing but thermocouples connected in series or parallel. When the infrared radiation falls on the thermopile surface, it gets absorbed and converts into heat. Voltage output is produced in proportion to the incident infrared energy. The detector uses this output to determine the temperature, which gets displayed on the screen.

While this entire process may sound complicated, it takes only a few seconds for the infrared thermometer to record the temperature and display in your desired unit.

Emissivity:

Emissivity shows how much infrared energy a thermometer can put out at a time. IR thermometers with emissivity closer to 1.00 can read more materials than those with lower emissivity value. Pick a thermometer that comes with an adjustable emissivity level to tweak the amount of infrared energy emitted and compensate for the energy reflected by the material in consideration for temperature measurement.

Components Required:

mini_20220414_111407.jpg

1) MLX90614 temperature sensor

2) Arduino Uno

3) SH1306 Oled

4) Breadboard or Custom PCB

5) Wires and soldering equipment’s

Circuit Diagram:

PICTURE DIAGRAM.png
CIRCUIT.png

Here in the circuit we are using very minimal components, A screen to print the readings, MLX sensor and Arduino as brain of this project. Arduino has SDA and SCL pins A4 and A5 respectively. We can connect both Led and sensor using I2C protocol to that SDA(DATA PIN) and SCL(CLOCK PIN). I2C can support up to 127 devices, here we have only two. All the circuit is powered by 5volt Dc.

PCB Layouts:

Untitled.png

Keeping the size of project in mind, I designed a PCB. Here we are using Arduino nano chip and type c port to power up the whole system. You can also place a boost converter with 3.7volt battery. Download PCB files, Gerbers and schematics from here.

PCBWAY is the leading PCB manufacturing company for electronics hobbyists and project makers(students). PCBWAY is providing 5pcs of prototype PCB just in $5 and SMT assembly service from $12. You can checkout more, PCB, SMT ASSEMBLY, STENCIL and 3-D printed parts.

Ordering Method:

ice_screenshot_20220321-220048.png
ice_screenshot_20220321-220103.png
mini_20220408_163756.jpg

My designed PCB is followed by PCBway prototype service, giving a professional looks to my designs. PCBWAY is affordable and best PCB manufacturer. If you want to use same designs as mine then get them from here.

For the professional looks, I am using PCB prototype service from PCBWAY. The ordering process is too simple, Sign-up to PCBway using this link.

Then choose the PCB size and other parameters of color, surface finish and material.

Add it to cart > Upload the Gerber files > CHECKOUT and get your package in just 7 days.

Code:

#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);
}

Setting Up Emissivity:

Download the MLX90614 library and get the Emissivity set code from the example section of the library. Or you can copy the below given sketch. Just change the value and make the tests with your readings.

Code For Emissivity:

/*
 * See app note:
 * https://www.melexis.com/en/documents/documentation/application-notes/application-note-mlx90614-changing-emissivity-setting
 *
 * 1. Write 0x0000 to address 0x04 (erase the EEPROM cell)
 * 2. Write the new value to address 0x04
 * 3. Read the value in address 0x04 in order to check that the correct value is stored
 * 4. Restart the module
 *
 */

#include <Adafruit_MLX90614.h>

//== CHANGE THIS ============
double new_emissivity = 0.95;
//===========================

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  Serial.begin(9600);
  while (!Serial);

  Serial.println("Adafruit MLX90614 Emissivity Setter.\n");

  // init sensor
  if (!mlx.begin()) {
    Serial.println("Error connecting to MLX sensor. Check wiring.");
    while (1);
  };

  // read current emissivity
  Serial.print("Current emissivity = "); Serial.println(mlx.readEmissivity());

  // set new emissivity
  Serial.print("Setting emissivity = "); Serial.println(new_emissivity);
  mlx.writeEmissivity(new_emissivity); // this does the 0x0000 erase write

  // read back
  Serial.print("New emissivity = "); Serial.println(mlx.readEmissivity());

  // done
  Serial.print("DONE. Restart the module.");
}

void loop() {
}

Measuring:

mini_20220414_111755.jpg

As I said, this is the best and fastest thermometer to measure the temperature of outer body. It is working well with all the libraries and fully accurate.

I also matched the Celsius scale readings to my real time temperature monitoring DHT and NTC. Giving out the best results this time with a led display. Once again a very thanks to PCBWAY to sponsor this project. Sign-up using this link and got reward points and coupons.