ArDewpoint: Dew Point Based Ventilation Controller




Introduction: ArDewpoint: Dew Point Based Ventilation Controller

About: Recent CS grad, gravitating toward designs for the physical world. Love DIY innovation


This simple Arduino project, which I'm calling ArDewpoint, uses two sensors to compare the moisture content inside and outside of a structure. It triggers a relay to drive a fan if there is less moisture in the outside air, bringing down the water content of the inside air.

It consists of two remote sensors, and a central control box. Inside the control box there is a display that provides various parameters including the current status of the sensors along with statistics

Unlike many other humidity and temperature projects out there for Arduino, I do not use the popular DHT style sensors. This is because I found they demonstrated poor precision: I purchased three different sensors and had three humidity values which differed between 5-10%. Instead of attempting a complex calibration procedure, I ordered some BME280 sensors, which are based on a Bosch chip and are meant for smartphones. This paid off, as these sensors are very precise and stable. It's worth spending an extra $10-$20 for a project that actually will work!

This build should be suitable for Arduino beginners. The project mostly uses the I2C serial bus which makes the wiring very simple. Also, the libraries used by the code make the programming very straightforward. The only hiccups you might encounter will be related to driving the I2C bus over the long wires used for the sensors.


When storing materials in un-airconditioned spaces, the biggest enemy is not actually temperature, but moisture content. If you are storing items like corrodible metals or mold-prone documents in a basement or attic, your ultimate goal is not to decrease temperature, but to decrease the absolute moisture content of the air (A/C provides this along with cooling the air).

When choosing to ventilate an environment like this, the two commonly available options are a thermostat or humidistat. The thermostat will ventilate once a set temperature is passed, the humidistat a humidity reading. These systems have the obvious flaw of not knowing if the outside conditions might actually be worse!

The next step is two use two humidity sensors and compare the inside values. However this falls short. Relative Humidity only measures the moisture content of the air relative to the temperature it is at. Colder air at the same RH will contain less moisture overall.

Thus, the best solution is to use two sensors that measure the total moisture content of the air. Dew point provides this value, and is calculated based on temperature and relative humidity readings.

Because finding the dew point requires taking in multiple sensor values and performing arithmetic on them, a programmable micro controller like the Arduino is ideal for this project.

Step 1: Gather Parts

When ordering parts, take into account the quality and reliability of the parts you are buying. This is indented to be anpermanent instillation in a non-climate controlled environment, and also handles 120V AC power if you use AC fans. Is the Arduino you are buying up to the task of running 24/7 in a hot and humid environment?

Online Orders:

-Arduino Uno or equivalent

-9V DC Power supply for the Arduino

-2X BME_280 Pressure, Humidity and Temperature Sensors

-This is a little tricky because of I2C addresses. I ordered one DIYMALL sensor and one from Adafruit. This is because the DIYMALL sensor is cheaper, but its address is very difficult to change. You can also just order two from Adafruit

-0.96” SSD_1306 OLED Display, I2C

-2 Channel Relay Module for Arduino (Best to buy one of these with good reviews!!!)

-2 1K Resistors

-Housing Box and Grommets

-Solderable of Solderless Breadboard with jumpers and thing gauge wire

Hardware store stuff:

-2 Telephone cables of desired length (keep in mind I have only tested up to 12ft)

-4 Cat3/RJ11/RJ12 Jacks, the type with the quick connect pinouts

-Some 1" PVC pipe with 4 endcaps

-Silicone Sealant


-Drill and assorted bits

-Soldering Iron, Solder (fine)

-Prototyping breadboard

-Hacksaw or PVC Cutter

Step 2: Download Code/ Program Arduino

You will need to install a few libraries, and do one modification to compile my code. They can all be conveniently installed through the Arduino IDE library manager, just search and install:

-Adafruit GFX

-Adafruit SSD1306

-SparkFun BME280

