Enviro+ wrong temperature/humidity readings

Hello Good People !

My setup is simple: A naked RPi B+ with an Enviro+ right on top of it, with the particle sensor connected to it. All in the open air outside. All properly connected.

However, the temperature and humidity readings are off. The proof the readings is that another sensor, connected at the end of a long usb cable, is measuring a much more likely temperature and humidity. 24 degrees instead of 31. 52% humidity instead of 34%. I am pretty certain it’s not 31 degrees outside. :-)

My conviction is that the Enviro is picking up the RPi board temperature due to its too close proximity. Because it starts at the right temperature, but rises quickly to +30 degrees. The humidity follows the usual mirrored curve compared to the temperature.

Ive tried various insulated materials and positions to avoid the heat getting to the enviro. The best result is to get the RPi out of its case and put it vertically. But it’s still measuring way too hot and way too dry.

I guess this must be a quite common issue. Or is it ?

Any idea if the other readings can be off too ? The atmospheric pressure is correct.

It is a not uncommon issue. I suffer the same thing with my Sense Hat. I put a Proto Hat mounted on a stacking header between my Pi A+ and Sense Hat and it helped a lot.
A Proto Zero would likely help.


Or a Mini Black Hat

Or a pHat Stack

If you buy the solder yourself version you can get creative and swap header types so you can plug a Pi Zero in and skip using the ribbon cable. I used a female 90 soldered to the bottom of my Pi Zero. I can plug it into the Mini Black hat Hacker where the ribbon cable would normally plug in. It’s pointing up with all the ports pointing up. It maks it easy to plug in the power supply and other cables.

is there a way to do this with cables only ? I’m a bit new to this stuff :-)

Yes, if you use the female to male jumpers.

And connect up the following pins.

Another way to do it is to just compensate for the heat soak with a code change.
You need an accurate reference to do that though.

2 Likes

That should be within my capabilities. :-) Thx !

I wonder, are there 40pin male/male connectors to stick into a flat cable ?

Be careful trying that, it can flip the rows and you’ll end up with Pin 1 going to Pin 2 and vice versa, bad things will happen. There are male to female ribbon cables out there though. I’ve seen them posted on the Pi foundation forum.

You could solder two male headers onto this, both pointing up and use it with a ribbon cable. It will change one end to be Male instead of female and keep the pins the correct way.


Plug the cable into one header and the enviro into the other, just like its done with the phat Stack.

My preference would definitely go to a male/female flat cable. I’m no soldering hero.

I very much appreciate the help btw.

Something like this should work then. You’ll want to double check that Pin 1 on the Pi is going to pin 1 on the Hat before you power it up.

That’s just perfect ! :-)

Greetings. I am having similar issue. I have Enviro sitting remote right next to the Sense HAT. The Sense hat is on a Pi 3 stack with a plate between as seen in photos. I have also included a readings shot as the sensors are being read. The differences in humidity and temp are quite a bit. Any ideas on what could be causing this?

Here is the other shot.

I have the same issue. Directly attached to a pi zero I get normal temp and humidity readings, but when I attach it to a pi4 via an 8" GPIO cable I get very bad readings - for example it reads 10C in a room that is about 20C. Since the cable puts the board quite far from the pi this is not a heat issue.

1 Like

Which script are you running? Some of the Pimoroni examples compensate for the CPU temperature, so it might be doing that even though the sensor isn’t anywhere near it.

1 Like

Good point @Shoe. I have an Enviro Example I’m going to try running on a Breakout Garden setup. It’s all mounted on a pHat Stack so I will need to remove the temp comp code.

Thanks for all the replies here is some of the code the executing on the Sense, Enviro-Indoor and for a an LM35 and DHT11 from a Mega 2560. Three temperature reads from Sense, either Pressure sensor, Humidty Sensor or Primary. The Primary and Humidity are almost always equal but occasionally differ slightly. That might be just a timing issue between readings. The closest temp between Sense and Enviro is Pressure temperature reading from Sense. But they do seem to be close enough for me at this point. I think I will get a single BME280, a DHT22 and that Dallas 1855? temp sensor and get those all going to see how much each differs.

