# Using indoor dew-point and node-red to control temperature/relative humidity

This might interest those living in areas with high humidity and high heat (sticky weather), like me.

The background to this post is that I have been controlling my thermostat using a NR flow that uses the average temperature in my house, shifting the set-point down by 3 degrees when the average exceeds the set-point; when the average is lower than the set-point by 1 degree, the central AC is turned off by raising the set-point to be 5 degrees above ambient. Different set-points were used for Home, Away, and Sleep modes.

This worked well enough for ~6 months for temperature control. But the problem with this method is that it didnâ€™t really take into account relative humidity. RH is a function of temperature. So while an RH of 60% is tolerable when the temperature is 70F, it is uncomfortable when the temperature is 75F.

I tried modifying my NR flow to trigger cooling based on RH. But this has its own issues - mainly that it promoted the equivalent of short-cycling. Or sometimes resulted in an uncomfortably cold situation, like 68F to achieve an RH end-point of 55%.

For a long time, I have wanted a thermostat that controlled my heat-pump based on indoor dew-point, the latter being a measure that takes both temperature and humidity into account. With nothing else to do, I decided to recreate a dew-point thermostat using NR, and then evaluate whether it created a more comfortable indoor environment. The goal of this exercise was the hope that controlling my heat-pump based on dew-point would take both temperature and relative humidity into account, and therefore provide better humidity control.

There are lots of charts comparing dew-point (Td) to human comfort perception that are available online. I used Td ranges based on this chart from meteorologist David Epstein. I chose a Td range of 57.5-55.0 Fahrenheit for Home mode (heat-pump turned on when Td > 57.5 and turned off when Td <= 55.0), 56.5-55.0 Fahrenheit for Sleep mode, and 60-57.5 Fahrenheit for Away mode.

Hereâ€™s what happened:

1. My house used to frequently have an RH >60%, sometimes as high as 65%. The RH rarely exceeds 56% now.
2. I used to never let the house get above 73F in Home mode. It can exceed that now and still feels fine.
3. I used to keep the house at 70.5-71F in Sleep mode. It is around 72-72.5F now, and feels fine.
4. Heat pump run times range from 20 minutes to > 1 hour. This has not changed from before. But overall, the heat-pump is running a little less each day.
5. While I am a biased observer, one of the ladies who has been coming home to give me some assistance keeps commenting that my AC works better than theirs because it feels good in here. As far as I remember, she never said that back in July/August.

This is what the data looks like:

Cooling run time is the length of the thermostat â€ścall for coolâ€ť. Indoor Temperature and Humidity are averages calculated from multiple sensors. The averaging algorithm periodically resets leading to dips/peaks in the data. Dew-point is calculated using the average temp/RH.

I use the August-Roche-Magnus approximation to calculate Td in NR. I got the equation from this website.

Here is my electric consumption from 9PM yesterday to 9AM today. The peaks are my heat-pump. When the peak is higher, it is in stage 2.

Here is my electric consumption from an equivalent day a few weeks ago before I started using Td to control the heat-pump. There's two examples of short-cycling (or least the heat-pump being turned off prematurely) in this profile.

I am happy to provide any of the sequences used to calculate Td or control the thermostat. But it may take me a while.

12 Likes

Cool (no pun intended). Mind posting the NR flow that calculated Td?

I'm in the gulf south, recently added an AprilAire whole-home dehumidifier. I installed this to address high indoor humidity issues after several improvements to the thermal envelope of the house (windows, attic foam, LED lighting,...). The A/C units 'became' oversized due to sensible load dramatic reduction following the improvements. I played around with different tweaks to address the high indoor humidity prior to biting the bullet on the AprilAire - lower variable speed fan CFM, reducing the compressor cycles/hr, installed two of the Honeywell T6 ZWave t-stats for each of my systems (upstairs and downstairs), and added some NR logic to manipulate set points.

So interested in your approach to control to a Td set point. With the dehumidifier installed, I wrote a Humidistat app for the Hubitat, so now I'm controlling relative humidity and temperature independently. Maybe I can use less overall energy with a variant of your approach.

