problem with mlx 90614

hello everyone’

i am using mlx 90614 along with 2 resistors on a breadboard.the connections are correct. i am running this code but it shows no reading on display monitor.
<
#include <Wire.h> // I2C library, required for MLX90614
#include <SparkFunMLX90614.h> // SparkFunMLX90614 Arduino library

IRTherm therm; // Create an IRTherm object to interact with throughout

const byte LED_PIN = 8; // Optional LED attached to pin 8 (active low)

void setup()
{
Serial.begin(9600); // Initialize Serial to log output
therm.begin(); // Initialize thermal IR sensor
therm.setUnit(TEMP_F); // Set the library’s units to Farenheit
// Alternatively, TEMP_F can be replaced with TEMP_C for Celsius or
// TEMP_K for Kelvin.

pinMode(LED_PIN, OUTPUT); // LED pin as output
setLED(LOW); // LED OFF
}

void loop()
{
setLED(HIGH); //LED on

// Call therm.read() to read object and ambient temperatures from the sensor.
if (therm.read()) // On success, read() will return 1, on fail 0.
{
// Use the object() and ambient() functions to grab the object and ambient
// temperatures.
// They’ll be floats, calculated out to the unit you set with setUnit().
Serial.print("Object: " + String(therm.object(), 2));
Serial.write(‘°’); // Degree Symbol
Serial.println(“F”);
Serial.print("Ambient: " + String(therm.ambient(), 2));
Serial.write(‘°’); // Degree Symbol
Serial.println(“F”);
Serial.println();
}
setLED(LOW);
delay(500);
}

void setLED(bool on)
{
if (on)
digitalWrite(LED_PIN, LOW);
else
digitalWrite(LED_PIN, HIGH);
}

It’s a good idea to place your code between code tags. They are </> in the ‘Post’ window.
(It’s not too late to edit your post and do it now. :slight_smile: )

Since any serial messages are currently reliant on the success or failure of “therm.read()”, I’d suggest that you print a serial message from setup(), to ensure that communications is working OK, then if that message is printed in the serial monitor, you can go from there.

Alternatively, you could add an ‘else’ to the ‘if’ statement in which you call “therm.read()”, something like:-

else
    Serial.printl("Error: Failed to read thermometer");

Edit: I just did a little testing, and your code seems fine to me, and follows the guidelines on the ‘SparkFun’ site. I’d suggest that you have a better look at how you have everything connected. I haven’t looked closely at connection details, but my bet is on this being a hardware/connection problem.

I simulated most of your program with this, and it works:-

const byte LED_PIN = 13; // Optional LED attached to pin 8 (active low)

void setup()
{
    Serial.begin(9600);
    pinMode(LED_PIN, OUTPUT); // LED pin as output
    setLED(HIGH); //LED on
    if (read())
    {
        Serial.print("Object: " + String(object(), 2));
        Serial.write('°'); // Degree Symbol
        Serial.println("F");
        Serial.print("Ambient: " + String(ambient(), 2));
        Serial.write('°'); // Degree Symbol
        Serial.println("F");
        Serial.println();
    }
}

void loop() {}

float ambient()
{
    return 70.0;
}

float object()
{
    return 120.0;
}

float read()
{
    return true;
}

void setLED(bool on)
{
    if (on)
        digitalWrite(LED_PIN, 1);
    else
        digitalWrite(LED_PIN, 0);
}

I don’t have the thermometer, so just simulated the thermometer functions with ‘read()’, ‘ambient()’ and ‘object()’. If “therm.read()” was working, you’d definitely be getting an output. I inverted the LED state in ‘setLED()’, so I could use the onboard LED. Also left out the line to turn the LED back off and the delay. They’re irrelevant, since I tested in ‘setup()’.
All that fails is your thermometer calls.

sir

in ur coding u hav specifically mentioned the temp to be displayed out but i want the actual readings of ir sensor on monitor display.

I was simulating your code, to show that the code works but the temperature sensor doesn't. Nothing more. I don't have a thermometer, so couldn't connect one. Instead I used simulated (fixed) values. Get it?

Check your connections.