Curious Findings with Humidity Sensors

It all started with curiosity about humidity and its effect on 3D printing filament. Since asking my initial questions about my filament drying process, I’ve spent entirely too much time, energy, and money learning about humidity, temperature, sensors, and how they play together. In this pursuit, I found something delightfully curious today!

Without getting into too many details about what led me to this point, let’s say this: I’ve got two sensors of note in front of me – the AM2302 a.k.a. DHT22, and the Sensirion SHT31-D. The DHT22 is great – everyone uses it for everything, so code is everywhere, and it claims 2% RH accuracy and 0.5°C temperature accuracy. The thing is, they’re cheap, of dubious origin, and give readings that very frequently disagree with desktop-style household hygrometer/thermometer units I’ve got a few of. I bought the SHT31-D as a point of comparison, due to this suspicion. 

When I dug a little further, I noticed that the ±2% RH spec is “typical,” and per the datasheet, the “max” spec is actually ±5%. In addition, that’s typically not guaranteed over the entire operating temperature or humidity ranges – accuracy usually gets worse below 10% and above 90%, and outside of normal room temperature, but the DHT22 datasheet doesn’t really specify any of this so it’s unclear what we should expect. The SHT31-D, on the other hand, DOES call out these specs: ±2% typical over 0-100C and 0-100% RH, and 2.5% MAX 0-90% RH, 3.5% max from 90-100% RH. That Sensirion has these figures and graphs in the datasheet gives me much more confidence in that sensor over the DHT22. (Plus, the DHTs are like $2ea for a handfull, where the SHT31-D is $14 on an Adafruit board.)

In questioning the DHT22 datasheet, researching, and comparing, I came across perhaps the most lunatic exploration of DHT22 calibration and verification anyone’s done outside the factory, and probably inside too: You could read those pages for days. One thing mentioned is the possible temperature dependence of the RH reading from a given sensor. That got me wondering: if I put my sensor in a sealed box with a heater, the temperature should go up, RH should go down, and the dew point calculated from them both (a measure of absolute moisture in the air mass) shouldn’t change, since the air isn’t going anywhere or changing in composition. If the calculated dew point DOES change, that probably means there’s some strong temperature dependence of the RH reading. 

I tossed my AM2302 sensor in the closest box I had on hand, along with a USB-C dummy load I could easily dump a few tens of watts into (about 45, as it happens). 

Dummy load and AM2302 sensor in cardboard box from Amazon
Time to science!

It’s not exactly “finished” yet, but I’ve got a little python program to log data straight off of this sensor or others like it (anything that spams a serial port with data in python tuple format).

Graph of AM2302 data from heating air inside a cardboard box. We see an unexpected spike in RH, and a significant upward trend in dew point that takes about 10 minutes or so to inflect downward again.
Data captured in cardboard box from AM2302

But… what on earth? As soon as the heater comes on, the relative humidity SPIKES! That’s not supposed to happen… And while it eventually comes down, we see that the calculated dew point does up and stays there – it’s not just a fluke. Wondering if this was some kind of SEVERE temperature dependence of the AM2302, I tried the same experiment in the same cardboard box, but with the SHT31-D, which I “trust.”

Data from the cardboard box with the SHT31-D. There's a much less pronounced initial RH spike, but the same dewpoint trend is observed.
Same cardboard box with heater experiment, but with SHT31-D sensing

The initial RH spike is much less pronounced, but it’s definitely still there, and the dew point behavior for sure is, too. Note that the fall off is the result of disconnecting the heater and letting the box stabilize without opening it, just for completeness’ sake. At this point, I figured I was probably measuring an actual phenomenon, so I did some more googling and found a paper called MOISTURE AND TEMPERATURE EQUILIBRATION: BEHAVIOR AND PRACTICAL SIGNIFICANCE IN PHOTOGRAPHIC FILM PRESERVATION. It’s pretty cool that literally nothing is too nerdy for someone to have written an inappropriately detailed exploration of it. In this case, the authors are interested in the temperature and humidity behavior of various archival containers, including cardboard. In pursuing this, they did essentially the same thing I had – force temperature on a static airmass enclosed by, among other things, cardboard:

Thermal equilibration was rapidly achieved for both locations
inside the box. However, temperature cycling caused unexpected RH
changes both inside the box and in the middle of the enclosed
material itself. In this particular storage situation, the
temperature increase caused an increase in RH, rather than the

This behavior, at first glance contradictory, can be explained by
the fact that the cardboard enclosure and mat-board mounts are
themselves very hygroscopic. Cardboard absorbs moisture when the
temperature drops and desorbs moisture when the temperature
rises. In other words, the cardboard by exchanging moisture in
response to temperature changes, alters the microenvironment RH.
This change in the microenvironment is reflected in a small but
still measurable effect within the stack of mat-board mounts. The
quantity of water vapor involved in such changes is rather small
compared to the total moisture content of the material.

Nevertheless, the impact of temperature cycling on the percent
moisture content of hygroscopic materials deserves further
careful study.

Bigourdan, et al.

Study, I shall, gentlemen. In essence, what seems to be happening is that the cardboard’s moisture capacity is highly temperature dependent, and increasing the temperature even slightly liberates much more than enough water vapor to offset the expected drop in RH due to heating. Eventually, of course, the temperature drives moisture out of the cardboard THROUGH the walls and into the room, which we see as a change in trend to decreasing dew point as opposed to the initially increasing value. But at least at first, much of that moisture gets reassimilated into the internal air mass. The initial RH spike on the second run with the “better” sensor is probably less intense simply because the first run already baked a bunch of water out of the paper.

Same experiment, but loaded into a plastic box.
Round two: FIGHT!

At this point, I was satisfied at having discovered and explained something peculiar, but just for a safety check, I re-ran the experiment in a plastic tub instead of the cardboard box, with both sensors.

AM2302 data from a plastic box run.
Data from a plastic box run, measured by the DHT22/AM2302
SHT31-D data from a plastic box run.
Data from a separate plastic-box run, using the SHT31-D

Sadly, I didn’t think to fire up two copies of my logging software at the same time. In both plastic-box tests, however, we get more or less exactly the expected behavior – temperature and RH are inversely proportional to each other, with the dew point remaining basically flat. There is a bit of variability here, but only about 3 degrees. Some variability is to be expected, among other things, since there’s pretty significant uncertainty on the RH measurement in the first place, and since the dew point calculation is only an approximation and not actually a direct measurement. Also, the boxes aren’t sealed, merely closed. 

I should probably write down and wrap up all the rest of my humidity research before I go poor and crazy conducting it, but in the mean time, that was fun!

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *