Well I looked for a good solution to keep the humidity level down in our bathroom. We already have (already >20 years) a very good and silent S&P ventilation fan but it is operated manually and sometimes we forgot to turn it on and/or off.
So looking around, I found there are only a few commercial options. Yes you can buy a fan with build in controller but they are expensive and the manual settings are very limited.
A standalone humidity controller/switch was much harder to find! I only found a descent mechanical switch for just under 100 euros.Photos
As I am very fond of the Arduino, so I (again) decided to make myself the thing I need, in this case a "Bathroom Ventilation Fan Controller"
The controller has the following function and options:
- Measure Relative Humidity and temperature. (duh.)
- Turn a Fan on (via a relay) and switching it off when the humidity has dropped.
- OPTIONAL: The Fan will stay on for a selectable time after humidity has dropped. (decrease the humidity a bit more)
- Manually turn the Fan ON for 15m, 30m, 1, 2, 3, 4, 5, 6 or 12 hours. (useful for smelly events...)
- Manually turn the Fan Controller system OFF for 30m, 1, 2, 4, 8 or 12 hours. (want to go to bed but the noisy fan is on? turn it off!)
- Turn the Fan Controller system OFF completely until turning ON manually.(vacation time!)
- User settings are stored in EEPROM and preserved after reset/power fail.
USER SETTINGS MENU:
- Threshold: from 40%RH to 95%RH
- Hysteresis: from 3%RH to 9%RH
- Fan off delay: from 0 (NO delay) to 60 minutes.
There are 3 buttons, from top to bottom these are:
- ON / UP
- OFF / DOWN
- on the side of the case: system RESET button
- At the top-left on the display you see the CURRENT HUMIDITY value, updated every second. The percent (%) sign will blink to indicate this.
- on the top-right we have the humidity THRESHOLD value.
- below the threshold value you'll see the set HYSTERESIS value (optional)
- at the bottom right, the current TEMPERATURE is displayed.
- at the bottom left a Fan icon will indicate when the Fan is turned on. right of that icon a text 'DELAY' is displayed if the fan-off delay is activated.
No event / system IDLE:
The humidity and temperature is measured and updated every second, indicated by a blinking '%' character next to the measured humidity value.The sensor is *very* sensitive and also *very* accurate! So it will react fast and reliable on changing conditions.
NOTE: If you decide to use a sensor from China then this will be a different matter. Cheap AND reliable/precise is simply not possible.
Event: humidity has risen equal or above the threshold:
When the current humidity reaches the threshold value, the Fan (relay) will switch on, indicated by a FAN SYMBOL at the lower left of the display.
The Fan will stay on until the humidity level has dropped below the threshold *minus the Hysteresis value*. So if the threshold is 70% and the Hysteresis is 5, then the fan will shut off at 65% Relative humidity.
NOTE: Obviously the hysteresis is very important! If not used you would have a fan switching off and on around the threshold value.
Event: humidity has dropped below the threshold value *minus Hysteresis*:
When the humidity level drop below the threshold plus hysteresis value, the fan will turn OFF.
EXCEPT: if you have set a FAN OFF DELAY time then the fan will remain on for a user determined time (menu setting)
I purposely build in several useful features not found in commercial controllers (AFAIK). For example:
- you have made the WC happy but the smell is not to be desired... Then you can turn on the fan manually for a set time.
- You want to go to bed but the fan is on because the humidity level is too high but the noise of the fan is disturbing... Then you can turn the system off for a set time, after which it will continue to measure and switch on when needed. Ventilation is important to keep mould away so this way you can't forget to turn the system on again.
- You are going on holiday: turn the system off completely. This seems obvious but with build in sensors in a fan this is not always possible
ON / UP:
- SYSTEM IDLE (fan OFF): when pressed the fan will turn ON for a set time, starting at 15 minutes. press UP again to increase fan ON time in pre-determined steps. (Maximum 12 hours)
- SYSTEM OFF: turn system ON again
- SYSTEM MANUALLY SWITCHED OFF: system returns to SYSTEM IDLE state
- MENU ACTIVE: when pressed the value is increased, hold to fast increase value.
OFF / DOWN:
- SYSTEM IDLE (fan OFF): when pressed, the system will SHUT DOWN for the set time, starting at 30 minutes. Press DOWN again to increase the shut down time in pre-determined steps. (Maximum 12 hours)
- FAN IS ON or FAN OFF DELAY active: stop the fan, then same as SYSTEM IDLE- ANY STATE (except MENU): when button is pressed for >1 second, the system is turned off completely until being turned ON again by pressing ON button.
- MENU ACTIVE: when pressed the value is decreased, hold to fast decrease value.
- when the button is pressed for >1 second, the user MENU is displayed.
(only possible in state IDLE/fan off or fan ON)
-- Set threshold: from 40%RH to 95%RH
-- Hysteresis: from 3%RH to 9%RH
-- Fan off delay: from 0 (no delay) to 60 minutes.
I had 2 cheap I2C 128x64pixel OLED screens in a drawer. maybe a bit tiny but way better than a 20x2 LCD screen... Very bright an crisp displays, these OLED things...
To get descent fonts, I use the amazing 8U2G font library from Oli Kraus
This font library consumes a *lot* of memory but the result is great... I managed to get all code (only just) in the Arduino Nano (or Uno)
I maybe over-commented this sketch but I'm a NOT an experienced programmer so I want to:  make changes in the future easier for myself and  help others to understand what the heck the code means.
Experienced programmers may make this sketch way better but it does it's job, that's the beauty of the Arduino platform: even beginners can enjoy coding and grow and be more efficient later on.The Fan Relay
The relay: I used a 5V relay of a good brand (!) I don't want to risk my house and family by using a cheap chinese one. They do make good stuff BTW but then you'll pay the same price as a locally sourced product.
YOU WILL NEED A TRANSISTOR to drive the relay!!
Else you will blow up you Arduino port...
See the schematic.
I repurposed an old pcb with safe case to mount the parts I needed and to connect the high voltage without risk. Used a 5A fuse between the fan and the 230V input
I used a free program 'VeeCAD' (<- click) to convert a schematic to stripboard. Featuring 'ratsnest' wires it's easy to wire and this way you won't forget any connections!
See the ATTACHMENTS section for download of these files.
you don't need to use VeeCAD to make this project. If you print the 'scale 1 to 1 documents' you can easily make the breaks (cuts) on the strip board and wire the board.