Non-Contact Thermometer using Arduino

Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
User avatar
Dohangout
Admin
Admin
Contact:
Location: Philippines
Posts: 198
Joined: Sat Apr 23, 2016 10:32 pm

Non-Contact Thermometer using Arduino

Mon Mar 30, 2020 3:08 pm

This Thermal gun will be built using a non-contact temperature sensor called MLX90614; hence it can not only be used to measure component temperatures but can also be used for measuring body temperature, surface temperature, Heat ventilation and much more. Of course, these thermal guns are readily available in the market from renowned manufacturers like Fluke, Flir etc. But they are not light on your pockets and on top of that what is more fun than building your own gadgets. So let’s get started…
non-contact-thermometer.jpg
non-contact-thermometer.jpg (31.75 KiB) Viewed 1380 times
Materials Required
Arduino Pro Mini
MLX90614 Infrared Temperature Sensor
OLED Display – SSD1306
Laser Diode
9V Battery
Push button
Battery Clip
Connecting wires

MLX90614 sensor is manufactured by Melexis Microelectronics Integrated system, it has two devices embedded in it, one is the infrared thermopile detector (sensing unit) and the other is a signal conditioning DSP device (computational unit). It works based on Stefan-Boltzmann law which states that all objects emits IR energy and the intensity of this energy will be directly proportional to the temperature of that object. The sensing unit in the sensor measures how much IR energy is emitted by a targeted object and the computational unit converts it into temperature value using a 17-bit in-built ADC and outputs the data through I2C communication protocol. The sensor measures both the object temperature and ambient temperature to calibrate the object temperature value.

MLX90614 Features:
- Operating Voltage: 3.6V to 5V
- Object Temperature Range: -70°C to 382.2°C
- Ambient Temperature Range: -40°C to 125°C
- Resolution/Accuracy: 0.02°C

What should be the distance between the Sensor and the Object?
One question that is not directly answered by the datasheet is the measuring distance between the sensor and the object. The value of this distance is given by the term Field of View (FOV), for our sensor the field of view is about 80°.
MLX90614-Infrared-Thermometer-Field-of-View.png
MLX90614-Infrared-Thermometer-Field-of-View.png (14.75 KiB) Viewed 1380 times
You can think of the sensing range to be in a conical shape from the point of sensor as show above. So, as we go far from the measuring object the sensing area increase by two folds. Meaning for every 1cm we move away from the object the sensing area grows by 2cm. In our thermal gun we have placed a laser diode on top of the sensor to know where the sensing area of the sensor is currently pointing at. I found that the values were reliable if the gun is pointed at 2cm away from the object and the accuracy goes down as we move away.

Circuit Diagram
Circuit-Diagram-for-IR-Thermometer-using-Arduino-and-Infrared-Temperature-Sensor.png
Once the Arduino code is ready we can upload it to our hardware using an external TTL programmer or FTDI board since the pro mini does not have one on-board. Then simply press the push button to trigger the thermal gun and you will notice the laser beam falling on the object and the temperature of the object being displayed on the OLED screen as shown below. Here I have used it to measure the temperature of a component as pointed by the laser beam.

The thermal gun was also tested on soldering iron, 3D printer nozzle, ice cubes etc and a satisfactory result was observed.

The Code:

Code: Select all

/***********************************
Arduino Contactless thermometer 
MLX90614 I2C connection
OLED 4-wire SPI connection 
Dated: 3-29-2020
**********************************/

#include <Wire.h> 
#include <SparkFunMLX90614.h> 

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// If using software SPI (the default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

IRTherm therm;

void setup() 
{
  Serial.begin(9600); 
  therm.begin(); 
  therm.setUnit(TEMP_C); 

   display.begin(SSD1306_SWITCHCAPVCC);
   display.clearDisplay();
   display.setRotation(2);
  
}

String temperature; 
char runner;

void loop() 
{
  if (therm.read()) // On success, read() will return 1, on fail 0.
  {
    temperature = String(therm.object(), 2);
    Serial.print("Object: ");
    Serial.print(temperature); Serial.println("C");
    display.clearDisplay();
    runner++;
    delay(5);
  }

  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(display.width()/4,display.height()/12);
  
  if (therm.object()>=100)
  display.setCursor(display.width()/4,display.height()/12);
  
  display.println(temperature);

  display.drawLine(display.width()/runner,display.height() - display.height()/2.5, display.width()/runner+1, display.height() - display.height()/2.5, WHITE);

  display.setCursor(0,display.height()-display.height()/4);
  display.setTextSize(1);
  display.println("   ThermalGun");
  display.setCursor(display.width()- display.width()/4,display.height()/12);
  display.println("deg C");
  display.display();

  if (runner>20)
  runner=0;
}
If you feel this project is helpful. Please share and kindly don't hit and run...Please donate


Return to “ARDUINO AND RASPBERRY PI”

Links