0.5 C
London
Sunday, February 2, 2025

How to Stop Spam Calls: Block Unknown Numbers Today

What Are Spam Calls and Why Are...

Elon Musk Reveals Two Professions AI Will Soon Eliminate

Which Careers Are at Risk Due to...

Activate WhatsApp’s Spy Mode to Stay Private

What Is WhatsApp's ‘Spy Mode’? WhatsApp's ‘Spy Mode’...

Build a Raspberry Pi Dew-Point Ventilation System

InternetBuild a Raspberry Pi Dew-Point Ventilation System

A Dew-Point Ventilation System with Raspberry Pi

Proper ventilation is key to maintaining a healthy indoor climate. Moist, relatively warm air must regularly be expelled so cooler, drier air can enter. Without this exchange, excess moisture may condense on windows or outer walls, increasing the risk of mould. Newer low-energy houses come with sophisticated ventilation systems that automatically manage airflow. In older buildings, you generally need to open and close windows yourself—risking oversights that allow damp air to accumulate indoors.

A compact network of Raspberry Pis, however, can automate the process. This guide explains how to build a dew-point ventilation system using:

  • A Raspberry Pi (e.g. Raspberry Pi 4 or 5) running Home Assistant as the central control.
  • At least two Raspberry Pi Pico W devices configured as wireless sensors through ESPHome.
  • DHT22 or AM2302 temperature/humidity sensors for measuring conditions indoors and outdoors (or in a basement).
  • A relay or a smart plug to control a fan or inline duct blower.

By comparing dew points in different areas, the system only ventilates when conditions are suitable—helping keep basements and living spaces free of mould.


Core Idea: Dew-Point Ventilation

When air cools to its dew point, its moisture begins to condense into droplets—often on cold surfaces. A lower dew point indicates drier air. Therefore, to dehumidify a space, you generally introduce air with a lower dew point than the air you are trying to remove. In this project:

  1. A sensor in a basement or indoor room measures temperature and humidity, from which we derive an indoor dew point.
  2. Another sensor outside (or in a reference environment) tracks the outdoor dew point.
  3. When the outdoor dew point is sufficiently below the indoor dew point, a fan automatically runs to swap out moist indoor air for drier outdoor air.

Equipment and Setup

Approximate Time
Around 4 hours, once you have all hardware in hand.

Potential Cost
~€80 or more, depending on the number of sensors and the type of fan or inline blower.

Parts List

  • Primary Control: A Raspberry Pi (e.g., Pi 4 with at least 2 GB RAM, or Pi 5).
  • Storage: MicroSD card (16 GB or larger).
  • Two Raspberry Pi Pico W (for sensors).
  • Two temperature/humidity sensors: DHT22 or AM2302 recommended.
  • One or more 230 V relay modules or a Wi-Fi smart plug (to switch the ventilation fan).
  • Power supplies for the Pi and Pico boards.
  • Additional: 5 V inline duct fan or alternative ventilation solution, cables, possible window or duct mount if used in a basement window.

When a basement is already very damp—e.g., with water on the floor—ventilation alone will not solve the underlying issue. However, for ongoing humidity management, a dew-point ventilation system can help significantly.


Step 1: Home Assistant as the Control Centre

Installing Home Assistant

  1. Download the Home Assistant OS image, commonly done via the Raspberry Pi Imager.
  2. Write the OS to a microSD card, then insert it into the Pi.
  3. Connect the Pi to Ethernet and power it on; wait 10–15 minutes for the first boot.
  4. Access the interface at http://homeassistant.local:8123 (or use the IP address if .local is unavailable).
  5. Follow the on-screen prompts to create an admin account and set up your home location.

Once installed, Home Assistant scans your network for compatible devices, possibly identifying items like a router or network printer. These can be integrated to monitor, for example, your internet bandwidth or printer toner levels. The final result is a flexible smart-home hub that can visualise or automate many tasks.


Step 2: Wireless Sensors Using Raspberry Pi Pico W

Rather than wiring sensors throughout your home, you can deploy multiple Pico W boards, each with a DHT22 or AM2302 sensor. The DHT22/AM2302 is a low-cost component that measures both temperature and relative humidity.

Using ESPHome
ESPHome is a framework that turns simple YAML configuration files into device firmware for microcontrollers like the Pico W, ESP32, or others. It simplifies tasks like reading sensor data and sending it to Home Assistant over Wi-Fi.

  1. Install ESPHome:
    • Make sure you have Python 3 installed.
    • Create a dedicated folder (e.g. esphome) and set up a Python virtual environment there.
    • Install ESPHome with pip3 install esphome.
  2. Start the ESPHome Dashboard:
    • Activate your virtual environment, then run: esphome dashboard esphome/
    • Point a browser to http://127.0.0.1:6052/ to see the dashboard.
  3. Create a New Device (Example: dht-outside):
    • In the dashboard, click New Device, give it a short name (no spaces or special characters), and skip the immediate installation step if it tries to upload to an ESP board.
    • Eventually, you will choose Manual download (UF2 format) to get a firmware file for the Pico W.
    • Press and hold the BOOTSEL button on the Pico, connect it to your PC by USB, and drag the .uf2 firmware file onto the Pico’s virtual drive.
    • Once flashed, the Pico reboots and should appear as online in the ESPHome dashboard (assuming you have configured Wi-Fi credentials).
  4. Defining Outputs and Sensors:
    • The LED on a Pico W is on GPIO32. You can define an output in the YAML config to flash it periodically, just for testing.
    • A DHT22 sensor usually has three pins: VCC, GND, and Data. Connect Data to a GPIO pin (e.g. GPIO28), VCC to 3.3–5 V, and GND to ground.
    • In the YAML, define a sensor: block that references platform: dht with model: DHT22, the pin: 28, and sub-entries for temperature and humidity.

