Fs2000-sht20 +mega2560

Can someone please assist.
i'm trying to read temperature/humidity data with my mega 2560 + fs2000-sht20 sensor, but all get is the 998 error. also used a 12c check and no 12c was found. however my circuit is sound, i have tried multiple voltage and current inputs between the 3.3 to 5 v range of my sensor. I have used 6 different sensors!!! surely they cannot all be damaged. the pull up resistors and capacitor is imbedded in the sensor itself.

here is a link to the sensor: https://www.amazon.com.be/-/en/FS200-SHT20-Humidity-Temperature-Greenhouse-Nursery/dp/B08RBH3Z6R?language=en_GB

here is my code:

DFRobot_SHT20 sht20(&Wire, SHT20_I2C_ADDR);

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

// Init SHT20 Sensor
sht20.initSHT20();
delay(100);
Serial.println("Sensor init finish!");

/**

  • Check the current status information of SHT20
  • Status information: End of battery, Heater enabled, Disable OTP reload
  • Check result: yes, no
    */
    sht20.checkSHT20();
    }

void loop()
{
/**

  • Read the measured data of air humidity
  • Return the measured air humidity data of float type, unit: %
    */
    float humd = sht20.readHumidity();

/**

  • Read the measured temp data
  • Return the measured temp data of float type, unit: C
    */
    float temp = sht20.readTemperature();

Serial.print("Time:");
Serial.print(millis()); // Get the system time from Arduino
Serial.print(" Temperature:");
Serial.print(temp, 1); // Only print one decimal place
Serial.print("C");
Serial.print(" Humidity:");
Serial.print(humd, 1); // Only print one decimal place
Serial.print("%");
Serial.println();

delay(1000);
}

I have seen many examples of this working. please advise on what is my issue.

First: edit your post and insert code tags!

Post the complete code. At least some include lines are missing to get that compiling!

Post a wiring diagram!

That's a hint that the wiring is wrong or the sensor is bad.

Why are you that sure? Did you get all of them from the nice Chinese over Amazon? All of them may be fake. But that's only to be assumed if you checked the wiring and you're sure you did nothing wrong there.

I also wired it with 3.3V and a current limiting resistor. made no difference to the outcome

my includes are
#include "Wire.h"
#include "DFRobot_SHT20.h"

A4/A5 are not the I2C pins on a Mega. Either use the header pins specifically labeled SCL and SDA, or pins 20(SDA) / 21(SCL).

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