Crawl Space Ventilation
2 November 2017
Using Node Red to control crawl space ventilation
On the full, desktop version of Raspian available for the Raspberry Pi, there is a link for a pre-installed version of Node Red. Node Red was created by IBM to more easily facilitate IOT, "The Internet of Things". I decided to incorporate Node Red into my environment to help tie together my sensors and provide some nice gauges and graphs to see trends and results. Node Red provides a graphical way to link logical blocks together in a "flow".
Through research I learned that one way to control humidity in a crawl space is to monitor temperature and humidity inside and outside the crawl space. These readings are used to calculate dew point. When the dew point is higher inside the crawl space than outside, you can bring in air from the outside to displace the higher humidity inside. I have Node Red running on two Raspberry Pi machines. One Pi is connected to a BME280 temperature, pressure and humidity sensor. This sensor will gather information inside my crawl space. Instead of using another sensor to measure conditions outside the crawl space, I use an OpenWeatherMap node to fetch current conditions for my location.
Each block in the image below is a "node". Nodes are available from the "palette" on the left side of the screen. Most of the various node types are installed by default and others, like the BME280 node, have to be installed. Each node receives and/or sends messages in various formats. If you need a function not provided by a standard node, you can use a "function" node and write some Java Script to do what you need. For example, the "Dew Point" nodes use temperature and humidity readings to calculate dew point.
Note: I was having problems with the BME280 Node so I replaced it with a Python script that fetches temperature and humidity data every 2 seconds from the BME280 and publishes the data to the on-board broker.
Here is a screen capture of my first flow that gathers sensor information every 2 seconds, calculates dew points, sets a Raspberry Pi GPIO pin to control a ventilation fan, and stuff all the information into an on-board MQTT broker. The MQTT data is "bridged" (think mirrored) to a second Raspberry Pi that gathers this info and populates a MySQL database and generates web pages for graphical display of all the information.
This is the flow on the crawl space ventilation control Pi:
18 May 2018
Note: I just learned that Weather Underground no longer issues free API keys. There is however another service called OpenWeatherMap that provides free keys and there is a node called node-red-node-openweathermap that will do the same thing as Weather Underground. See https://openweathermap.org/api
I recently added a timer so that I can disable ventilation at night (complaint of fan sounds by XYL), added the ability to enable or disable ventilation completely and a reset for a timeout condition if the sensor failed.
Here is the initial installation in the crawl space. At the moment, two sensors reside inside, but I will be using only one. The next step will be to mount the sensor in a proper enclosure. All the components are mounted on a standard DIN rail. From left to right the components are:
- Perf board with the interface to the sensors, power supply and solid state relay
- the Raspberry Pi with a 50mm fan to keep it cool
- 5 volt power supply (from Amazon)
- solid state relay (from Amazon)
- DIN terminal blocks (from Amazon)
- 3d printed mount for the PVC conduit (Carlon 3/4 inch conduit available at Home Depot or Lowes)
The fan on the Pi is rated for 12 volts, but I'm using 5 volts for power. This provides more than enough air flow to cool the Pi and it's completely silent.
I 3d printed the parts to mount the perf board, Raspberry Pi, power supply and conduit.
For primary power, I wired up two switches. One switch controls input power to the 5 volt power supply. The other switch acts as a safety switch for the ventilation fan (not yet mounted). The duplex outlet is there because you can never have too many outlets.
26 November 2018
Here are some photos taken after the ventilation fan was installed: