AMG8833 with Nodemcu not reading temperature

#include <Wire.h>

void setup() {
  Wire.begin(D4, D3);
  Serial.begin(115200);
  while (!Serial); // Wait for Serial to initialize
  Serial.println("\nI2C Scanner");
  Wire.setClock(400000); // Set I2C frequency to 400kHz
}

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

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

  nDevices = 0;
  for (address = 1; address < 127; address++) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    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("Unknown 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 before next scan
}

The Above Code works properly and output I2C device found at address 0x69

But the example 'amg88xx_test' does not works and output shown is

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00042e10
~ld
⸮⸮⸮⸮o⸮{⸮⸮n|⸮ d⸮$`c⸮ ⸮|;⸮l⸮n⸮⸮n⸮
AMG88xx test
Could not find a valid AMG88xx sensor, check wiring!

Could I get help to solve this issue?

It would be a good idea to post that code also, and tell the forum where/how you installed the library.

Thank you for your quick response.
here is the code:

#include <Wire.h>
#include <Adafruit_AMG88xx.h>

Adafruit_AMG88xx amg;

void setup() {
    Wire.begin(D4,D3);
    Serial.begin(9600);
    Serial.println(F("AMG88xx test"));

    bool status;
    
    // default settings
    status = amg.begin();
    if (!status) {
        Serial.println("Could not find a valid AMG88xx sensor, check wiring!");
        while (1);
    }
    
    Serial.println("-- Thermistor Test --");

    Serial.println();

    delay(100); // let sensor boot up
}


void loop() { 
    Serial.print("Thermistor Temperature = ");
    Serial.print(amg.readThermistor());
    Serial.println(" *C");
  
    Serial.println();

    //delay a second
    delay(1000);
}

I installed the libarary through ardiuno ide>Tools> Manage Libraries> Searched for 'Adafruit_AMG88xx'> Downloaded version 1.3.2

If you change this to

  while (1) yield();

It should remove the watchdog errors you are getting. But it won't fix the problem that the amg.begin() call is failing. I don't know what is causing that. We know from i2c scanner that the device is visible on the bus.

I would do what the code suggest. Control that your wiring is short and solid.

I think if there was a problem with the wiring, the i2c scanner would not successfully detect the sensor.

Yep, except if wiring is flimsy.

Try adding this line at the top of your code

#define DEBUG_SERIAL Serial

to see what appears in serial monitor.

Thank you for your replies. I got my problem fixed by changing library from adafruit to sparkfun.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.