0

I have testing for mlx90614 library (https://github.com/stevemarple/MLX90614) for my Arduino uno, with this demo codes:

#include <AsyncDelay.h>
#include <SoftWire.h>
#include <MLX90614.h>

#ifdef JTD
#include <DisableJTAG.h>
#endif

MLX90614 mlx90614;
AsyncDelay samplingInterval;

inline float convertToDegC(int16_t data)
{
  return (data / 100.0);
}

void setup(void)
{
  Serial.begin(9600);
  Serial.println("MLX90614_demo");
#ifdef JTD
  disableJTAG();
#endif
  mlx90614.initialise();
  mlx90614.getSoftWire().setDelay_us(2);
  samplingInterval.start(1000, AsyncDelay::MILLIS);
}

bool printed = true;
void loop(void)
{
  if (samplingInterval.isExpired() && !mlx90614.isSampling()) {
    mlx90614.start();
    printed = false;
    samplingInterval.repeat();
    Serial.println("Sampling started");
  }

  mlx90614.process();

  if (mlx90614.isFinished() && !printed) {
    printed = true;
    // Print saved values
    Serial.print("Ambient: ");
    Serial.print(convertToDegC(mlx90614.getAmbient()));
    Serial.print("    Object 1: ");
    Serial.print(convertToDegC(mlx90614.getObject1()));
    if (mlx90614.isDualSensor()) {
      Serial.print("Object 2: ");
      Serial.print(convertToDegC(mlx90614.getObject2()));
    }
    Serial.println();
  }

}

so i get this error in compiling it's codes:

Compiling libraries...
Compiling library "AsyncDelay"
Compiling library "SoftWire"
/opt/arduino-1.8.9/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/opt/arduino-1.8.9/hardware/arduino/avr/cores/arduino -I/opt/arduino-1.8.9/hardware/arduino/avr/variants/standard -I/home/so/Arduino/libraries/AsyncDelay/src -I/home/so/Arduino/libraries/SoftWire/src -I/home/so/Arduino/libraries/MLX90614/src /home/so/Arduino/libraries/SoftWire/src/SoftWire.cpp -o /tmp/arduino_build_742952/libraries/SoftWire/SoftWire.cpp.o
Compiling library "MLX90614"
/opt/arduino-1.8.9/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/opt/arduino-1.8.9/hardware/arduino/avr/cores/arduino -I/opt/arduino-1.8.9/hardware/arduino/avr/variants/standard -I/home/so/Arduino/libraries/AsyncDelay/src -I/home/so/Arduino/libraries/SoftWire/src -I/home/so/Arduino/libraries/MLX90614/src /home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp -o /tmp/arduino_build_742952/libraries/MLX90614/MLX90614.cpp.o
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp: In member function 'void MLX90614::start()':
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:58:9: error: 'class SoftWire' has no member named 'setSdaHigh'
     i2c.setSdaHigh();
         ^
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:59:9: error: 'class SoftWire' has no member named 'setSclHigh'
     i2c.setSclHigh();
         ^
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp: In member function 'void MLX90614::process()':
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:75:11: error: 'class SoftWire' has no member named 'setSclLow'
       i2c.setSclLow();
           ^
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:83:11: error: 'class SoftWire' has no member named 'setSclHigh'
       i2c.setSclHigh();
           ^
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp: In member function 'void MLX90614::finish()':
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:138:7: error: 'class SoftWire' has no member named 'setSdaHigh'
   i2c.setSdaHigh();
       ^
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:139:7: error: 'class SoftWire' has no member named 'setSclHigh'
   i2c.setSclHigh();
       ^
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp: In member function 'bool MLX90614::read(uint8_t, uint16_t&) const':
/home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:154:24: warning: passing 'const SoftWire' as 'this' argument discards qualifiers [-fpermissive]
       i2c.write(command) || // Command sent
                        ^
In file included from /home/so/Arduino/libraries/MLX90614/src/MLX90614.h:8:0,
                 from /home/so/Arduino/libraries/MLX90614/src/MLX90614.cpp:1:
/home/so/Arduino/libraries/SoftWire/src/SoftWire.h:112:20: note:   in call to 'virtual size_t SoftWire::write(uint8_t)'
     virtual size_t write(uint8_t data);
                    ^
Using library AsyncDelay at version 1.1.0 in folder: /home/so/Arduino/libraries/AsyncDelay 
Using library SoftWire at version 2.0.0 in folder: /home/so/Arduino/libraries/SoftWire 
Using library MLX90614 at version 0.1.3 in folder: /home/so/Arduino/libraries/MLX90614 
exit status 1
Error compiling for board Arduino/Genuino Uno.

So why this happened?

Update:

With this other library with this link instruction for this connections: enter image description here and codes:

/*************************************************** 
  This is a library example for the MLX90614 Temp Sensor

  Designed specifically to work with the MLX90614 sensors in the
  adafruit shop
  ----> https://www.adafruit.com/products/1747 3V version
  ----> https://www.adafruit.com/products/1748 5V version

  These sensors use I2C to communicate, 2 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  Serial.begin(9600);

  Serial.println("Adafruit MLX90614 test");  

  mlx.begin();  
}

void loop() {
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); 
  Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); 
  Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");

  Serial.println();
  delay(500);
}

i get this output which don't changed when i disconnecting the SDA,SCL wires form mlx90614:


Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F Object = 1899.59*F

Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F Object = 1899.59*F

Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F Object = 1899.59*F

Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F Object = 1899.59*F

Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F Object = 1899.59*F

Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F Object = 1899.59*F

Ambient = 1037.55*C Object = 1037.55*C
Ambient = 1899.59*F

i have bought my mlx90614 from this site: enter image description here

which have this laser mark on it ;B90453X12E like this ( w w w . translate.google. c o m/translate?sl=auto&tl=en&u=https%3A%2F%2Fvoron.ua%2Fcatalog%2F027374) :

in it's datasheet ( w w w . melexis. c o m/-/media/files/documents/datasheets/mlx90614-datasheet-melexis.pdf) said about laser mark:

16.7. Part marking The MLX90614 is laser marked with 10 symbols. First 3 letters define device version (AAA, BCC, etc), and the last 7 are the lot number. Example: “ACC9307308” – MLX90614ACC from lot 9307308.

but this laser mark is started with B90 and not means any more based of this instruction, i guess that i have connected the mlx90614 power supply to 5V according the seller site writes characteristic for mlx90614 (MLX90614ESF-AAA) type AAA but it's type must not be MLX90614ESF-AAA and maybe i must use 3.3V for power supply and it burned by over-voltage, but according to datasheet it must tolerate based of this table:

enter image description here

Update by using the I2C Scanner example:

I have used The I 2C Scanner example of Arduino and changed it for address of mlx90614 (0x5A)by this codes:

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not known.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();
  Wire.setClock(100000);  //set I2c clock to 100KHZ
  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
//  for(address = 1; address < 127; address++ ) 
if(1) 
  {
    address=0x5A;
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    Serial.print("error:");Serial.print(error);Serial.print("   ");

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknow error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

And i get this output:

Scanning...
error:2   No I2C devices found

Scanning...
error:2   No I2C devices found

Scanning...
error:2   No I2C devices found

Scanning...
error:4   Unknow error at address 0x5A
No I2C devices found

Scanning...
error:2   No I2C devices found

According the arduino web site the 2 error code means:

byte, which indicates the status of the transmission:

0:success 1:data too long to fit in transmit buffer 2:received NACK on transmit of address 3:received NACK on transmit of data 4:other error

So it means it don't give me any respond to it's defualt I2C Address, but with defualt I2C Scanner exmaple which scan from Adress 0X50 untill 0x7F i get this output :


I2C Scanner
Scanning...
Unknown error at address 0x54
Unknown error at address 0x57
Unknown error at address 0x5A
Unknown error at address 0x5B
I2C device found at address 0x5D  !
Unknown error at address 0x60
Unknown error at address 0x63
Unknown error at address 0x66
Unknown error at address 0x69
I2C device found at address 0x6A  !
Unknown error at address 0x6C
Unknown error at address 0x6F
Unknown error at address 0x72
Unknown error at address 0x75
Unknown error at address 0x78
Unknown error at address 0x7A
Unknown error at address 0x7D
done

Scanning...
Unknown error at address 0x52
Unknown error at address 0x55
Unknown error at address 0x57
Unknown error at address 0x5A
Unknown error at address 0x5D
I2C device found at address 0x60  !
Unknown error at address 0x63
Unknown error at address 0x64
Unknown error at address 0x67
Unknown error at address 0x6A
Unknown error at address 0x6D
Unknown error at address 0x70
Unknown error at address 0x71
Unknown error at address 0x74
Unknown error at address 0x77
Unknown error at address 0x7A
Unknown error at address 0x7D

SO why it give some response on none registered I2C Address, Dose it because of noise?

So what can i do? Must i buy another mlx90614 from that type and test with 3.3V?

Thanks.

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.