Donate to Remove ads

Got a credit card? use our Credit Card & Finance Calculators

Thanks to Wasron,jfgw,Rhyd6,eyeball08,Wondergirly, for Donating to support the site

Controlling a dehumidifier with a Raspberry Pi and Pico

Does what it says on the tin
ReformedCharacter
Lemon Quarter
Posts: 3142
Joined: November 4th, 2016, 11:12 am
Has thanked: 3650 times
Been thanked: 1522 times

Controlling a dehumidifier with a Raspberry Pi and Pico

#567525

Postby ReformedCharacter » February 10th, 2023, 8:16 pm

I've no idea if this might be of interest to fellow tinkerers, but just in case:

I live in an old house and now the children have left home we have rooms that are unused and generally left closed during the colder months and unheated. We have a problem in two rooms in particular, both North facing. Due to the construction of the house the areas under the windows are about half the thickness of the rest of the walls. These areas are particularly prone to condensation. For a number of years I have placed inexpensive dessicant dehumidifiers in those rooms. Dessicant dehumidifiers are apparently more efficient than refrigerant dehumidifiers at lower temperatures and produce a little heat during their cycle. The dehumidifiers I use do have 'humidistats' but I find them hopelessly inaccurate and the result is that the room's humidity is either too high leading to condensation or too low, wasting electricity. I am using these dehumidifiers:

https://manuals.ecoair.org/495-20220322_DD1SimpleMK3_Manual.pdf

One of the advantages of these dehumidifiers is that they start as soon as power is applied, there is no separate power button on the unit. In the past I have used timers to run them in the evening as the temperature drops.

I came across an Explaining Computers video in which a Raspberry Pico is used as a weather station. A Bosch BME280 module is used which provides temperature, relative humidity and pressure:

https://www.youtube.com/watch?v=3q807OdvtH0

I wondered if I could use the Pico and module to control a dehumidifier. I already have a RPi running 24/7 for various purposes. I found that Kasa models in the TP-link range of plugs and similar items are controllable by wifi and that there's a Kasa library available for RPis that enable a plug to be turned on or off with a bash script.

After assembling the items and messing about with bash scripting I'm very happy with the results. I get a log file which shows time, temperature, RH and when the dehumidifier is turned on and off. I've found that turning the dehumidifier on for 45 minutes and polling the module every subsequent 10 minutes works well. Copying the log into a spreadsheet shows me how much I'm spending on electricity.

A few observations:

The firmware for the Pico is not yet 'stable' and I found a bug which stopped the Pico from writing the data to a web page as designed, typically after 5-10 hours. This confused me because I could still successfully ping the device which gave the impression that there wasn't a problem with connectivity. After a bit of research I tried adding a line to the code which prevented the wifi module going into sleep mode, and that resolved the issue.

The price of some dehumidifiers has almost doubled recently, doubtless they will return to normal levels, probably this summer when demand has dropped off. The model listed above is normally available for c. £130 but I've seen prices nearly twice that.

TP-link Kasa plugs (which may be in the process of being superseded by the 'Tapo' range) are available for about £10, although I've seen them priced much higher. I bought mine from Amazon.

Costs:
Pico W £ 7.20
Pico Breadboard £ 4.20
BME280 module £16.00
Kasa plug £ 9.95

RC

Lootman
The full Lemon
Posts: 18956
Joined: November 4th, 2016, 3:58 pm
Has thanked: 639 times
Been thanked: 6691 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567528

Postby Lootman » February 10th, 2023, 8:26 pm

The two dehumidifiers I employ in my (otherwise very damp) basement have built in sensors that switch the device on and off according to the humidity reading. So no need for an internet connection.

I set it for 45% which is the perfect humidity level. It records high and low levels which, for the last year, are 44% and 73%!

ReformedCharacter
Lemon Quarter
Posts: 3142
Joined: November 4th, 2016, 11:12 am
Has thanked: 3650 times
Been thanked: 1522 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567543

Postby ReformedCharacter » February 10th, 2023, 10:20 pm

