0

I want to make sure the sensor read normally but when i run it to read the object temperature, the result is 382.19°C. I have search for tutorials, and also the error but i couldn't find it except for emissivity. The board I am using right now is ESP8266 Nodemcu Lolin

And this is the code

#define INTERVAL  1000
#include <Wire.h>
#include <IR_Thermometer_Sensor_MLX90614.h>



IR_Thermometer_Sensor_MLX90614 mlx = IR_Thermometer_Sensor_MLX90614();


float T_ambient,T_object;
unsigned long int timer;


void setup()
{
  Serial.begin(115200);
  mlx.begin(); 
}

void loop()
{
  if(millis()-timer>=INTERVAL)
  {
    timer=millis();
    T_ambient=mlx.GetAmbientTemp_Celsius();
    T_object=mlx.GetObjectTemp_Celsius();

    Serial.println("Ambien = "+String (T_ambient));
    Serial.println("Object = " +String (T_object));
  }
  delay(1);
}

enter image description here

Thank You

13
  • This is typically the sign that there’s a communication problem. Either there is a physical wiring issue, or you are not using the right pins. How is the sensor connected, and what pins are you using?
    – jcaron
    Oct 26, 2021 at 20:45
  • Hi @jcaron, the pin i am using right now is scl to d1, sda to d2, vin to 3v3 and gnd to gnd
    – Abraham
    Oct 26, 2021 at 21:51
  • Did you check if you sensor is a 3.3V version and not a 5V version? This is defined by the first letter after "SF" in the reference (A=5V, B=3V). Even though the pins you use should be the default for for an ESP8266 Nodemcu, you may want to specify them explicitly. Also, is the sensor brand new, or is it possible someone changed the address or other settings?
    – jcaron
    Oct 29, 2021 at 8:36
  • Actually, communication is probably functional, the sensor is just returning the max possible value for the object temp most of the time (but not always). I'd still check for a possible voltage issue.
    – jcaron
    Oct 29, 2021 at 8:52
  • It seems to get you the right ambient temperature ? What is the object temperature you're expecting ? Do you have some other measurement device to confirm/refute the 382C reading ? Oct 30, 2021 at 1:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.