Caibrating Enviro pHAT


In my project, I have the following set up… A python script running every 10 seconds via cron on a Pi. It produces a JSON file which is publicly available via a Node/Express server running on the pi at this endpoint:

Trouble is… the temperature is consistently way off. I’m measuring the actual environment with a digital oven thermometer as 25 °C and the Enviro pHAT is registering 42°C.

  • Is there some way to calibrate the Enviro pHAT?

  • How can I be confident if the other values are actually correct?

There are similar posts here. Search also for Enviro+

Keeping the sensors away from the heat producing parts of the Pi will help - I put mine on the end of a ribbon cable.
However, mine is currently unused as I wanted the sound function and that is still not working (at least was not the last time I looked).

What model Pi is it plugged into? And how is it orientated, facing up, facing forward etc?
Heat given off by the Pi’s SOC / CPU can make the temperature read high. 42c sounds very excessive though? Unless its maybe plugged into a Pi 4B?

A GPIO header extender will help significantly. I also put a fan to blow fresh air on the sensor. Then it was spot on.

@alphanumeric, yup; it is indeed a Pi 4B :)

Ah OK, that explains the 42c then. My Pi 4B runs at ~40c with a Fan Shim on it.
A booster header will help. probably not a whole lot in your case though.
The pins on these are a bit longer than the stock ones for plugging into a female header versus soldering on.

This will work better though, no heat transfer or having to fudge the results with extra code.

And there are other ways, I put a Proto Hat on a stacking header, between my Pi A+ and Sense Hat. It acts like a bit of a heat shield and puts more distance between the two.

The 11mm one, ^^^

I got one of these at Adafruit,
Use a long Ribbon cable with it and you can use those suction cup hooks to stick it to a window. The ones you use for stained glass ornaments.

Something else I’ll just throw out there is, if you don’t need the grunt of a Pi 4, a 3B+ may be a better option, it will generate less heat. Or even a 3A+ if your going to run headless and don’t need more than 1 USB port. All my Motion Eye Camera setups are 3A+'s. Mostly as a cost saving measure over say a 3B+, as they are running headless. And because I found a Zero W just wasn’t up to streaming video at a resolution I wanted. I do like the Zero W, and have many of them in use here, it just wasn’t the right Pi for that job, IMHO anyway.

Here’s mine, measuring garage door status.

  • Uses Y-axis to tell me if the up-n-over door is open or closed.
  • Used light levels to tell me if the garage light has been left on.
  • Uses temp to tell me the temp of the garage.

Every two minutes, all this data is written to an SQL database.

(Excuse the odd perspective, it’s on the door above when the door is open.)
Note EnviroPhat connected remote to the Pi to reduce temp misreadings.

Magic Mirror then reads this and makes this display.

It’s rather cold outside, and so even with the central heating boiler in the garage, it’s clearly showing an incorrect measurement at 11C. I just live with it.

I also have a Scroll pHAT HD scrolling the same results, but that’s not switched on very often.

Thank you, all. Seems clear to me that separating the board from the Pi is the way forward & also given me some new ideas too.
kind regards,

The sound function has been implemented for Enviro+, check GitHub for an updated version of the Python libraries.

Thanks - will do.

(Filler to reach 20 chars)

and it is still empty.

Do you have a link to where the updated version is?

I’m at work at the moment but I’ve got two Python scripts that use the sound function on the Enviro+. I got them from SandyJMacDonald on Discord:

Found it … there is a “noise” branch.