Lootman wrote:The two dehumidifiers I employ in my (otherwise very damp) basement have built in sensors that switch the device on and off according to the humidity reading. So no need for an internet connection.

I set it for 45% which is the perfect humidity level. It records high and low levels which, for the last year, are 44% and 73%!

How did it get to 73% if you have 2 dehumidifiers!?

RC

Lootman
The full Lemon
Posts: 18956
Joined: November 4th, 2016, 3:58 pm
Has thanked: 639 times
Been thanked: 6691 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567544

Postby Lootman » February 10th, 2023, 10:24 pm

ReformedCharacter wrote:
Lootman wrote:The two dehumidifiers I employ in my (otherwise very damp) basement have built in sensors that switch the device on and off according to the humidity reading. So no need for an internet connection.

I set it for 45% which is the perfect humidity level. It records high and low levels which, for the last year, are 44% and 73%!

How did it get to 73% if you have 2 dehumidifiers!?

I was away and they have to have their tanks emptied.

They have an option to have a hose attached but I did not take it.

Hallucigenia
Lemon Quarter
Posts: 2685
Joined: November 5th, 2016, 3:03 am
Has thanked: 170 times
Been thanked: 1777 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567547

Postby Hallucigenia » February 10th, 2023, 11:12 pm

As a more plug-n-play solution that doesn't rely on rare-as-rocking-horse-poo Pis, Inkbird do a great range of kit for "environmental" switching, including the IHC-200 humidity-based controller for about £30, and regularly 20-30% off on Black Friday, Prime Day etc :
https://inkbird.com/products/humidity-c ... er-ihc-200

csearle
Lemon Quarter
Posts: 4839
Joined: November 4th, 2016, 2:24 pm
Has thanked: 4861 times
Been thanked: 2124 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567548

Postby csearle » February 10th, 2023, 11:21 pm

Hallucigenia wrote:rare-as-rocking-horse-poo Pis,
Had to laugh at that. I have recently bought and programmed a PI, loaded it with a stripped-down version of linux and used it to link between a cellular network receiver and WiFi using a circular microwave aerial fashioned out of a metal toilet brush holder from B&Q. Whole thing cost no more than about £50 (including an un-needed loo brush) so, if supply/demand is anything to go by they can't be soooooo rare. ;) Can now beam a WiFi hotspot >1km into the distance. C.

Hallucigenia
Lemon Quarter
Posts: 2685
Joined: November 5th, 2016, 3:03 am
Has thanked: 170 times
Been thanked: 1777 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567550

Postby Hallucigenia » February 11th, 2023, 2:04 am

csearle wrote:
Hallucigenia wrote:rare-as-rocking-horse-poo Pis,
if supply/demand is anything to go by they can't be soooooo rare. ;)


Merely going on what someone I know in the trade was saying about Pis - presumably they're still suffering from the downstream effects of the chip shortage, and it may only apply to certain models, but he wanted one for his own project and pretty much had to hack his company's advance order system in order to guarantee one....

ReformedCharacter
Lemon Quarter
Posts: 3142
Joined: November 4th, 2016, 11:12 am
Has thanked: 3650 times
Been thanked: 1522 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567582

Postby ReformedCharacter » February 11th, 2023, 9:30 am

From the horse's mouth:

Eben Upton Interview: Raspberry Pi Availability & More!

https://www.youtube.com/watch?v=P9vna9jao9I

RC

88V8
Lemon Half
Posts: 5845
Joined: November 4th, 2016, 11:22 am
Has thanked: 4199 times
Been thanked: 2603 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567625

Postby 88V8 » February 11th, 2023, 12:28 pm

ReformedCharacter wrote:Costs:
Pico W £ 7.20
Pico Breadboard £ 4.20
BME280 module £16.00
Kasa plug £ 9.95

Plus a uni degree and 30 years of experience....

Our two dehumidifiers - Ebac 2650, refrigerant - don't seem to have a fixed target. Whatever the humidity is, they strive to pull it down a few points, so in our sitting room for instance it's currently 49% and rises in summer to 60%+. With no intervention in summer it would be 70% or more. I hate to think what it might cost to maintain a steady 45%.

