I am connecting my MLX90614 sensor in I2C bus with 16x02 lcd. I used Adafruit library, I2C LCD library and Wire.h.
When I uploaded the code, the lcd displays weird numbers and letters that I didn't expect. I scan first using I2C Scanner and it found an address of "90" or "0x5A" and upload the code again. This time, it works perfectly fine. The lcd display what I want to see.
HOWEVER, when I want to change the power supply from USB cord (I can't bring my laptop all around) into power adapter. I remove the USB cord and insert the barrel jack, reset the UNO hoping to read the code again. This time, the LCD is displaying weird again. I think, the MLX90614 address wasn't recognize/found by my UNO R3.
If you please, HELP me with this? Your advice is so much appreciated. Thank you so much.
No I haven't change the sensor address, its just the UNO can't retain the mlx90614 address after disconnecting the USB cord to insert a barrel jack as new power supply when I reset the UNO.
That temperature looks uncomfortably high.
Post all your code, a diagram of how it is all connected together and state what power supply (voltage etc.) your are connecting to the Uno when not using your laptop.
After I uploaded the code above, the monitor displays different readings (i.e. Object = 1037.55*C). However, if I upload the I2C scanner first and detect its adress and upload the code again from Adafruit, it works perfectly fine.
If I plug out the USB cord from laptop and plug in again and hit reset, the sensor displays different reading again (i.e. Object = 1037.55*C). Its seems that I need to scan first before I upload the code from Adafruit.
To me, it looks like you need 10k pullps between the I2C lines and the 3.3 volt power source for your sensor.
You spoke earlier about an I2C LCD display. Is that also 3volt or is it 5 volt ?
If you mix different voltages on an I2C bus, you should use a level shifter.
Ok. If the 3.3volt module you are using (provide a link to this) already has I2C pull up resistors, you don’t need to add any. These are needed to so the lines don’t float and can pulled hard down during communication.
However, since the Uno is a 5volt device, you should really use an I2C level shifter for connecting 3.3volt devices to its I2C bus.
I suppose you could also, as a test, copy the main part of the I2C scanner code into setup() in your test sketch to see if that helps to isolate the problem.
iamphysics:
I copy the code of the i2c scanner in the void setup() and void loop(), but the mlx90614 sensor doesn't give the data correctly.
Use this code and see what the monitor says, use 115200 baud.
// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
#include <Wire.h>
void setup() {
Serial.begin (115200);
// Wire.begin(4, 15);
pinMode(16, OUTPUT);
digitalWrite(16, LOW);
delay(50);
digitalWrite(16, HIGH);
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
for (byte i = 8; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
} // end of setup
void loop() {}
It will only run once, so press reset on the controller board to run it each time.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you post a picture of your project so we can see your component layout?