Create Makers

MLX90614 Infrared Thermometer Device

Disclosure: Some of the links below are affiliate links and we only earn a small commission if you purchase through our links at no additional cost to you. The earning mainly used for maintaining the website.

Weekend at home makes you a moody person. Let’s make a mini-project to cheer up your day. Today we are going to make a contactless infrared thermometer to read body temperature. As a starter, we will be using Arduino to interface with MLX90614 to make this project.

Starter Pack

Of course, if you are new to MLX90614 sensor, visit my MLX90614 Tutorials.

  1. Box
  2. Arduino Pro Mini 3.3V 8MHz (Or other)
  3. MLX90614 Sensor Module
  4. OLED Display
  5. Ultrasonic Sensor HC-SR04P (3.3V – 5V)
  6. TP4056 Charging Module
  7. Lipo/Li-ion Battery
  8. Craft Knife
  9. Wire Stripper
  10. AWG 26 Wire
  11. Lens (Optional)
  12. Buzzer (Active or Passive)
  13. Switch
  14. FTDI FT232 USB to TTL

The Design

I got my design idea from hair wax container because throwing them away is kind of a waste. Reusing them to something else is really a great deal. But, I was facing a problem whether the container could fit all the components or not.

So as a hobbyist maker, Autodesk Fusion 360 offers a limited free version of CAD + CAM for your projects. You can unleash your design ideals to your projects. With that, I made all those components into 3D and assembled into the Fusion 360.

I have uploaded my designs at GrabCad. Feel free to use them.

The Circuit

The Codes

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

float voltComp, objVal;
const int echoPin = 12;
const int trigPin = 13;const int buzzer = 11;

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
Adafruit_SSD1306 oled(128, 64, &Wire, −1);

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INTPUT);
  pinMode(buzzer, OUTPUT);

  if(!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)){
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }


  oled.clearDisplay();
  oled.setTextColor(WHITE);
  oled.setTextSize(3);
  oled.setCursor(30, 6);
  oled.print("Body");
  oled.setCursor(0, 35);
  oled.print("Scanner");
  oled.display();

  mlx.begin();
  delay(500);
}


void loop() {
  ambVal = ambTemp();
  objVal = objTemp();
  oled.clearDisplay();
  if(distance() <= 6 && objVal >= ambVal +0.2){
    if(calibrateTemp() <= 37.5){
      oled.setCursor(13, 22);
      oled.setTextSize(3);
      oled.print(calibrateTemp(), 1);
      oled.setTextSize(1);
      oled.print(" ");
      oled.cp437(true);
      oled.write(79);
      oled.setTextSize(3);
      oled.print("C");
      oled.display();
      tone(buzzer, 1000, 500);
    }

    else{
      oled.setCursor(13, 22);
      oled.setTextSize(3);
      oled.print(calibrateTemp(), 1);
      oled.setTextSize(1);
      oled.print(" ");
      oled.cp437(true);
      oled.write(79);
      oled.setTextSize(3);
      oled.print("C");
      oled.display();
      for(int i = 0; i <= 10; i++){
        tone(buzzer, 1000, 300);
        delay(500);
        noTone(buzzer);
        delay(10);
      }
    }
  }

  else if(distance() <= 6 && objVal <= ambVal +0.2){
    oled.setTextSize(2);
    oled.setCursor(22, 4);
    oled.print("Bye Bye");
    oled.setCursor(22, 25);
    oled.print("You Are");
    oled.setCursor(22, 45);
    oled.print("Dead!!!");
    oled.display();
    tone(buzzer, 1000, 2000);
  }

  else{
    oled.setTextColor(WHITE);
    oled.setTextSize(3);
    oled.setCursor(30, 6);
    oled.print("Body");
    oled.setCursor(0, 35);
    oled.print("Scanner"
    oled.display();
  }

  delay(2500);
}
float voltComp;
float readAmb, ambCompTemp;
float readObj, objCompTemp;
float tempVal;

float voltValue(){
  voltComp = analogRead(A0) * (3.3 / 1023);

  return voltComp;
}


float ambTemp(){
  redAmb = mlx.readAmbientTempC();
  ambCompTemp = readAmb − (voltValue() − 3) * 0.6;

  return ambCompTemp;
}


float objTemp(){
  redObj = mlx.readObjectTempC();
  objCompTemp = readObj − (voltValue() − 3) * 0.6;

  return objCompTemp;
}


float calibrateTemp(){
  if(ambVal < 33){
    tempVal = objVal + 3;
  }

  else if(ambVal >= 33 && ambVal < 34){
    tempVal = objVal + 2;
  }

  else
    tempVal = objVal + 1;
  }


  return tempVal;
}
long duration;
int distanceCM;

int distance(){
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distanceCM = duration * 0.034 / 2;

  return distanceCM;
}
Subscribe
Notify of
guest
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments