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?

It seems that the temperature sensor give a wrong measurement due to the heat dissipated by the carrier board itself. If you switch on the Arduino IOT you can see that temperature readings give right values (very close to the real ambient temperature) but the temperature value grows up quickly and at the end it will be 3.5-4 °C higher than the initial value. Supposing that the environment temperature doesn't change in that short time we have an estimation of the measurement error. Maybe this error could be greater if you are using a case for the IOT carrier. The only way to solve the problem is to estimate the error (also by a comparison with another thermometer) and subtract the difference by software like:

temperature = carrier.Env.readTemperature() - 3.5;

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