HTS221 sensor reading wrong values in MKR IoT Carrier

Hi,

I am using an Arduino MKR IoT carrier.
The temperature sensor HTS221 always gives wrong readings. (Apprximately 5 degree higher readings)

Kindly give a fix for the issue

Kindly post your code and your schematic.

@ajnashukkoor, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

int temperature
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:
temperature = digitalRead(PinMode)-5; //Just Subtracting 5 Degree
                                         //Add assigned PinMode of Sensor here
Serial.print("Temperature:");Serial.println(temperature); //
}

If it really is just 5 degree higher than it should be, this code is just subtracting -5 degree.

From a value that is either LOW or HIGH ?

You are right :stuck_out_tongue:
It should be analogRead here

int temperature
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:
temperature = analogRead(PinMode)-5; //Just Subtracting 5 Degree
                                         //Add assigned PinMode of Sensor here
Serial.print("Temperature:");Serial.println(temperature); //
}```

For an I2C device?

Reading helps just now saw he was talking about the MKR IoT Carrier.
As stated in the reddit post, maybe this will help you:

temperature = carrier.Env.readTemperature(CELSIUS);
Serial.print(temperature);

And if it still is 5 deegrees to high try substracting it if you want the easy fix

But I think subtracting is not a solution. It is not exactly 5 degree difference. It is approximate value as I said.

Is it something like a known issue ?

But it is not exactly 5 degree difference., It is around 5. Cant we do some fix in the library itself.

temperature = carrier.Env.readTemperature();

This is how we read the sensor,

Please check the schematics of the carrier in above link

Why?
Do you think they're incorrect?
What do you think is wrong?

Hi,

You asked for the code and schematics, So i shared them.

Is there anything we can do to solve the wrong temperature issue?