ESP8266

MLX90614 with ESP8266 Nodemcu & Blynk, IoT Temperature Sensor

MLX90614 with ESP8266 Nodemcu:

 

MLX90614 with ESP8266 Nodemcu & Blynk, IoT Temperature Sensor– In this article, you will learn how to make IoT temperature monitoring system using MLX90614 contactless infrared temperature sensor, Nodemcu ESP8266 WIFI module, SSD1306 I2C supported Oled display module and Blynk application.

Just don’t skip this part of the article, because there are certain things that I believe you should know if you want to get the most accurate temperature readings using the MLX90614 temperature sensor. As you know very well the MLX90614 is a non-contact infrared temperature sensor and is completely different from those surface contact based temperature sensors. And you might also know every object or material has its own emissivity value.


Just think for a minute, the temperature monitoring system which you are planning to build is going to be used for measuring the temperature of a specific object, or do you want to measure the temperature of any random object? This is really an important question which you need to ask yourself.

Let’s say you are designing a contactless temperature monitoring system for Covid patients and you ignore the emissivity value of the Human skin, then how you are supposed to get an accurate temperature reading?

In my previous project, I used the MLX90614 infrared temperature sensor with the Arduino and explained the whole process; of how to perfectly calibrate the MLX90614 temperature sensor using the Emissivity value. During my first test, I completely ignored the emissivity value and as a result, I got the wrong temperature readings as I was using the standard emissivity value of 1. While in reality, different objects have different emissivity values.

Anyway, I calibrated the MLX90614 Temperature sensor as per the human skin and then I started getting the actual temperature reading. And this way, I built myself the most accurate contactless temperature monitoring system for Covid patients.



So, if this is your first time using the MLX90614 non-contact infrared temperature sensor and you are getting the wrong values, then you should definitely read my article on the MLX90614 infrared temperature sensor.

As this time, I am planning to measure the temperature of random objects so I don’t care about the minor temperature fluctuations. So, this time I am going to use the standard emissivity value of 1 which is a factory-calibrated value. I think I have shared enough useful information with you guys, now it’s time to start the practical demonstration.


Altium Designer, Altium 365, and Octopart:

MLX90614 with ESP8266

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.


To make it completely portable I am going to use my 4S lithium-Ion battery pack which I made for my long-range FPV drone. So, if you also want to make a 1s, 2s, 3s, or 4s lithium ion battery pack then read my article on 4S lithium Ion Battery Pack. Or if you want to learn how to make lithium Ion Battery packs using BMS.

MLX90614 with ESP8266

Right now, you can see I have powered up the controller board, and it is connected with the Blynk application. You can see the temperature reading in Celsius and Fahrenheit on the Oled display module and also on the gauges in the Blynk application. Now, I can use this IoT temperature monitoring system for monitoring the temperature from any part of the world. I have designed it in a way that when the temperature exceeds 55 Celsius the ESP8266 will also send me a notification message. So, first, let’s go ahead and measure the temperature of different objects, and then we will check the notification part.

Throughout all these tests I will be using the standard emissivity value of 1. Now, let’s go ahead and check the temperature of ICE.

MLX90614 with ESP8266

The MLX90614 is insanely fast, you can see “watch video given at the end of this article” how quickly it measures the temperature.


Next, I measured the temperature of the Marble while the Sunlight was directly falling on the surface.

MLX90614 with ESP8266

It’s May 29, 2022, and the temperature is around 50 Celsius. Due to the Global warning the temperature is really increasing, and we have to do something about it. We have to control the Carbon dioxide emission in the atmosphere which is the major cause of the earth’s increased temperature. Now, let’s measure the temperature of the marble under trees.

MLX90614 with ESP8266

You can see the temperature is around 32 Celsius. We need to plant more and more trees to drop the earth’s temperature.

I also measure the temperature of plants leafs, where the sunlight was directly falling on leafs and I was amazed.

MLX90614 with ESP8266

The only way to drop the earth’s temperature is to plant more and more trees and this will help in decarbonizing the earth’s atmosphere.



Now, let’s go ahead and check the notification message.

MLX90614 with ESP8266

