User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Humidity controlled cellar ventilation

Tue Jun 28, 2016 7:57 pm

I'd like to present my recent project of using a Pi 3 to realize an automated humidity controlled ventilation system for my cellar. The basic idea is to measure temperature and relative humidity both inside the cellar and outside, calculate absolute humidity from these values, and then turn on the ventilation if absolute humidity outside is lower than inside.

Since I'm not much of a hardware tinkerer and didn't want to drill holes into my outer wall, I opted for ready made parts for the sensing and controlling work. Measurements are made by two wireless sensors ASH 2200 by german electronics company ELV:

ImageImage

The Pi gets the sensor readings through a USB receiver WDE1-2 (ELV as well). Two fans (intake and exhaust) are then controlled via a USB power strip Energenie EG-PMS2.

I've also gotten a Tontec case with 3.5" touchscreen for the Pi (first of my Pis to ever have some kind of display attached, the two others are headless). This is what the setup looks like on our cellar shelf (USB receiver at the top):

Image

The software is mainly a collection of scripts (bash and python). A shell script checkrecsensors.sh is started via cron @reboot. This calls a python script recsensors.py which in turn reads temperature and relative humidity via USB, calculates absolute humidity and dew point (formulas taken from http://www.wetterochs.de/wetter/feuchte.html) and stores all values in RRD databases. If recsensors.py terminates for any reason, checkrecsensors.sh logs the return code and then starts it again in an endless loop.

The core of the system is another python script, fanctl.py, which understands the following commands:

on,off - to turn the fans on or off
lock [on|off] <duration in seconds|"inf"> - to lock the fans to the given state temporarily or permanently
unlock - to remove a previously set lock

and finally

cron - the script is called with this command every 3 minutes via cron. It then gets the last values from the RRD database, checks the fans' lock status and turns them on or off accordingly. It also produces some charts and a small HTML snippet showing the current readings and fan status - these are stored on a tmpfs RAM disk to save the SD card from wear.

A small Tkinter GUI is running on the touch display that shows the current values and fan state, a small graphical display of the last 24 hours, and allows manual switching/locking and unlocking of the fans:

ImageImage
(Keller - cellar, Aussen - outside, TP (Taupunkt) - dew point, RF/AF (Relative/Absolute Feuchte) - relative/absolute humidity, Lüfter - fan, An/Aus - on/off)

ImageImage
(Lüfter einschalten für? - Turn on fan for?, Minuten - minutes, Stunden - hours, Tage - days, Wochen - weeks, entsperren - unlock, Abbrechen - Cancel)

Some larger graphs, for longer periods and including daily and monthly averages, minima and maxima, are displayed via a simple web site served by nginx. The site allows the same controls as the interface on the device:

Image
Image
Image
Image
(Further translations on demand, I think the screens are pretty self-explanatory.)

The system's been running for upwards of a month now and has proven quite reliable. Unfortunately, ventilation is not as effective as I hoped for so I'll probably have to think of some other measures as well, but it's a start.

What's still lacking is some kind of monitoring of the system. I'll possibly look into Icinga for that when I get around to it. For now, regular eye ball monitoring will have to do.

The complete code is available on Bitbucket:

https://bitbucket.org/m_reiter/klima

If anybody wants to adapt it to their needs or wants to realize something similar, I'll be happy to help.
Last edited by dasmanul on Fri Feb 10, 2017 11:37 pm, edited 2 times in total.

RDS
Posts: 721
Joined: Tue Oct 06, 2015 8:17 am
Location: Lancashire, UK

Re: Humidity controlled cellar ventilation

Thu Jun 30, 2016 6:36 pm

Thanks for sharing your Project.

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5202
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: Humidity controlled cellar ventilation

Thu Jun 30, 2016 8:59 pm

I really like the look of this! I'll see if we can give it a push via some of the Foundation's channels; I think a lot of people might be interested in it. Have you documented it anywhere else?
Director of Communications, Raspberry Pi

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Humidity controlled cellar ventilation

Thu Jun 30, 2016 9:10 pm

Thanks for taking an interest!

I've described it in german on the german Raspberry Pi Forum at http://www.forum-raspberrypi.de/Thread- ... erlueftung. The bitbucket page links both there and here, so I'd consider this thread the "official" english language documentation ;).

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Humidity controlled cellar ventilation

Sat Jul 16, 2016 9:28 am