V8

ReformedCharacter
Lemon Quarter
Posts: 3142
Joined: November 4th, 2016, 11:12 am
Has thanked: 3650 times
Been thanked: 1522 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567638

Postby ReformedCharacter » February 11th, 2023, 12:59 pm

88V8 wrote:
Our two dehumidifiers - Ebac 2650, refrigerant - don't seem to have a fixed target. Whatever the humidity is, they strive to pull it down a few points, so in our sitting room for instance it's currently 49% and rises in summer to 60%+. With no intervention in summer it would be 70% or more. I hate to think what it might cost to maintain a steady 45%.

V8

I'm sure you don't need to maintain a RH of 45%. I'm interested in the dew point to avoid condensation. Here is a formula, best used in a spreadsheet, to calculate dew point:

Tdew = 12°C – ((100 – 55)/5) = 2°C

Where 12°C is the ambient temperature, 55 is the RH% and 2°C is the dew point. I've checked the formula against various online RH% charts and it looks accurate.

RC

88V8
Lemon Half
Posts: 5845
Joined: November 4th, 2016, 11:22 am
Has thanked: 4199 times
Been thanked: 2603 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567659

Postby 88V8 » February 11th, 2023, 3:32 pm

ReformedCharacter wrote:
88V8 wrote: I hate to think what it might cost to maintain a steady 45%.

I'm sure you don't need to maintain a RH of 45%. I'm interested in the dew point to avoid condensation. Here is a formula, best used in a spreadsheet, to calculate dew point:
Tdew = 12°C – ((100 – 55)/5) = 2°C
Where 12°C is the ambient temperature, 55 is the RH% and 2°C is the dew point. I've checked the formula against various online RH% charts and it looks accurate.

It's surprising how much difference RH makes to perceived comfort. In our sitting room, which is the lowest/dampest part of the cottage, it really only starts to feel warm when the RH falls below 50%.

Our 'trigger' point for lighting the woodburner is when it gets below 63F (17C) and with an RH of 55% that formula gives a dew point of 46F (8C)* which is eminently possible given the solid walls one of which has earth on its backside, and absence of any dpc or dpm.

Currently the RH sits below 50% and it felt quite comfy in there yesterday even though it was 62F before we lit up.

It has also greatly helped that we chased inappropriate modern materials out of that room and the adjacent dining room - cement, gypsum, vinyl paint - as they conduce to condensation which the correct materials - lime, clay paint - do not.

I think one's RH target is or should be influenced by the house; in our previous house - 20s, solid walls, suspended floors, dpc - 55% was OK and in fact we had quite the opposite problem, that in winter with running the CH, the RH could fall to 35% which is not at all good for antique furniture.

Yes, one way or another a feeling of comfort is about more than just turning up the heating.

V8

* converting your formula from C to F led me to the function CONVERT which I had never seen before. Clever thing, Excel, a lot cleverer than me.

Lootman
The full Lemon
Posts: 18956
Joined: November 4th, 2016, 3:58 pm
Has thanked: 639 times
Been thanked: 6691 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567678

Postby Lootman » February 11th, 2023, 5:23 pm

88V8 wrote:It's surprising how much difference RH makes to perceived comfort. In our sitting room, which is the lowest/dampest part of the cottage, it really only starts to feel warm when the RH falls below 50%.

Our 'trigger' point for lighting the woodburner is when it gets below 63F (17C) and with an RH of 55% that formula gives a dew point of 46F (8C)* which is eminently possible given the solid walls one of which has earth on its backside, and absence of any dpc or dpm.

Currently the RH sits below 50% and it felt quite comfy in there yesterday even though it was 62F before we lit up.

It has also greatly helped that we chased inappropriate modern materials out of that room and the adjacent dining room - cement, gypsum, vinyl paint - as they conduce to condensation which the correct materials - lime, clay paint - do not.

I think one's RH target is or should be influenced by the house; in our previous house - 20s, solid walls, suspended floors, dpc - 55% was OK and in fact we had quite the opposite problem, that in winter with running the CH, the RH could fall to 35% which is not at all good for antique furniture.

Yes, one way or another a feeling of comfort is about more than just turning up the heating.

My brother-in-law lives in Southern California and has to run air-con in his house most of the year. That dries out the air so much that he runs a humidifier alongside, which seems odd to a Brit.

For me, 30-60 is the acceptable range. I pick 45 as the mid-point but anything under 60 feels fine to me. I reuse the water in the toilet or the garden, depending on the time of year.

88V8
Lemon Half
Posts: 5845
Joined: November 4th, 2016, 11:22 am
Has thanked: 4199 times
Been thanked: 2603 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#567871

Postby 88V8 » February 12th, 2023, 7:34 pm

Lootman wrote:I reuse the water in the toilet or the garden, depending on the time of year.

In the unlikely event that your chauffuese is not around to change the coolant in the Rolls as required, it's also good for that. :)

V8

ReformedCharacter
Lemon Quarter
Posts: 3142
Joined: November 4th, 2016, 11:12 am
Has thanked: 3650 times
Been thanked: 1522 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568799

Postby ReformedCharacter » February 16th, 2023, 2:54 pm

I've been logging the data from the Pico\BME sensor:

Image

I find it hard to get the best from charts on Google Sheets :)

As the days progress I've increased the RH% upper limit from 50% to 52% and then 53%. Each time the RH% upper limit is reached the dehumidifier runs for 45 minutes and then turns off. It's interesting to see the difference in the amount of RH% reduction over the period in which the dehumidifier is on, and that it shows a cyclical pattern. I'm a bit confused by this but differences in ambient temperature might account for it.

And temperature:

Image

The dehumidifier increases the room temperature by about 0.8C each 45 minute run.

Apparently hygrometers loose accuracy over time and my 'trusty' Tecpel hygrometer is now over 10 years old. I was surprised to see quite a divergence in RH% between the sensor and the Tecpel. I have just assembled a second Pico\BME280 module for another room. Putting the units together in the same place they match RH% to about 0.2% but the temperature on the second was about 0.5C higher than the other, I think this one is reading a little high.

RC

88V8
Lemon Half
Posts: 5845
Joined: November 4th, 2016, 11:22 am
Has thanked: 4199 times
Been thanked: 2603 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568804

Postby 88V8 » February 16th, 2023, 3:13 pm

ReformedCharacter wrote:Apparently hygrometers loose accuracy over time

I have five hygrometers, one digital about 5yo, four analogue might be >60yo.
There is a certain disagreement....

ReformedCharacter wrote:I've been logging the data from the Pico\BME sensor:....it shows a cyclical pattern. I'm a bit confused by this but differences in ambient temperature might account for it.


That cyclical pattern, you think it's something more than the hysteresis of the humidity switch?

v8

ReformedCharacter
Lemon Quarter
Posts: 3142
Joined: November 4th, 2016, 11:12 am
Has thanked: 3650 times
Been thanked: 1522 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568814

Postby ReformedCharacter » February 16th, 2023, 3:57 pm

88V8 wrote:
ReformedCharacter wrote:Apparently hygrometers loose accuracy over time

I have five hygrometers, one digital about 5yo, four analogue might be >60yo.
There is a certain disagreement....

ReformedCharacter wrote:I've been logging the data from the Pico\BME sensor:....it shows a cyclical pattern. I'm a bit confused by this but differences in ambient temperature might account for it.


That cyclical pattern, you think it's something more than the hysteresis of the humidity switch?

v8

There is no hysteresis in the switch as such, it's software controlled. In theory the dehumidifier turns on when the sensor says the RH% is more than x. However there are some caveats, firstly it's only polled every 10 minutes, secondly there is a certain amount of (what the specifications call) 'hysteresis' but what I call 'jitter'. That is, if you poll the module repeatedly every second you'll see the values float around. To improve consistency I take 3 readings and average them out, each time the script asks for the data.

To see the point I'm trying to make, look at the first 3-4 days when the upper limit was set to an RH of 50%, the reductions of RH% cluster between groups of c.5% and c.8% quite distinctly yet each time the dehumidifier runs for 45 minutes, and I'm not sure what causes this.

RC

servodude
Lemon Half
Posts: 8416
Joined: November 8th, 2016, 5:56 am
Has thanked: 4490 times
Been thanked: 3621 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568888

Postby servodude » February 16th, 2023, 11:05 pm

ReformedCharacter wrote:To see the point I'm trying to make, look at the first 3-4 days when the upper limit was set to an RH of 50%, the reductions of RH% cluster between groups of c.5% and c.8% quite distinctly yet each time the dehumidifier runs for 45 minutes, and I'm not sure what causes this.


It has the look of something that is a bit undersampled; can you shift it to 1min checks to see what difference you get?
If it makes no difference I'd be inclined to agree that the ambient temp seems the most likely factor

At the risk of over-sharing here's what happens in my fridge with sampling at 30sec
Image
- you can see the room temp shoppping going in early afternoon

servodude
Lemon Half
Posts: 8416
Joined: November 8th, 2016, 5:56 am
Has thanked: 4490 times
Been thanked: 3621 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568889

Postby servodude » February 16th, 2023, 11:29 pm

servodude wrote:
ReformedCharacter wrote:To see the point I'm trying to make, look at the first 3-4 days when the upper limit was set to an RH of 50%, the reductions of RH% cluster between groups of c.5% and c.8% quite distinctly yet each time the dehumidifier runs for 45 minutes, and I'm not sure what causes this.


It has the look of something that is a bit undersampled; can you shift it to 1min checks to see what difference you get?


Quick mockup in google sheets to demonstrate what I mean:

Here is a graph showing two sine waves sampled with a different number of points per cycle
Image
- you should be able to see that the undersampled one looks to have a low frequency envelope distortion overlayed on it (a 'beat" caused by the sampling rate being close enough to the response - like the stuff you can hear when you tune an instrument string and they are coming in to alignment)

Your room humidity (or "system") won't be a sine wave (probably) but you DO have a continuous response going on that you are trying to sample in to the discrete domain and it can exhibit very similar artifacts

-sd

csearle
Lemon Quarter
Posts: 4839
Joined: November 4th, 2016, 2:24 pm
Has thanked: 4861 times
Been thanked: 2124 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568894

Postby csearle » February 17th, 2023, 1:00 am

servodude wrote:
servodude wrote:
ReformedCharacter wrote:To see the point I'm trying to make, look at the first 3-4 days when the upper limit was set to an RH of 50%, the reductions of RH% cluster between groups of c.5% and c.8% quite distinctly yet each time the dehumidifier runs for 45 minutes, and I'm not sure what causes this.


It has the look of something that is a bit undersampled; can you shift it to 1min checks to see what difference you get?


Quick mockup in google sheets to demonstrate what I mean:

Here is a graph showing two sine waves sampled with a different number of points per cycle
Image
- you should be able to see that the undersampled one looks to have a low frequency envelope distortion overlayed on it (a 'beat" caused by the sampling rate being close enough to the response - like the stuff you can hear when you tune an instrument string and they are coming in to alignment)

Your room humidity (or "system") won't be a sine wave (probably) but you DO have a continuous response going on that you are trying to sample in to the discrete domain and it can exhibit very similar artifacts

-sd
Somehow Nyquist and anti-aliasing keep haunting my thoughts. C.

servodude
Lemon Half
Posts: 8416
Joined: November 8th, 2016, 5:56 am
Has thanked: 4490 times
Been thanked: 3621 times

Re: Controlling a dehumidifier with a Raspberry Pi and Pico

#568899

Postby servodude » February 17th, 2023, 1:28 am

csearle wrote:Somehow Nyquist and anti-aliasing keep haunting my thoughts. C.


It's one of those things that you can "know" and still get surprised by when you stumble upon it - especially if you are looking in the time domain


Return to “Building and DIY”

Who is online

Users browsing this forum: No registered users and 52 guests