Arduino Forum

Topics => Science and Measurement => Topic started by: lucian_d92 on Mar 19, 2020, 05:17 pm

Title: Arduino Uno + IR Temperature (MCU96015)
Post by: lucian_d92 on Mar 19, 2020, 05:17 pm
Hello.
I ran into a dead end for a n00b. I have a mcu-96015 IR temperature sensor, with serial interface (rx&tx pins) and would want to use it on the arduino, displaying the temperature on a 16x2 lcd (interfaced through i2c).
Sensor reading works good on serial monitor, the lcd display works well for other projects, but i don't know how to put these three together. I was hoping you guys know more than i do, so i will attach the sketch i use for displaying temperature on the serial monitor.

Code: [Select]

/********************************
  Conexiuni:
Senzor VCC -> Arduino 5V
Senzor GND -> Arduino GND
Senzor Rx  -> Arduino 11
Senzor Tx  -> Arduino 10

Serial port:
Set serial monitor baud rate to 57600

 ********************************/


#include<SoftwareSerial.h>
SoftwareSerial mySerial(10,11);
unsigned char output[9];
unsigned char need[2];

void setup()
{
  Serial.begin(57600);
  while(!Serial){
    ; 
  }
  mySerial.begin(115200);
  mySerial.write(0xA5);
  mySerial.write(0x45);
  mySerial.write(0xEA);

}

void loop()
{
  if(mySerial.available()){
    Serial.print("Taking Readings");
    for(int counter=0;counter<=8;counter++){
      output[counter] = (unsigned char)mySerial.read();
      Serial.print(".");
    }
    for(int obj=0;obj<=8;obj++){
      if(output[obj]==0x5A){
        need[0] = output[obj+4];
        need[1] = output[obj+5];
        float temp = (float)(need[0] << 8 | need[1])/100;
        Serial.println();
        Serial.println("Temperature is: ");
        Serial.println(temp);
        obj = 8;
      }
      else{//No need to do anything} 
    }
    delay(500);
    }
  }
}
Title: Re: Arduino Uno + IR Temperature (MCU96015)
Post by: wildbill on Mar 21, 2020, 02:06 pm
Not much anyone can do without the LCD code. What have you tried?

You may want to revisit the code you posted too. It relies on a common misconception: Just because serial.available tells you that there is data to be read does not mean that all of it has arrived.
Title: Re: Arduino Uno + IR Temperature (MCU96015)
Post by: lucian_d92 on Mar 21, 2020, 05:17 pm
Not much anyone can do without the LCD code. What have you tried?

You may want to revisit the code you posted too. It relies on a common misconception: Just because serial.available tells you that there is data to be read does not mean that all of it has arrived.
That would be the code the sensor manufacturer provided, and it works very good on the serial monitor. I just want it to display that info on the lcd. This is the demo i2c lcd code which works (i use a 16x2 one):

Code: [Select]

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
   lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
   lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}
Title: Re: Arduino Uno + IR Temperature (MCU96015)
Post by: lucian_d92 on Apr 01, 2020, 01:58 pm
No one can help me? :/
Title: Re: Arduino Uno + IR Temperature (MCU96015)
Post by: wildbill on Apr 01, 2020, 02:24 pm
The premise with most areas of the forum is that you make an attempt to solve your problem and ask for guidance when you get stuck.

If, as in this case apparently, you would prefer someone else to do the work, there is the gigs and collaborations forum where you may be able to find a person to do it for payment.

You can click the report to moderator link and ask to have your thread moved there.