contactless smart ir thermometer with android

Kugan Subramaniam's picture

Offline

Joined: May 14, 2021

Replies: 1
contactless smart ir thermometer with android
May 19, 2021 - 1:59am

sir. i use mlx90614. i edited some codes based on the mlx90614 library. but the serial monitor show 'position error' only. here i attached the codes. is it correct? why it just shows position error?

float error_correction  = 3.5; //add this to actual value
int Range_sensitivity = 200; //Decrease this value to increase range 
#include <Wire.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup()
{
Serial.begin(9600);
delay(100);
while (! Serial);
pinMode(2,OUTPUT);
mlx.begin();
}
int Noise;
int Signal;
int Noise_P_Signal;
boolean trigger = true;
float temperature;
float pvs_temperature;
void loop()
{
digitalWrite(2,HIGH);    // Turn on IR LED
delayMicroseconds(500);  // Forward rise time of IR LED
Noise_P_Signal=analogRead(A7);        // Read value from A0 => noise+signal
digitalWrite(2,LOW);     // Turn off IR LED
delayMicroseconds(500);  // Fall time of IR LED
Noise=analogRead(A7);        // Read value from A0 => noise only
Signal = Noise - Noise_P_Signal;
//Serial.print("Noise + Signal = "); Serial.println(Noise_P_Signal);
//Serial.print("Noise ="); Serial.println(Noise);
//Serial.print ("--> Signal ="); Serial.println (Signal);
//temperature = (mlx.readObjectTempC()) + error_correction;
//Serial.println(temperature,1);
//delay(100);
if (Signal>Range_sensitivity && Noise >500) //dec. signal to increase rage

  if (trigger == true)
   Serial.println("start");
   digitalWrite(2,LOW); //Turn off IR sensor to avoid interferance. 
   for (int i=1; i<=3; i++)
   {
   temperature = (mlx.readObjectTempC()) + error_correction;
   Serial.println(temperature,1);
   delay(150);
   }
  trigger = false; 
}
else
{
  delay(100);
  trigger = true;
  digitalWrite(13,LOW);
  Serial.println("position_error");
}
}

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 632

Place the sensor properly otherwise it will say the position error.