You must modify the Adafruit SSD1306 library for the display. Using an editor like Notepad++ (the Arduino IDE won't work for this), open *your sketch folder*\libraries\Adafruit_SSD1306-master\Adafruit_SSD1306.h

Uncomment line 69 "#define SSD1306_128_64" and comment out line 70, "#define SSD1306_128_32"

Download my sketch here:

You can upload the code now, or modify it if you like.

-You can set the interval that the relay updates by changing "#define RELAYINTERVAL", which is in minutes.

-The threshold for ventilating can be changed with "#define VENTTHRESHOLD", with the value in Celsius. Keep in mind that the margin of error for these sensors seems to be about 1 degree, so anything lower than this is likely to result in indeterminate measurements.

-If you live somewhere where it gets quite cold and you don't freeze the inside of your structure, set "#define TEMPCUTOFF" to the minimum temperature you want to ventilate. I have it set at 15C (60F) as a default. Remember values are in Celsius.

I encourage you to modify the code to add some new features. A logical step up would be to integrate networking functionality to catalog and control over the network. The sensors are quite accurate, and also record pressure, so they can be used for weather recording. However you will notice that the sketch currently uses 85% of the available memory. This is because the Adafruit display library buffers the entire screen in memory, which takes up 1024 bytes alone. If you need more space there are other SSD_1036 libraries that instead update bits as needed and are much more lightweight.

Step 3: Solder Headers Onto Your Sensors and Display, and Set I2C Adresses

This is fairly self explanatory, your sensors should come with headers, and you can also just use thin gauge wire if you like. It very important to make sure you clean any flux residue off of the board. Even tiny amounts of residue will prevent the I2C bus from working.

If you are using one DIYMALL sensor and one Adafruit sensor, you do not need to worry about setting the addresses. If you are using two Adafruits, add a jumper between SDO and GND.

Step 4: Breadboard and Test the Electronics

Connect everything on your breadboard based on this schematic, excluding you fan power lines through the relay. At this point, do not worry about hooking up the sensor extension chords, which use the Cat3 jacks and telephone line. This is because we want to make sure everything works before adding the extra capacitance of the long wires to the circuit.

Conceptually this setup is very straightforward. The sensors and display are connected in parallel to the Arduino's I2C serial bus (A4 is SDI and A5 is SCL). 1K pull-up resistors between 3.3V and these pins give the I2C bus the ability to handle long wires. The relay module is controlled by two digital pins. For the relay module, a LOW signal actually activates the relay coils.

I have everything wired to 3.3V in this schematic to be safe (many boards you buy are meant for 3.3v power, though most Adafruit components are 5V ready), but the relay can connect to 5V and it is probably not a bad idea to do this.

If everything boots up successfully, what we are testing for is to make sure the sensor readings are consistent. They might not start out equal right away (especially if you have handled or recently soldered them), but should fairly quickly drift into line. I found my sensors were very precise, with temperature always equal and humidity within 3 point. This is the main reason for using the BME280 versus a DHT style sensor.

Next, you can gently blow on the sensors to see how they respond to the humid air of your breath. Blow repeatedly on the sensor that responds to "IN", so that its dew point is above the "OUT" value when the relay countdown hits 0. This should trigger the relay.


If the unit fails to boot and display anything, generally all problems are related to failed communication on the I2C bus. If there is a resistance leak on the I2C line, it will likely not boot at all. If the sensor values are not reading, it is most likely a bad connection. You can troubleshoot by disconnecting sensors one at a time: the display should still boot with a sensor disconnected.

For all failure situations, the remedy is always to check the connections in the wiring and your soldering. Redo your solder joints and clean them with isopropyl alcohol if necessary.

Step 5: Hookup the Cat3 Jacks for the Remote Sensors

Now get out your nifty Cat3 Jacks. You will need to use single strand wire instead of breadboard pins, but they are very easy to hookup and do not require soldering. When using telephone wire, which has only 4 lines, use the last 4 hookups on the connector as shown in the picture. You can wire it however you like, but I recommend taking advantage of the twisted pairs to try and reduce capacitance. This means the BLUE/WBLUE pair would be GND/SDA, and ORANGE/WORANGE would be VIN/SCL. Using these connectors makes it very easy to interchange cables and allows you to run them through tight places without have to re-solder all the time.

It is also likely a good idea to solder all the connections from the jack leads to the sensors, however I have a fair amount of faith in the solder-less connections and am going to see how well they hold up.

The non-sensor connected jacks wire up to the breadboard just like they are sensors themselves.

Step 6: Test With Full Length Wires

Now for the moment of truth: connect your long telephone lines into the ports and power up the board. The benefit of these digital sensors is that IF you can get them to run over the long wire, they will not be affected by the length like an analog sensor.

If everything works, you can now test the functionality of the system. Make sure to be gentle with the naked sensors, but you can do things like put one in the fridge or next to an AC duct. I tested mine by setting the outside sensor next to an ice beverage. As you can see in the picture, the dew point drops significantly and ventilation is triggered.


If it does not boot or the readings are not working right, first check the pin-outs of you connectors.

If this does not help, you have encountered the biggest challenge of this project, which is running an I2C bus of long distance. I2C is intended to be used for IC to IC communication, not long distance transmission, however it has been documented to work upwards of 100ft with modification.The first thing done in this situation is usually to use a stronger pull up resistor to SDA/SCL, which helps the voltage in the line recover quicker to give a smoother binary signal. However, I have already specified for 1K, which is the lowest resistance I have seen anyone use for I2C. You can try lower but I have no idea what problems this may cause (I am not an electrical engineer!).

One fix you can try first is to make changes in the code. You will go ahead and lower the communication speed of the I2C, which can help compensate for the reduced responsiveness of the binary signal.. Arduino automatically sets it at the lower 100khz speed (100000L), but the documentation says you can lower it down to 31khz (3100L) . Open up SparkFun_BME280.cpp in the libray folder. In the function "BME280::begin()", "after Wire.begin()"; add : "Wire.setClock(*some valule <100000L*). Try lowering it until it works, keeping an eye on the sensor values to make sure they are believable.

If you can't get the software tweaks to help, you need to lower the capacitance of your wires by using as short of length wire as necessary or twisted pair wire like Cat5e (do not pair SDA/SCL!). Keep in mind that the wire runs do not need to be equal length, and the goal is to reduce the sum of wire length.

If this doesn't work you are on your own! You will likely need to run the I2C signal into a module that uses a serial protocol better suited for long distances.

Step 7: Solder Breadboard for Final Assembly

It's time to transfer the components to the breadboard you are going to use in the finished product. A solder-less breadboard is certainly fine and easier to use, just make sure it's small enough to fit in your junction box. I had some solder-able breadboard laying around and used that. As you can see from the picture, I had a difficult time soldering in such a fairly small area. I had poor quality solder and an iron with a corroded tip. Good equipment always pays off! I recommend using thicker single strand wire wherever you can instead of breadboard jumpers. It is more durable and also rigid enough to hold my screen in place without needing to hard mount it. At this point it is also necessary to wire everything back to the Arduino to make sure it still works, if it doesn't you need to go over you solder joints again.

Step 8: Prepare Housing and Install the Electronics

Now it's time to put together the physical unit:

-First, mock up the placing of you components in the box. The wires will come into the side of the housing where you drill your holes, so make sure they will be able to make their connections without twisting around awkwardly. Leave plenty of room around your relay ports, especially if running 120V AC. A stray wire could cause a short there and start a fire.

-Mark off where you want to place you grommets and drill holes for them. I used a 3/4" bit for the grommets I ordered. I put 4 in but you can probable use 2, just be careful as the Cat3 plug just barely passes through the grommet, you need to run it through first.

- Now you can run the wires and secure your components with screws. Make sure to add some sort of plastic washer to your screws so that they don't scratch the PCB's. I used some nylon spacer material. The junction box I used has a sort of random assortment of screw posts, just make sure you can get everything secure. You can add some hot glue to get everything nice and tight.

I recommend using some zip ties to tire up your wiring too.

Step 9: Build the Sensor Housings

Now we will build some pill-shaped housings for our sensors. They are intended to protect to sensor from the elements and bugs, but are not waterproof. They need to be mounted somewhere that will see minimal water contact, like under eaves and overhangs.

-Cut a 3-4" section of 1 inch PVC, and place an end cap on it.

-Drill numerous holes underneath this end cap, this lets air get in for the sensor to measure. The smaller the holes the more protection from bugs and whatnot, you can also secure to mesh screen over them for further protection.

-On the other two end caps, drill a hole large enough for the Cat3 connector to fit through.

-Now insert your sensor-jack assembly into the housing, with the sensor first toward the undrilled cap. This will place it at the top where it has the most protection from any rain splash. Insert the assembly until the jack is flush with the PVC.

-Now use some silicon sealant, or hot glue to secure the jack in place. Silicone lets you easily remove the jack for repairs. If you use silicone give it ample time to dry.

-Run the telephone cable through the bottom cap and plug it in. Gently secure the end caps (you want to be able to remove them for maintenance), and the housing is finished!

Step 10: Hook Everything Up for Final Testing and Install

You can now tighten down all your connectors and wire everything up like you would have it for your final install. I would recommend letting the unit run for a long time, perhaps half a day, and make sure it stays running (the display shows you the uptime in hours, along with the time spent venting).

If everything looks good, it's time for the final install. The sensors can be mounted with zip ties or conduit brackets. Make sure you have the sensors hooked up in the correct positions! I did not cover the ventilation fan in this write-up as I made this unit for someone else, however this is fairly straightforward. Just be careful if you are working with 120V household A/C, if you don't know what you're doing find someone else who does!

6 People Made This Project!


  • Big and Small Contest

    Big and Small Contest
  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Make It Bridge

    Make It Bridge



Question 1 year ago

Hi im new to arduino can a nano handle this?
And how about wirelless Sensors is it possible to setup and use?


Answer 1 year ago

Yes, a nano is fine if you use anything like a BME280 sensor.
BTW, I came across a neat sensor housing (see attached). Search at your favorite China shop for "SHT10 SHT20 cover".
For wireless, well, it depends on the type of wireless sensor. I find the Xiaomi Temperature and Humidity controller very intriguing. For that I think you are better off with a ESP8266, or alike, but I have not looked into this

Screenshot 2021-12-02 104524.png

Question 2 years ago

I am glad I found this project. Thank you for this very comprehensive write up including the photos, which are very helpful.

It matchs all my needs except for the enhancements you have already suggested: "A logical step up would be to integrate networking functionality to catalog and control over the network."

I wonder if it is feasible to add the proposed project extension by adding an ESP8266 and run a MQTT Pub/Sub client to publish the sensor and the script calculated values to a broker despite your comment "that the sketch currently uses 85% of the available memory"?

In case you or anybody on here has realised the network enhancement, I would be happy to learn about it and copy the script across to my project.

Stay safe and healthy!


Answer 2 years ago

you can contact me via: spelzl<at>hotmailcom


Question 3 years ago

I'm completely new to Arduino but this project is perfect for my plan to ventilate my crawlspace. I have several questions.
I'm putting in 10 dual AC Infinity fans, approximately 360 watts total. Will it handle that load? One end of the house will be exhaust and the other will blow inin respect to dew point.
The fans are standard electrical outlet. Does the relay accept that or will they need to be spliced?


4 years ago

I’ve just modded mine as a sender unit for both the sensors and the relay control for the garage and a base unit inside the house to display sensor output, to make parameter changes and manual vent control.
Just coding checks to do and enclosures to make.


Question 4 years ago

Very nice project!!!

To be frank I am not very
familiar with Arduino language. I do not understand how the dewpoint
calculation is made. You have made ref.
to Wiki and in the last rows (185-189) put the relevant formula

It seems to me that is not part of the loop,
how the dewpoint calculation above is connected with 122 and 123 rows

Thanks a lot



5 years ago

I was very inspired by your project. I initially duplicated your project and it worked great, but I decided to expand on it using a Raspberry Pi and Node Red. Here are the details: Thanks again for the inspiration.


5 years ago

Thanks alot! This project is very inspiring! One question: Why are you using 2 relays? The wiring diagram does not show. Do you want to switch on both the phase lead and neutral? (Which would be a very good idea from a safety point of view). Thanks!


Reply 5 years ago

Glad you're finding it useful! I personally used to two relay module because it was both what I had in stock and I'm also controlling two fans, so it keeps them isolated and limits the amperage. In that case, I'm just switching the hot wire. I'm not super familiar with AC wiring so I can't give an expert opinion, but switching the neutral seems like it would only be beneficial as a failsafe for a place with unreliable wiring.


Reply 5 years ago

Many thanks for the swift answer :-)

Makes perfect sense to me. Switching on both the hot wire and the neutral would be a good idea when you can rotate the wall plug of your device by 180° and thereby exchange phase and neutral. Depending on the place where you live on this planet this consideration may or may not be a problem.

I am currently replicating your concept (thanks again!). I have kind of expanded this a little to include a mechanical de-humidifier in case it is too cold or damp outside for venting, and at the same time humidity inside exceeds 80%. So this is a second line of defense. But so far it hasn't gotten to that point, and I think I will be saving a lot of electricity!

I'll post a picture later today when I have cleaned up my gizmo a bit...