The Pressure reading are very close between Sense and Enviro so I guess I can count on those, but the humidity readings appear quite a bit different. What is up there? And which one should i have the most confidence in, specifically regarding humidity?

At this time:
Sense = 44.5
Enviro = 28.5
DHT11 = 33

The LM35 temp is always two or three degrees below the rest and the DHT11 temp matches closest with Enviro.

Sense:
from sense_hat import SenseHat
sense = SenseHat()
sense.clear()
sense.set_imu_config(True, True, True)
tempC_hum = sense.get_temperature_from_humidity()
tempC_hum = round(tempC_hum,1)
tempF_hum = 1.8 * tempC_hum + 32
tempF_hum = round(tempF_hum, 1)
print(“Temp. Hum C/F:”,tempC_hum,"/",tempF_hum)

tempC = sense.get_temperature()
tempC = round(tempC, 1)
tempF = 1.8 * tempC + 32
tempF = round(tempF, 1)
print(“Temp. Prm C/F:”,tempC,"/",tempF)

tempC_pre = sense.get_temperature_from_pressure()
tempC_pre = round(tempC_pre,1)
tempF_pre = 1.8 * tempC_pre + 32
tempF_pre = round(tempF_pre, 1)
print(“Temp. Pre C/F:”,tempC_pre,"/",tempF_pre)

humidity = sense.get_humidity()
humidity = round(humidity, 2)
print(“Humidity:”,humidity)

pressure = sense.get_pressure()
pressure = round(pressure, 2)
print(“Pressure:”,pressure)

Enviro-Indoor:
from bme280 import BME280
from smbus2 import SMBus
bus = SMBus(1)
bme280 = BME280(i2c_dev=bus)

tempC = bme280.get_temperature()
tempC = round(tempC, 1)
tempF = 1.8 * round(tempC, 1) + 32
tempF = round(tempF, 1)
print(“Temp. C/F:”,tempC,"/",tempF)

humidity = bme280.get_humidity()
humidity = round(humidity, 2)
print(“Humidity:”,humidity)

pressure = bme280.get_pressure()
pressure = round(pressure, 2)
print(“Pressure:”,pressure)

Arduino:
#include <dht.h>
dht DHT;
#define DHT11_PIN 4

