Enviro pHAT - Temperature WAY off

Hi, just installed my first Enviro pHAT. Basically it seems to be working fine, I can get reading, turn Leds on/off etc.

But I wanted to build WLAN thermometers with it. And the temperature reading is way off. At a room temperature of 24C it reports around 36C, generally around 8C above the correct value. It tried the pHat also on three different Raspis (two Zero W, one 3B+), same result.

What could have gone wrong? Is the pHAT defect?

What can happen is the heat from the Pi’s SOC / CPU gets absorbed by the Enviro Phat circuit board. And that will throw off your readings. If thats what’s happening from a cold start it should read normal, then slowly go high as the Pi SOC heats up with use.
If that is the case there are ways around that issue. Mounting the enviro pHat on a phat stack or Mini black hat hacker.

Other options are to put some distance between the Pi and pHat. A proto zero with a stacking header will do it. tape or solder the holes over if you want.

A 90 degree header on the Pi of phat may work too.

It seems your diagnosis is correct. Less than a minute after power-up the temperature is already off by +2C, and then you can watch it climb like it’s placed on a hot oven.
It seems the placement of the sensor on the board is very unfortunate. How can anyone get any sensible reading with that?
Thank you so much for your work around suggestions. I will consider those or using another sensor/board solution with a detached temp sensor.

Thats just how things go sometimes. Your trying to keep the cost down etc and things just don’t work out as planned. Moving the sensor off the board I suspect adds cost and complicates things in another way.
I had the same issue with the Raspberry Pi Foundation Sense hat. I put a Proto hat in between my Pi A+ and Sense hat and it reads accurate. But thats with no case and it flipped 180 so its open on top. GPIO header is on the bottom with it standing up so you can read the Sense hat LED matrix.

Interestingly in many cases moving the sensor off the board doesn’t actually solve the problem- since the copper wires used to connect it are thermally conductive it’s still possible for the PCB to be heated from the Pi.

I think the 1-wire temperature sensors - particularly the ones with a wire and probe setup (look for DS18B20) - are a good solution to this problem and are supported by the Pi.

Other techniques involve using the Pi’s CPU die temperature to compensate the external temperature reading. See: https://medium.com/@InitialState/tutorial-review-enviro-phat-for-raspberry-pi-4cd6d8c63441