You can see how quickly it sends the notification when the temperature exceeds 55 Celsius… I am sure by now, you might have got an idea of how does this system works. So, without any further delay, let’s get started!!!

Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and Blynk.cloud dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.

 Amazon Links:

Nodemcu ESP8266

ESP32 WiFi + Bluetooth Module

MLX90614 Infrared Temperature Sensor

SSD1306 Oled display Module

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


MLX90614 Infrared Temperature Sensor:

MLX90614 with ESP8266

This sensor consists of four pins as show in the figure.

  • VCC
  • GND
  • SDA
  • SCL

 Specification

SEN0206 (MLX90614-BBC)

  • Operating Voltage: 3.3V – 5V
  • Operating Current: 1.2mA
  • Temperature: -70.01℃ to +382.19℃, (0.01 ℃ resolution)
  • Interface Type: IIC
  • Interface Line Sequence: VCC, GND, SCL, SDA
  • FOV: 35°
  • Dimensions: 31.5*18 mm/1.24 x 0.7 inches

SEN0263 (MLX90614-DCI)

  • Operating Voltage: 3.3V-5V
  • Operating Current: 1.2mA
  • Temperature: -70.01℃ to +270℃,(0.01 ℃ resolution)
  • Interface Type: IIC
  • Interface Line Sequence: VCC,GND,SCL,SDA
  • FOV: 5°
  • Dimensions: 31.5*18mm/1.24 x 0.7 inches


MLX90616 with ESP8266, Circuit Diagram:

MLX90614 with ESP8266

These are the minimal connections that you will need to start with the MLX90614 and ESP8266. You can see no external power supply is added. You can use your laptop or computer to power up all the electronics, you can also use a Lipo battery. But, it’s good to have a voltage regulator which accepts a wide range of input voltages and gives 5V at the output. This way the IoT temperature monitoring system can be powered up using a 12v battery, a solar panel, adaptor, etc. Let me share with you a more detailed circuit diagram.

MLX90614 with ESP8266

On the left side you can see a 5V regulated power supply based on the LM7805 voltage regulator and don’t forget to add these 470uF decoupling capacitors at the input and output sides of the voltage regulator. The output of the regulator is connected with the Vin pin of the Nodemcu ESP8266 WiFi module.

The MLX90614 infrared temperature sensor and SSD1306 Oled display module both are i2c-supported devices. You can see I have connected the SCL pins and SDA pins of both the modules with the SCL and SDA pins of the Nodemcu Module. While the VCC and GND pins of both the modules are connected with the 3.3V and GND pins of the Nodemcu ESP8266 WiFi module.


Nodemcu ESP8266 Development board:

MLX90614 with ESP8266

Here is my development board which I use for testing my IoT-based projects. If you also want to make the same board then you can watch my video tutorial. Now, let’s make the Blynk application for temperature monitoring.

Temperature monitoring, Blynk application:

Blynk is a software company that provides infrastructure for the Internet of Things. In 2014 Blynk pioneered the no-code approach to IoT app building and gained global popularity for its mobile app editor. First of all, we will open the Blynk application and click on the new project

MLX90614 with ESP8266

Then we will select the ESP8266 and give a name to the project. After that, we will insert two gauges one for the Centigrade and other for the Fahrenheit. Remember while creating the blynk application the authentication code is sent on your registered email id. Later you will need that code.



MLX90614 with ESP8266

Then we will click on the Fahrenheit gauge and click on the pin and then select virtual pin V1 and set the range of temperature from 0 to 200.

MLX90614 with ESP8266

Then we will click on the centigrade gauge and in the pin we will select the virtual pin V2 and set the range of temperature from 0 to 200.

MLX90614 with ESP8266

After that, we will click on gallery and insert the notification.

MLX90614 with ESP8266

Now the dashboard is created for the Blynk application.

MLX90614 with ESP8266

First of all, we will install the MLX90614 library for which we will click on the library manager and write MLX90614 and install the library.

MLX90614 with ESP8266

You will also need libraries for the SSD1306 Oled display module.

Download: Adafruit_GFX.h

Download: Adafruit_SSD1306.h


MLX90614 with ESP8266, Programming:

