ESP32 temperature reading errors

Hi,
I use Smart Autotune Thermostat HA Integration to control my heating, to try and get the most accurate temperature reading, I’m using a ESP32-WROOM with a Sensirion SHT3x-DIS sensor.

Unfortunately the ESP32 is physically too big to fit in my chosen enclosure, so I bought a ESP32-C6 but this reads +1C above the original ESP32.

Anyone else had this experience?

In my experience all boards and sensors will read slightly different, that is why the filters option exists in esphome.

1 Like

I’ll have to check out the filters, its defo the C6 increasing the temperature, I’ve even used sensors with a ‘thermal moat’ and still reading ambient air temp high.
1 deg high

Might it be self heating inside the enclosure?
Is your sensor exposed to the outside environment via slots that have adequate air flow, while being isolated from the ESP and associated power supply and regulator?

The sensor is calibrated to ‘typical accuracy of ±1.5% relative humidity (RH) and ±0.1°C’ according to the spec sheet.

To what precision are you measuring? Are you rounding? Up/down/ to nearest integer? How many decimal places?

1 Like

The sensor is not in an enclosure and the sensing element is mounted off the board, it’s basically hanging in free air at the height of a standard room thermostat.

I’m measuring to two decimal points and I get a repeatable uplift in temperature displayed on the ESP-C6 when compared to the ESP32 of

I must admit I was surprised, I have 3 high accuracy sensors and wasn’t expecting this discrepancy based on the ESP used.

Is sensor by any chance from aliexpress? If so, there are, from experiences, mostly either UNcalibrated or drop-offs from production, causing pretty various readings. I have a bunch of SHT’s, BME’s, BMP’s… and they can show up to 2 degrees different temperature when comparing.
The problem with such “bad” sensors is that it’s hard to just use filter to compensate, since you don’t know if they are, say “1 degree to high” across whole range. They can show +1 at, say 0 degrees and be accurate or show -1 at 20-30 degrees… I guess we’d have to do whole -20 ÷ -30 range calibration to figure that out.

I wish i could say buy sensor from reputable seller, but i don’t have experience with such purchases (perhaps someone does…), but i guess that ones should be accurate…

1 Like

Cheap sensors sourced from online Asian onlike stores are often factory rejects, abandoned as unable to be calibrated properly.

Source your sensors, if you want temperature accurate to a thousandth of a degree, from reputable suppliers such as Mouser, Element 14, etc.

The difference in timing signals on the I2C bus, along with ESP crystal speeds of different boards may be the discrepancy in software timing loops in the device driver may be what you are seeing instead of actual temperature calibration values. Sensing windows that are centred on older chips may be on outer limits on faster chips, giving incorrect results. How is your device driver debugging skills?

1 Like

I expect that you have I2C interface, not analog voltage output.
I2C is digital output so the bytes it throws out are the same independently what board is reading them. So if your espconfig is exactly same, there should not be consistent temperature difference. But the sensor needs correct and stable power supply , I would investigate how is yours.

ps. verify your readings directly from esphome logs.

1 Like

Where does the sensor take the I2C timing from?

1 Like

Hi,

I bought it from a UK seller SHT35, I’ve now applied a filter of -0.9 to get it to align with a consensus of measurement devices.

1 Like

I will swop the power supplies over to see if that has any effect, good call.

SeeedStudio, although Chinese, are reputable manufacturers of your sensor, and it appears they have included the relevant power supply smoothing filter capacitor on their board.
Software issues is my guess, from rounding and variable choices and the algorithm you are using to get and display your data with sufficient resolution.

1 Like

Are both sensor on the same location? There can be numerous things which could affect temperature, like sensor being too close to the wall, sensor above anything which is powered and can produce heat (even small)… for example i have 3 sensors for outside temperature. Now in the winter the one which is appr. 30-40cm from outside house wall reads up to 3 degrees higher than one on the open. It really doesn’t take much to produce 1 degree error. I’d position sensor to vaious places and observe…

1 Like

Look at section 4.10 Heater of the spec. This could be the source of the error you’re getting. If you have access to the raw data, check to see if it is being converted correctly. see 4.13 Conversion of Signal Output (Libraries are not always perfect)

Reading the data sheet I see:

  • SHT31 is +/- 0.2C over 0 to 90
  • SHT30 is +/- 0.2C over 0 to 65
  • SHT35 is +/- 0.1C over 20 to 90
    The '35 is out of spec in a home environment as most homes are not kept in that range. But most homes are kept above freezing :wink: so with the device which you should be using, your accuracy is 0.2C.

Because the reading is converted to digital by the SHT3x chip, I don’t think the processor used will have an effect on the reading.unless the libraries are different.

You could try averaging many readings, but I don’t think this will make a difference.

2 Likes

I thought I was exception, not having money enough to heat my house up to 20’C. :sweat_smile:
Anyway there’s linear slope from 0 to 20’C (0.2 to 0.1), so someone at 17 degrees still have 0.115’C accuracy

1 Like

Both sensors are about 25mm apart in free air, as it is I’ve offset the ESP-C6 by -0.8C and its very close now to the ESP even though that sensor seems more reactive.

Heat is my luxury item :slight_smile:

Setback is 17C, Home setting 19.5C and when sedentary 21.5C

Ahh, so you have two different sensors. Swap them and see how it goes.
Also, there is no offset present on your image, low temp readings are almost same.

I did swop the sensors and also the power supplies and the esp consistently read higher than the espc6.

The graphed temperature for the expc6 has had the offset applied and the display is the result.

It’s near enough for my needs now.

What was your first sensor again? Second one is SHT3x, connected to C6, correct? But what’s the first one (marked “Hall”)?

But, regarding sensors: i used to use BME280, SHT3x…widely, too. But now i’m more and more dumping them and changing with battery-operated BLE/ZB sensors. They are very precise (so far up to 0.1 degree), they are wireless, so you can really put them anywhere and i get temp/humidity in HA. Currently i use Xiaomi’s LYWSD03MMC and bigger MJWSD05MMC; and i just got one Shelly BLU H&M display. I change battery once or twice a year and that’s it’.