Once saved, each sensor reading should appear as an entity in Home Assistant. If you have named the device “dht-outside,” the default sensor entities might look like sensor.dht_outside_temperature or sensor.dht_outside_humidity.


Step 3: Calculating Dew Point in Home Assistant

DHT22 sensors measure temperature and relative humidity, but not the dew point. The dew point can be calculated using a known approximation (based on the Magnus formula). In Home Assistant, you can implement a “template sensor” that references the raw temperature and humidity entities and outputs the dew point.

A typical formula (in pseudo-code):

if t >= 0:
  a = 7.5
  b = 237.3
else:
  a = 7.6
  b = 240.7

sdd = 6.1078 * 10 ^ ((a * t) / (b + t))
dd  = sdd * (h / 100.0)
v   = log10(dd / 6.1078)
tt  = (b * v) / (a - v)

Home Assistant uses Jinja templates. The equivalent snippet can be placed in a Template Sensor, referencing your sensor IDs. For example:

{% set t = float(states('sensor.dht_outside_temperature')) %}
{% set h = float(states('sensor.dht_outside_humidity')) %}
{% if t < 0 %}
  {% set a = 7.6 %}
  {% set b = 240.7 %}
{% else %}
  {% set a = 7.5 %}
  {% set b = 237.3 %}
{% endif %}
{% set sdd=6.1078*10**((a*t)/(b+t)) %}
{% set dd = sdd * (h/100) %}
{% set v = log(dd/6.1078, 10) %}
{% set tt = (b*v) / (a-v) %}
{{ float(tt) | round(1) }}

Repeat the process to get a second dew point reading for the indoor/basement sensor. You then have two separate dew point entities in Home Assistant—one for outside, one for inside.


Step 4: Controlling a Fan or Ventilation

You can attach a fan or inline duct blower. The question is how to switch mains voltage. Two approaches:

  1. Relay on a Pico
    • Use a 3.3–5 V relay module. The Pico’s GPIO (say, GPIO26) drives the relay input.
    • In the Pico’s ESPHome config, define a switch: block pointing to that GPIO pin. This “switch” entity then appears in Home Assistant.
    • The advantage is an all-in-one approach. However, you must handle 230 V carefully, respecting local electrical safety codes.
  2. Wi-Fi Smart Plug
    • Far simpler: get an inexpensive Shelly Plug (or similar). Plug your fan into it.
    • Home Assistant typically auto-discovers Shelly plugs. Switch them on or off with a simple entity.
    • Avoids direct mains wiring on your part.

Building the Automation

In Home Assistant, you create an automation that regularly checks:

  • Is the outside dew point at least, say, 5 °C lower than the inside dew point?
  • Are inside temperatures above a minimum (to avoid freezing)?
  • Are outside conditions within safe bounds?
  • Is indoor humidity not dropping too low?

Then, if all conditions are met, the fan is turned on; otherwise, it’s turned off. Because you likely want continuous re-checks (e.g., every 5 minutes), set your automation’s trigger to a time pattern:

  • Under “When to run” (the trigger), pick “Time pattern,” entering “/5” for the minutes field.
  • Under “Actions,” use a If-Then-Else block. In pseudo-logic: if ( indoor_dewpoint - outdoor_dewpoint >= 5 and indoor_temp > 10 and outdoor_temp > -5 and ... ): fan on else: fan off

That means, every 5 minutes, it reevaluates conditions; if the dew point difference is big enough, the system ventilates. If not, it shuts the fan off.


Step 5: Final Checks and Considerations

Safety
If your building has gas boilers or other combustion appliances, forcibly extracting air with fans might risk drawing flue gases back indoors. It’s wise to consult with a qualified professional or chimney sweep to confirm that an additional extractor fan will not compromise the existing heating system. A carbon monoxide alarm is strongly recommended wherever such fuel-burning appliances are used.

Practical Usage

  1. Make sure the system logic is tested with a simpler output first (like an LED).
  2. Monitor a basement or indoor environment across different seasons.
  3. If you see the system repeatedly turning the fan on and off quickly, consider adding a short “run time” minimum or hysteresis to reduce toggling frequency.

Possible Extensions

  • If you prefer remote “headless” operation, the Pi can be placed in a mechanical room or basement, with the Raspberry Pi Pico sensors (or Shelly plugs) distributed wherever you need them.
  • Using the Pi’s powerful smart-home ecosystem, you can link or automate other tasks simultaneously—for instance, if the inside humidity remains too high, send a notification or turn on a dehumidifier.

Conclusion

A homemade dew-point ventilation system can substantially reduce the risk of mould by selectively exchanging indoor air with drier outside air. By using Raspberry Pi boards, ESPHome, and Home Assistant, you get an adaptable, Wi-Fi-enabled solution that avoids extensive wiring. Combining these affordable components—especially with the Raspberry Pi Pico W—lets you precisely measure temperature and humidity, calculate dew points, and drive a ventilation fan to maintain healthy indoor conditions. You save on the cost of a commercial system and gain the freedom to customise logic for your home’s unique layout and climate challenges.

Check out our other content

Check out other tags:

Most Popular Articles