#include <DFRobot_MLX90614.h>
DFRobot_MLX90614_IIC sensor;   // instantiate an object to drive our sensor
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "vAmQgZ1dnfnvLGyb2R7D2S70Dr4J6V29";

 ///Connect SCL to D1 and Connect SDA to D2
/* WiFi credentials */
char ssid[] = "AndroidAP3DEC";
char pass[] = "electroniclinic";
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup()
{
  Serial.begin(115200);
      Blynk.begin(auth, ssid, pass);

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  delay(2000);
  display.clearDisplay();
  display.setTextColor(WHITE);
  // initialize the sensor
  while( NO_ERR != sensor.begin() ){
    Serial.println("Communication with device failed, please check connection");
    delay(3000);
  }
  Serial.println("Begin ok!");

  /**
   * adjust sensor sleep mode
   * mode select to enter or exit sleep mode, it's enter sleep mode by default
   *      true is to enter sleep mode
   *      false is to exit sleep mode (automatically exit sleep mode after power down and restart)
   */
  sensor.enterSleepMode();
  delay(50);
  sensor.enterSleepMode(false);
  delay(200);
//sensor.setEmissivityCorrectionCoefficient(.98);
 
}

void loop()
{
   Blynk.run();
  /**
   * get ambient temperature, unit is Celsius
   * return value range: -40 C ~ 85 C
   */
  float ambientTemp = sensor.getAmbientTempCelsius();

  /**
   * get temperature of object 1, unit is Celsius
   * return value range: -40 C ~ 85 C
   */
  float objectTemp = sensor.getObjectTempCelsius();

  // print measured data in Celsius
  Serial.print("Ambient celsius : "); Serial.print(ambientTemp); Serial.println(" C");
  Serial.print("Object celsius : ");  Serial.print(objectTemp);  Serial.println(" C");
  // print measured data in Fahrenheit
  Serial.print("Ambient fahrenheit : "); Serial.print(ambientTemp*9/5 + 32); Serial.println(" F");
  float ftemp=objectTemp*9/5 + 32;
  Serial.print("Object fahrenheit : ");  Serial.print(ftemp);  Serial.println(" F");

  
display.clearDisplay();
  display.setCursor(25,0);  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.println(" Temperature");
  display.setCursor(10,20);
  display.setTextSize(2);
  //display.print("C: ");
  display.print(objectTemp);
  display.print((char)247);
  display.print("C");
 
  display.setCursor(10,45);
  display.setTextSize(2);
  //display.print("F: ");
  display.print(ftemp);
  display.print((char)247);
  display.print("F");
  
  display.display();
 Blynk.virtualWrite(V2,objectTemp);
Blynk.virtualWrite(V1,ftemp);
 if (objectTemp> 55 )
  {
    Blynk.notify("Temperature Exceeded!!!"); 
  }
delay(1000);
}

Code explanation:

char auth[] = "vAmQgZ1dnfnvLGyb2R7D2S70Dr4J6V29";

This is the authentication code that is generated at the time we make the Blynk application. So, I copied this code from the email and paste it over here.

char ssid[] = "AndroidAP3DEC";

Next, I added the WiFi credentials, this is can be the name of your WiFi router or your cell phone WiFi hotspot.

char pass[] = "electroniclinic";

And this is the password.

The following lines of codes are for the Oled display module.

#define SCREEN_WIDTH 128 // OLED display width, in pixels

#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


Maximum of the code I have already explained in my previous video on the MLX90614, the only difference is that this time apart from displaying the temperature values on the Oled display, I am also sending the temperature values to the Blynk application using virtual pins V1 and V2 which I defined while making the Blynk application.

Blynk.virtualWrite(V2,objectTemp);

Blynk.virtualWrite(V1,ftemp);

 if (objectTemp> 55 )

  {

    Blynk.notify("Temperature Exceeded!!!");

  }

Finally, I added an if condition which checks if the temperature exceeds 55 Celsius then a notification message is sent to the concerned person. I forgot to mention the emissivity value. in the setup() function, I have added this line of code

//sensor.setEmissivityCorrectionCoefficient(.98);

Which you can uncomment to select an emissivity value of your choice. And this way you will be able to measure the temperature of any specific object. I have already demonstrated this in my previous video on the MLX90614 Sensor. So, that is all about the programming. 


Watch Video Tutorial:

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button