I have now added some monitoring facilities: I've installed icinga2 (on a Pi 2 this time) and set up the cellar Pi as a satellite. I've also written a small Nagios plugin script and service definition file to monitor my ventilation system. Here's what it looks like in icingaweb2:

Image

I get warnings if the sensors don't update for more than 15 minutes (think dead batteries) or if the cron job doesn't run.

All changes have been added to the repository.
Last edited by dasmanul on Fri Feb 10, 2017 11:37 pm, edited 1 time in total.

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Humidity controlled cellar ventilation

Sun Jul 31, 2016 8:10 am

Following a suggestion I got on the german forum, I have now implemented the possibility to do interval ventilation, e.g. turn the fans on for 10 minutes, then off for 20 minutes, then repeat. Some commercial solutions seem to work that way. The idea is presumably to give the fresh air some time to take up humidity from inside.

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Humidity controlled cellar ventilation

Wed Oct 12, 2016 5:47 pm

Exciting times, at least for me: At least two users on the german forum have implemented and adapted my solution for their needs and a couple of others are interested.

Based on one of these users' notes during installation, installation instructions have now been added to the repository - in german only for now, but I'll be happy to try my hand at a translation if there's serious interest for it.

SevTD
Posts: 3
Joined: Fri Apr 07, 2017 7:41 am

Re: Humidity controlled cellar ventilation

Fri Apr 07, 2017 7:45 am

Hey there,

Sorry to get this "old" topic back to life, but my girlfriend and I are currently renovating a house. Our cellar has some kind of ventilation/humidity issue. The building contracter said we'd better put in some ventilation to get rid of the humidity. This project seems just about to do the trick.

My question: I have always had the ambition to buy a raspberry pi, but up to now I haven't had the time. So my knowledge about the use of it is zero. Would somebody be kind enough to pass me an English edition of the guide to set this system up?

Thanks in advance!

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Humidity controlled cellar ventilation

Fri Apr 07, 2017 10:10 am

As offered, I'll give it a try. Might be a couple of days before I get round to it though.

Stephanisk
Posts: 5
Joined: Thu Apr 06, 2017 6:46 pm

Re: Humidity controlled cellar ventilation

Fri Apr 07, 2017 10:36 pm

Super interesting. This is a part of what i want to program as complete climate control system. I really like the GUI and implementation. In what language did u write this code?

peterlite
Posts: 720
Joined: Sun Apr 17, 2016 4:00 am

Re: Humidity controlled cellar ventilation

Sat Apr 08, 2017 4:43 am

Excellent project. I tried to do this many years ago with Arduinos at my previous house where humidity and temp fluctuations were wrecking my wine cellar. Nagios is a brilliant idea.

For my current house, I need to monitor some other things along side temp and humidity. Expanding your work with other sensors should be easier than starting from scratch.
viewtopic.php?f=41&t=176221

SevTD
Posts: 3
Joined: Fri Apr 07, 2017 7:41 am

Re: Humidity controlled cellar ventilation

Mon Apr 17, 2017 8:22 am

No problem at all! My house isn't running away and I have time ;)

Thanks anyway for the effort!

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Humidity controlled cellar ventilation

Sun Jun 25, 2017 11:35 am

I must apologise to everybody interested for taking so long to reply. I've been rather busy recently.

English installation instructions are now up at https://bitbucket.org/m_reiter/klima/sr ... TALL_en.md. Corrections or improvements are happily accepted.
Stephanisk wrote:Super interesting. This is a part of what i want to program as complete climate control system. I really like the GUI and implementation. In what language did u write this code?
In Python. The code is available on bitbucket in case you're interested.
SevTD wrote:No problem at all! My house isn't running away and I have time ;)
Still, sorry for taking so long and thanks for your patience. Let me know if you actually tackle this project.

the_m25
Posts: 1
Joined: Sat Oct 14, 2017 5:26 pm

Re: Humidity controlled cellar ventilation

Sat Oct 14, 2017 5:42 pm

thanks for the great instructions and program! I am currently trying to get this to work for my father's garage. however i noticed that the fans will be controlled over USB. i was wondering if there was an easy code mod that i could perform to have them be activated over a relay board connected to the GPIO pins. I'm aware that a small display will be using the GPIO pins, however i'm uncertain of how many and which pins it occupies. If you have an idea of how to get this to work that would be great.

Return to “Automation, sensing and robotics”