int potPin = 0; // initialize analog pin 0 for LM35 temperature sensor
int LM35sig=analogRead(0);//
int LM35tempC=(125LM35sig)>>8;//
int LM35tempF=(LM35tempC
1.8)+32; //f
Serial.print("LM35 Temp. C/F: “);//
Serial.print(LM35tempC);//
Serial.print(” / ");
Serial.println(LM35tempF);

int chk = DHT.read11(DHT11_PIN);
int DHT11tempC = DHT.temperature;
int DHT11tempF = (DHT11tempC*1.8)+32;
Serial.print("DHT11 Temp. C/F: “);
Serial.print(DHT11tempC);
Serial.print(” / ");
Serial.println(DHT11tempF);

int DHT11hum = DHT.humidity;
Serial.print("DHT11 Humidity: ");
Serial.println(DHT11hum);

I thought there were only two temp sensors on the Sense Hat? One in the pressure sensor and one in the humidity sensor. And if you don’t specify one or the other it just defaults to the one in the humidity sensor. I run code on mine that displays the info on its LED Matrix. I have a Proto Hat between my Pi A+ and the sense hat. It blocks the heat given off by the Pi and puts some extra distance between them. I don’t bother doing any kind of compensation. It’s not a bad idea, I just don’t figure I need to do it with my setup.
My temperature on it seems pretty reliable and accurate. It compares well with some BME680’s I have setup. I don’t own an Enviro, so can’t comment on it.

import os
import time, datetime
from sense_hat import SenseHat, ACTION_PRESSED, ACTION_HELD, ACTION_RELEASED
        
sense = SenseHat()
sense.set_rotation(180)
sense.set_imu_config(False, False, False)
sense.low_light = True

s=(0.065) # scroll speed
w=(0) # color all white toggle
o=(140)
x=(2) #shutdown variable

# is really stick down
def pushed_up(event):
    if event.action == ACTION_PRESSED:
       sense.low_light = True
        
# is really stick up
def pushed_down(event):
    if event.action == ACTION_PRESSED:
       sense.low_light = False

#is really stick right
def pushed_left(event):
    global w
    global o
    if event.action == ACTION_PRESSED:
        w = (255)
        o = (255)
        
# is really stick left
def pushed_right(event):
    global w
    global o
    if event.action == ACTION_PRESSED:
        w = (0)
        o = (140)
        
def pushed_middle(event):
    global x
    if event.action == ACTION_PRESSED:
        x = (0)

sense.stick.direction_up = pushed_up
sense.stick.direction_down = pushed_down
sense.stick.direction_left = pushed_left
sense.stick.direction_right = pushed_right
sense.stick.direction_middle = pushed_middle

while True:

    dateString = "%A %B %-d %-I:%M:%p"
    msg = "It is %s" % (datetime.datetime.now().strftime(dateString))
    sense.show_message(msg, scroll_speed=s, text_colour=(w, 255, 255))

    t = sense.get_temperature()
    t = round(t)
          
    if t <= 0: 
        tc = [w, w, 255]    # Blue
    elif t > 0 and t < 13:
        tc = [255, 255, w]  # Yellow
    elif t >= 13 and t < 25:
        tc = [w, 255, w]    # Green
    elif t >= 25 and t < 30:
        tc = [255, o, w]    # Orange
    elif t >= 30:
        tc = [255, w, w]    # Red   

    msg = "and %sc" % (t)
    sense.show_message(msg, scroll_speed=s, text_colour=tc)

    h = sense.get_humidity()
    h = round(h)

    if h < 0:
        h = 0

    if h > 100:
        h = 100

    if h < 30:
        hc = [255, w, w]    # Red
    elif h >= 30 and h <= 60:
        hc = [w, 255, w]    # Green
    elif h > 60 and h < 80:
        hc = [255, 255, w]  # Yellow
    elif h >= 80:
        hc = [255, w, w]    # Red

    msg = "with %s%% Humidity" % (h)
    sense.show_message(msg, scroll_speed=s, text_colour=hc)

    p = sense.get_pressure()
    p = round(p)

    if p > 0 and p < 982:        # Very Low
        pc = [255, w, w]         # Red
        msg = "- Barometer is Very Low @ %smb - Storm Watch" % (p)
    elif p >= 982 and p < 1004:  # Low
        pc = [255, 255, w]       # Yellow
        msg = "- Barometer is Low @ %smb - Possible Percipitation" % (p)
    elif p >= 1004 and p < 1026: # Mid Range
        pc = [w, 255, w]         # Green
        msg = "- Barometer is Mid Range @ %smb" % (p)
    elif p >= 1026 and p < 1048: # High
        pc = [w, w, 255]         # Blue
        msg = "- Barometer is High @ %smb" % (p)
    elif p >= 1048:              # Very High
        pc = [255, o, w]         # Orange
        msg = "- Barometer is Very High @ %smb - Expect Dry Conditions" % (p) 

    sense.show_message(msg, scroll_speed=s, text_colour=pc)
        
           
    if x == 0:
        sense.clear()
        os.system("sudo shutdown now -P")
        time.sleep(30)
    elif x == 1:
        sense.clear()
        raise SystemExit
        time.sleep(30)

# Last edited on Jan 12th 2019
# cleaned up code for consistancy
# run sudo crontab -e
# add
# @reboot python3 /home/pi/THP.py &

I think there are only two but there are three ways to call it. Since “get_temperature_from_humidity()” and “sense.get_temperature()” are almost always the same, but not always, that is probably a result of the slight delay between when they are each taken and recorded in the script. But the questions still remains. Why is there such a difference in humidity readings between the Sense, Enviro-Indoor and DHT11 and which one is correct. I would side with the Sense, but I am confident the temp readings are about 2 degrees over from the humidity/primary temp sensor.

  1. sense.get_temperature_from_humidity()
  2. sense.get_temperature()
  3. sense.get_temperature_from_pressure()