I am working on a project building a system to automate much of the tasks in my home garden. For a few weeks now I have had the system setup to control a humidifier as well as have a sensor to read the current humidity. I have been reading the humidity every minute and my program has a min and max humidity set, if the humidity goes below the min it kicks on my humidifier and if it goes above the max it kicks on my exhaust fans. I have also set the system up to log the temp and humidity reading every time it updates to a database. What I am looking to do is write an algorithm that will take this data and calculate when it needs to turn the humidifier on/off to keep the humidity in the tent as stable as possible. Right now if you look at the humidity data it is consistently being brought up to just under the max when the humidifier is running (I have it setup to shut off when it reaches 3/4 of the max humidity) and then dropping back down to the min humidity. The humidifier is a warm vapour humidifier so it takes a few minutes to heat up every time it kicks on. I want to write something that would look at past data, look at all these factors and calculate when it should turn the humidifier on or off to try and keep a steady base humidity but, I am not really sure where to start or what to google to work toward an answer. Any info anyone could provide would be greatly appreciated. I apologise if I am not giving a great description and feel free to ask me for more details.

  • $\begingroup$ Primarily out of curiosity, are you looking to keep the relative humidity constant or the dew point constant? The latter is probably an easier goal. $\endgroup$
    – user4710
    Dec 18, 2016 at 8:39
  • $\begingroup$ If you want to keep it stable at the midpoint between min and max, then why does it not shut off until it reaches 3/4 max? surely you want to shut it off before it reaches even halfway. That much doesn't need any learning. $\endgroup$
    – Sean Owen
    Dec 18, 2016 at 10:30
  • $\begingroup$ Right now the idea is just to keep it withing the set range for as long as possible but, I don't like this solution it just worked well for prototyping the system. I would now like to make it smarter $\endgroup$ Dec 18, 2016 at 21:43
  • $\begingroup$ @BarryCarter I would be open to either if you think it would be easier to start with dew point I would love to give that a try and then go from there. Any ideas where to start on making that happen? Also, thanks for the reply! $\endgroup$ Dec 18, 2016 at 21:44

1 Answer 1


This sounds like something you might want to do with a PID or Kalman Filter. It'd probably work better than a complex machine learning model. The humidity is probably cyclical in nature and if you can just tighten the loop a bit, you should be able to achieve your result with a simple PID.

Something like this might be what you're looking for:-

PID example



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.