Thanks for the detailed write up!

1 Like

``[{"id":"1ea41050.646bd8","type":"join","z":"74d2e0f3.800ff8","name":"Merge Temperature & Humidity","mode":"custom","build":"array","property":"payload.value","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2490,"y":1329,"wires":[["2f6922d4.083d9e"]]},{"id":"e7dfd01c.baa86","type":"hubitat device","z":"74d2e0f3.800ff8","name":"Average Temperature","server":"a22e0ea9.276dc8","deviceId":"1794","attribute":"temperature","sendEvent":false,"x":2200,"y":1300,"wires":[["706a1e0a.946868","1ea41050.646bd8"]]},{"id":"2f6922d4.083d9e","type":"function","z":"74d2e0f3.800ff8","name":"Dew-point calculator","func":"function f2c(F) {\nvar C = 5 * ((F-32)/9);\nreturn C;\n}\nfunction dpC(T,RH) {\nvar Td = 243.04 * (Math.log(RH/100)+((17.625*T)/(243.04+T)))/(17.625-Math.log(RH/100)-((17.625*T)/(243.04+T)));\nreturn Td;\n}\nfunction c2f(C) {\nvar F = parseFloat((32 + (9*(C/5))).toFixed(2));\nreturn F;\n}\nvar tempf;\ntempf = msg.payload.value[0];\nvar rel_hum;\nrel_hum = msg.payload.value[1];\nvar tempc;\ntempc = f2c(tempf);\nvar dewpointc;\ndewpointc = dpC(tempc,rel_hum);\nmsg.payload = c2f(dewpointc);\nmsg.topic = \"dewpoint\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2760,"y":1329,"wires":[["d5ef1b15.394d98"]]},{"id":"a4e7dde4.cca2b","type":"delay","z":"74d2e0f3.800ff8","name":"25ms","pauseType":"delay","timeout":"25","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2315,"y":1360,"wires":[["1ea41050.646bd8"]],"l":false},{"id":"a6fe0688.6fdb1","type":"inject","z":"74d2e0f3.800ff8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"90","topic":"","payload":"","payloadType":"str","x":1970,"y":1331,"wires":[["e7dfd01c.baa86"]]},{"id":"706a1e0a.946868","type":"hubitat device","z":"74d2e0f3.800ff8","name":"Average Humidity","server":"a22e0ea9.276dc8","deviceId":"1794","attribute":"humidity","sendEvent":false,"x":2190,"y":1360,"wires":[["a4e7dde4.cca2b"]]},{"id":"d5ef1b15.394d98","type":"mqtt out","z":"74d2e0f3.800ff8","name":"Indoor Dewpoint","topic":"dewpoint","qos":"2","retain":"true","broker":"40144fb8.a1c1e","x":2990,"y":1329,"wires":[]},{"id":"a22e0ea9.276dc8","type":"hubitat config","z":"","name":"HubitatM","usetls":false,"host":"192.168.1.46","port":"80","appId":"1522","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false},{"id":"40144fb8.a1c1e","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]``
1 Like

@aaiyar
What are your thoughts on using the simpler Dew Point estimation of Td = T - ((100 - RH)/5) since the sensors that I have are only +/- 3% accuracy for RH?

Works pretty much the same within the RH range inside homes. Iâ€™d go for it.

2 Likes

That is such a cool idea - I totally missed your original post on this. Thanks again.

1 Like

@aaiyar - thanks again for the Td control idea, I used your NR flow and code to build a Virtual Dewpoint HE app (which creates a virtual Temperature device for the computed dewpoint). I then use the Td device as the input to my Dewpoint Controller app, which controls the AprilAire dehumidifier "fan" and "dehumidify" control contacts. I'm using a pretty standard differential gap control algorithm, with a few tweaks for minimum run time, home/away states, virtual switches to represent the states of the dehumidifier, etc.

All in all working very well, and home comfort improved no matter what the thermostat temperature set point (in cooling mode at least).

3 Likes

I was just telling @erktrek earlier today that I also use dew-point control only in cooling mode.

It doesn't work well in heating mode because as the indoor humidity decreases, maintaining a dew-point requires the indoor temperature to be kept at 73-74F. While that is very comfortable in the winter, it gets expensive. So I prefer to keep the house around 70F and just wear a sweater if necessary.

2 Likes

Could you share your driver and app code here?

Sure, let me see if it's up to date in Github, then I'll post link.

1 Like

I checked this against a psychrometric chart at 75 degrees and 50% RH... the equation above gives a dewpoint of 65...chart gives 55 degrees. That seems to be too far off for comfort control, IMO.

The equation I use gives 55.11F. The simplified equation that @stephen_nutt proposed gives 57F. The psychrometric chart you consulted gives 55F. There is no difference between any of those numbers vis-a-vis comfort.

The error in your math is that you directly used degrees Fahrenheit, whereas everything I've seen indicates that approximation is meant to be used with degrees Kelvin.

FWIW, here's the correct math:

75 degrees F = 297.039K

Td = 297.037 - ((100 - 50)/5)
Td = 287.039K (which is 57.0002 F)

Edit:

For S & G, I tried comparison with a variety of common home temp/RH combinations. There is no practical difference from 60F/30%RH to 75F/65%RH.

1 Like

That would do it!

I'm looking at seeing how this approach would work for me, but I only use Hubitat apps. Can you explain how you manipulate your cooling system setpoints to achieve your target dewpoint?

I do it all in Node-RED. I'm happy to share that flow. It can be done in Hubitat apps, but I switched all my automations to Node-RED.

Basically, I shift the thermostat cooling setpoint to be 3 degrees lower than the temperature read by the thermostat. Once I shift the setpoint, every minute I start averaging 10 different temp/humidity sensors and calculate the Td. When the Td is 1.5 degrees lower than the desired dewpoint, I turn the thermostat back up to the temperature read by the thermostat.

In my house, with these settings, the compressor comes on for between 18-45 minutes continuously (the 45 minutes is when I shift from an "away" dewpoint to a "home" dewpoint). I have not seen a single instance of short-cycling yet.

And, as I was describing to @erktrek earlier today, this method only works for cooling. I cannot use dewpoint comfort during heating because it tries to make the house comfortable when the humidity is low, which means 73-74F, which gets too expensive. I'd rather keep it a little colder, and leave the money in my wallet.

1 Like

Do you find this to be necessary? I only have the humidity sensor in my ecobee...I can see how this might not operate smoothly with only one sensor.

I wonder what it would take to build a "smart" wet-bulb temperature sensor? Probably not worth the effort... or the potential for leakage and damage.

Necessary? No. Desirable. Yes.

I had an ecobee as well. My indoor comfort is way better now during the summer, even though the ecobee had a function to dehumidify by over-cooling.

It should be possible to build an arduino-based wet bulb thermometer. And thereâ€™s a Hubitat arduino integration written by @ogiewon. Iâ€™ve never used it, but many others have built amazing devices,

2 Likes

Aside from Mr. Epstein's observation on comfort, your dewpoint targets are spot-on with a 2019 ASHRAE addendum to Standard 62.1. which indicates a maximum 60 degree dewpoint for preventing mold and microbial growth and for reducing energy while noting that values closer to 55 degrees offer increased comfort.

Thanks for posting this and for all your follow-up. I'm planning to optimize my AC system performance over the course of the summer and I think dewpoint is going to be a significant part.

3 Likes

@marktheknife, the Dewpoint virtual device app is here.

4 Likes

When I imported the code I got an error. Something similar to Expected ')' on line 23 column 5, found 'iconURL'

I'm not a coder, but it looked like there was a comma missing at the end of line 22 (importURL....). I added the comma and the error went away. App seems to be running fine.

1 Like

Oops, I added that import URL for convenience, left out the comma. Apologies.

1 Like