Go Down

Topic: A problem with MLX90614BAA and the wire library (Read 513 times) previous topic - next topic

LMI1

I have been trying to get my sketch to connect to this thermopile sensor without luck. There is no response from chip. The sketch uses somekind of modified I2C bus, so I use the wire linrary.
Can you help?

Code: [Select]
#include <Wire.h>

// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


//#include <Wire.h>
  char c;
  int aasi;
void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  Serial.println("moi"); 
  delay(4000);
  aasi=0;
}

void loop()
{
 // Wire.requestFrom(aasi, 5);    // oso data
 Wire.requestFrom(0x9, 3);    // oso data
  while(Wire.available())    // slave may send less than requested
  {
    c = Wire.read(); // receive a byte as character
  //  Serial.write(c);         // print the character
 //   Serial.println();
  //  Serial.print(c);
    Serial.print(c, HEX);// gives "4E"
    if (c!=255)
    {
     Serial.println();
      Serial.println("osui");
     // delay(4000); 
    }
        Serial.println();
         Serial.print("aasi opso on ");
 Serial.print(aasi);
  Serial.println();
      }
Serial.println("m");
 // delay(1000);
  aasi++;
  if (aasi==124)
  {
    aasi=0;
  }
}


This is what I get: no response from the chip.
Code: [Select]
aámoi
0
osui

aasi opso on 0
0
osui

aasi opso on 0
0
osui

aasi opso on 0
m
0
osui

aasi opso on 1
0
osui

aasi opso on 1
0
osui

aasi opso on 1
m
0
osui

aasi opso on 2
0
osui

aasi opso on 2
0
osui

osui

aasi opso on 7
0
osui
 


Edit2: I checked this with an oscilloscope. There are clock pulses and data from the DUE on the I2C lines.

casanova895

Saludos
plate you want to connect ?
I2C communication works on two levels the sensor plate 3v and 5V
I have the same problem
I am using arduino pro mini 5v
http://forum.arduino.cc/index.php?topic=409836.0

LMI1

Hi

I found two solutions or libraries. One for 5V  Arduino and the other for Due. I think one was from Adafruit and one from Sparkfun. But I dont remember what was what.

Go Up