Jump to content

- - - - -

Arduino based climate controller

  • Please log in to reply
19 replies to this topic

#1 Acidictoes



  • Free Member
  • 15 posts

Posted 09 March 2019 - 08:25 PM


Im pretty new to growing, and i dont have time to mist and air my chamber when i should.

So I made this climate controller to help me get started with my growing.

Its still a prototype, and I still add`s features. so it would be nice with some thoughts and ideas :)

This is an entusiast project, i`m not a coder, but i can make it work. Maybe someone have some coding tips as well :)

So far, it kind of work(two fruiting cycles so far)

I have some tweakes and new features planned.

So far it controlles;



*CO2 level






    Humidity has two settings, Low and High. it will try to hold the value between those settings


              When humidity is under low, the ultrasonic fogger will engage

              When humidty is over high, the fan will let in new air.

              Between, nothing (just 20% circulation fan, to circulate the air)


*CO2 Level

    CO2 Level has one setting, ppm level. It will try to hold the CO2 level under the limit.


             When CO2 level is higher then threshold set, change air.



       Temperature has two settings, Low and High. it will try to hold the value between those settings


              When temperature is under low, the heater will engage.

              When temp is two degrees under set value, it will alternate the heater 2 sec on and 2 sec off. this to not overshoot (This may be changeable setting later)

              When temp is over high, the fan will let in new air.

              Between, nothing (just 20% circulation fan, to circulate the air)



     The fans has 3 settings.

        Circulation fan speed, New air fan speed and change air interval time

        The fan speeds can be set from 0 to 100%, and the "change air interval time" can be set from 1 to 360 minutes(6hours)

        Circulation fan will engage when fogger or heater is on, else it will stay on 20 %(may become adjustable)

        New air fan will engage when any alarm is over high threshold

        When "change air interval time " hits is target, it will set the new air fan at 100% for 30sec (This one may be adjustable later)


All alrms has an indicator at the homesceen, its 3 squeres.

If the squere has a dot inside, its under low value.

If the squere has a ring outside, its over high value.

The interval time is displayed at the homescreen as, minutes left and inteval time

The low and high settings is also displayed at the homescreen in the bars (high is thicker then low)


Thinking about to make the set button on the homescreen to engage the fogger.

I dont think i need a timed interval for fogging, couse it will fog everytime time the change air interval gets humity under threshold. 

Maybe a light interval controller.


Im sure there is a lot of things i havend described here jet, i think i will see if there is any response before i go further :)


some pictures from the project;






If anyone is interested in this project, i will be very happy too hear some thoughts and ideas around this project.

Maybe it could be an open source project :)

Attached Thumbnails

  • 20190227_154421289_iOS.jpg
  • 20190227_154521165_iOS.jpg
  • 20190227_154636812_iOS.jpg
  • 20190227_154701272_iOS.jpg

Edited by Acidictoes, 09 March 2019 - 08:33 PM.

  • mushit, mushfun, Advocate4TheMT and 1 other like this

#2 RutgerHauer


    Knows Nothing

  • Free Member
  • 820 posts

Awards Bar:

Posted 09 March 2019 - 08:45 PM

Awesome, great job! I came to know about arduino through music/sound programming and have fiddled around with it, but this is also a great use of this open technology. Cannot give you any tips, but I am happy to follow your project. Good luck!

#3 mushit


    Shit Lover

  • OG VIP
  • 2,164 posts

Awards Bar:

Posted 09 March 2019 - 09:04 PM

Great project!

I am designing a temperature controller for my beer fermenting chamber.  Around the same ideas you are describing.

The circuit board I designed uses the barebones Atmega with the required connections.


Are you driving relays or SSR's with the Arduino?


What type of board is that in the pic?

#4 Acidictoes



  • Free Member
  • 15 posts

Posted 10 March 2019 - 02:59 AM

Thanks :)


Its an Atmega328p, Arduino Nano board.

I use simple relays to control fogger and heater.

and a integrated max1515 IC (motordriver) to control the fans

#5 Acidictoes



  • Free Member
  • 15 posts

Posted 11 March 2019 - 09:48 AM

Had my first real problem with the system today...



When co2 is over the set threshold, it will blows out the air to get new fresh air.

And when the humidiy gets below set threshold(cause of blowout) it will engage the fogger to behold the humidity.

until now this has worked fine.

One cake was newly dunked.

after that the co2 level is way higher then before, and cant get it to "normal" level again...

so the system is constantly blowing air out and rehumidifying the chamber.

Its overfogging a lot...


i have disengaged the co2 threshold for now, and may dump the whole idea of the co2 sensor function as well.

Maybe the timer based blowout is enough..?


The co2 sensor that is used is not a dedicated co2 sensor... its a relative air sensor. mq135

Dedicated co2 sensors are expensive, mq135 is very cheap.

Mq135 can smell co2, amonium, alcohol and other gases as well.

So the "high co2 level" can indicate that there is a contaminated going on.

  • RutgerHauer likes this

#6 RutgerHauer


    Knows Nothing

  • Free Member
  • 820 posts

Awards Bar:

Posted 11 March 2019 - 01:46 PM

If you can read out alcohol you might be able check for yeast contaminations.. but that is also an obvious smell..

Can you go the other way around and check oxygen? Since that's what they need..

Edited by RutgerHauer, 11 March 2019 - 01:47 PM.

#7 Acidictoes



  • Free Member
  • 15 posts

Posted 11 March 2019 - 03:23 PM

the sensor is really sensitive to alcohol and ammonium compared to co2.

so very small amount of alcohol gas can give the same result as high co2.


the plan was to have two air sensors, one at the outside, and one inside the chamber. compare the result and have a setting to change how much differense is allowed.

I`ve started to see for oxygen sensors at first, but found them too expensive for a function i dont know how nessesery it is.

then i looked for co2 sensors, same story...

and ended up with this mq135 sensor


I still cant make my mind...

maybe i  just let the sensor stay, and remove the threshold fuction, nice to see air quality.

  • RutgerHauer likes this

#8 Myc


    El Jardinero

  • App Administrator
  • 6,927 posts

Awards Bar:

Posted 11 March 2019 - 04:45 PM

I think your earlier post had it right. If you're trying to control a very small environment - less than 36 cubic feet - you're going to experience rebound difficulties unless you can dial-in a serious number of variables. 


The simpler approach would be to create a two-pole timer. 

One section to operate the "fogger" just long enough to humidify the enclosure without causing saturation and condensation. Otherwise, you'll have pooled condensate to deal with - as you've noted, the fogger uses quite a bit of water. 

The other timer section to operate the purge fan for Fresh Air Exchange (fanning).


Most guys who just mist and fan will advise 3 times a day for FAE and misting just after fanning. 

You could arrange a simple 3-part or 4-part timer cycle around a 24 hr scheme without being too complicated. Your biggest challenge will be deciding the running duration of the fog so as not to overwhelm the enclosure with condensate. 


In a larger cabinet - say 36 cubic feet and larger - you could arrange your sensors as "alarms" to detect the excessive presence of co2 and other gasses or to monitor for low relative humidity. Either of these "alarms" could trigger a timer cycle override to temporarily mitigate the conditions until you have time to check. 

You may also find that humidistats can be inaccurate and are easily overwhelmed by 100% humidity (as in while the fogger is running). They don't last long in high-humidity environments - but seem to do OK in larger enclosures. 

Edited by Myc, 11 March 2019 - 04:48 PM.

  • newmoon likes this

#9 Acidictoes



  • Free Member
  • 15 posts

Posted 09 April 2019 - 02:38 PM

Hard work to get stressless :P

Updated the system with an extra timer.

So now it got one timer for fogging, and one timer for fresh air.

Independent of each other.

seems to work pretty well :)


There is more then i thought that have to be different in this setup comparing a manual chamber.

Basicly i have to drain the chamber, set the cakes on a coated metal grate, avoid perlite at bottom and avoid verm-coating after dunking.

Had some cakes that got contaminated after second flush, and had a teory that the verm is holder the water "still" and get sour after some time.

So i`m now testing no verm after dunk.

its so humid in there that it accumulate small drops of water on the cakes that roll off when they get big enoug. the cakes are never free of droplets, so i dont think i need the verm-coat.

Have a naked cake in its third flush, and it looks fine(some brusing after touching it and harvesting).

the cakes produce a lot more now then before :)

some pics


IMG_0413.jpg IMG_0412.jpg IMG_0410.jpg


Any thoughts??


The microchip is at 94% use of memory, so i dont have room for any more functions.

I`m not a professional coder, just an entusiast.

So code could be coded a lot more efficient i quess.

Thats one of the reasons why I`m now working on a 2.0 system

2.0 does not use arduino (atmel) chip

Its a "STM32 blue pill" ARM chip

A lot faster and way more memory

If there is someone that wish to join the project, your welcome!

The most significant with the 2.0 comparing 1.0 will be;

320x240 color touchsceen


Internal realays for temp, fog and light controll intead of external.

no physical buttons or potmeter, just touch(beside powerswitch)

Light control

Temp measure outside of the box aswell as inside, need it for multiple reasons

Maybe a waterpump and some filters to resirculate the drained water

Would be nice with internet accsess as well to broadcast the alarms to my phone, but that would be a addon accessory if i deside to do so

  • PistolPete13 likes this

#10 PistolPete13



  • Free Member
  • 209 posts

Posted 09 April 2019 - 03:24 PM


If there is someone that wish to join the project, your welcome!


I would love too! I am super busy for the next two weeks but after that I will have the time.


Have you looked into PID's? There is a fully functioning PID library at Arduino playground.



  • FesterAddams likes this

#11 Acidictoes



  • Free Member
  • 15 posts

Posted 09 April 2019 - 03:44 PM


sorry for late answer, i read your message from my phone and thought to anwer you from my pc. but i forgot...

I think i did what you wrote about the fogger timer.
Earlyer i could not hold the system without overfloding it.

It could hold what ever humidity i chose, but began to be tricky when i had to adjust more and more fogging due to signs of dry pins and fruits.

If I was aiming for how people do it manually, illd just set a sprayer on a servo to sweep on a timer + air exchange.

But i chose to do it like this couse i aimed for a system that was tuneable, and hopefully could tweek it too max productivity.


For my eyes it looks promising, but little do I know about growing...

What will you say if you look at images at my post over this one?

do they look healthy?

Why do some of them get white spots at early age, is it myc from the cake?

#12 Acidictoes



  • Free Member
  • 15 posts

Posted 09 April 2019 - 04:03 PM



If there is someone that wish to join the project, your welcome!


I would love too! I am super busy for the next two weeks but after that I will have the time.


Have you looked into PID's? There is a fully functioning PID library at Arduino playground.




Hi PistolPete13!

Nice! your more than welcome :)

Its not a hurry, join whenever you like.

I thought to add pid`s for the humidity, heater and the fans. But after some thought i chose not to.

Its not needed for my opinion in general, but would have been nice to make some functions smoother.

2.0 can be with PID`s :)

Are you familiar with stm32 "blue pill"?

or, and too modify lib`s to other controllers then atmel?

Have a hard time to find all libs i want to the stm32duino core...

#13 newmoon



  • VIP
  • 121 posts

Posted 10 April 2019 - 12:15 AM

Very cool project!


I think PID control is probably more trouble than necessary. Your time constants will be quite large, and it's also not clear to me how you would apply continuous control outputs to what are basically on/off systems in this case - PWM control is fine for a fan, potentially, but will probably destroy your humidifier quickly. I think on/off control with a deadband, like you're using, is appropriate for all parameters. If you do want PID control to better hit humidity, you'll want to tune it to be very sluggish (overdamped) to avoid overshoot, which will be bad news in this case. I expect it may not be an easy problem.


I echo Myc's concern about the lifespan of the humidity sensor. I think your gas sensor will also likely die quickly, as condensation is very rough on electrochemical hotplate sensors like the one you're using. Note in its datasheet the 95% maximum humidity rating. Possibly you could mount it within a dry chamber with a gas-permeable membrane (maybe even parafilm would work?), but I haven't tried this and don't know how effective it would be.


I think Arduino should be able to handle this project. Is your graphics library taking up most of the uC's memory?

#14 Acidictoes



  • Free Member
  • 15 posts

Posted 10 April 2019 - 10:38 AM

newmoon, your right!

PID control for relays directly is no good.

had some ideas to use it for a switch function for the alarm, so the relays dont go crazy when a alarm is floating around the triggerpoint. but have another better solutions for that now.


conserning the sensors;

I thought so as well.

But they have been alive now since christmas, and they are on their own module and have contacs for switching them out.

they are very cheap, got a lot of them :)

the module could easly get rebuild for other sensors, got some spear pins in the cable free for the future.

I`ve started with does sensors couse i`ve would like to test the system before i used a lot of money on expensive sensors.

I use dht22, it has a 100% humidity operating range

and -+2% accuracy.

works fine.

dht11 is as you described :)

There was one time the dht22 was in a error state. that was water on the circuit thats not yet enclosed (on the 2do list, draw a enclosure for the sensors to 3dprint)



1.0 has only a small oled screen. and does not have room for fancy stuff.

The hardest work for the sceen is too operate 3 bars at once, temp humidity gas.

the dynamic memory is only at 41%

I dont know how much the lib take.

I know there is more efficiant graphic libs out there, maybe i should look it out.

I`m kind of keen to operate it just with touch, and have a bigger screen(and colors,fancyfancy :P).

at 1.0 a used allmost all io`s accessable so there is kind of a limitation there as well.

so i think it would be nice with a better controller than atmega328p for the 2.0 system

#15 newmoon



  • VIP
  • 121 posts

Posted 10 April 2019 - 11:31 PM

Good to know about the sensors!


As far as better controllers, I've had good luck with the adafruit feather m0 line. You can still program them with the Arduino framework and the cost is comparable. They have 256k flash, which should be plenty.


Sounds like you've figured it out, but a deadband/hysteresis is the easiest approach to keeping things calm around setpoints.


Looking forward to seeing your v2!

#16 Acidictoes



  • Free Member
  • 15 posts

Posted 12 April 2019 - 08:24 AM

Latest flush


  • PinkMenace likes this

#17 Acidictoes



  • Free Member
  • 15 posts

Posted 14 April 2019 - 12:59 PM

So i`m making this outcast for the V2

and needs some thoughts and ideas!


This is what i got so far;


to include;


timer air/fogger/light
settings list
pump (floater controlled or timed) recirculate water
Filter for cleaning water

Water tank
Save setpoints




Pump with floaterswitch or timer?
  Timer has no parts, accuire no space +
  Timer has no accurate control, has to be timed well -


Contamination alarm

Stability level
SD card log graf

bottom wash (manual button)




Startup animation and sound:





Humidity w/setpoints (like v1) Alarms
Gas       w/setpoints (like V1) Alarms
Temp     w/setpoints (like V1) Alarms

Timers  setpoint and countdown Alarm Fogger, airexchange, Light

Light override switch

Settings;  (the grey star)


humidity limits
temp limits
Gas limit
timers (Fogger, airexchange, Light)



V2.0 homescreen.jpg


Need to know what to include, and how to design the homescreen and the settings screens before the project can begin.

If anybody want to draw their own outcast, you can use paint, and set the size to 320x240 pixels. Text size can be at 8, 16,  28 or 48 (not confirmed)


Test of hardware

Is it possible to post videos directly?


Edited by Acidictoes, 14 April 2019 - 01:26 PM.

#18 raymycoto



  • Gold VIP
  • 590 posts

Awards Bar:

Posted 15 April 2019 - 03:23 PM

I have a similar project using Arduino although I'm trying to implement different cycling of humidity, air flow and evacuation of the FC via a vent fan in order to simulate the cycles of mist and fan.  But all this stuff is just programming. Not really sure if cycling that stuff is important.


But I have an idea you might consider. Programming the UI is sort of the biggest pain for my (and your) project. In addition, the need on your project to actually have a display for climate and input is a bit of a pain. What if you could do it on your phone instead with a super nice display, multiples screens and all sorts of tactile inputs. And what if you could change parameters and read climate and alarm conditions from anywhere?


Look at this app designed for remote, full duplex communication with your project via your phone.


So far I have just been messing with the hardware on the Arduino side and using the serial IO for data in and out. I have not implemented the needed WiFi interface on my Arduino so that I can use the Blynk app.


But it looks like it could greatly simplify the project. And it would be really cool to control and read data from anywhere.


I'm planning on controlling

  • internal air circ (fan)
  • external air input (duct fan)
  • temperature (have seedling mats on the floor of the FC and an external room space heater connected together)
  • humidity (cool mist ultrasonic)
  • lights (LED bulb)

I'm monitoring

  • humidity (DHT11 - a got a few. they are cheap. Will prob monitor at several spots because I have the ports and hardware)
  • temperature (DHT does this as well)
  • humidifier status (water level or current flow to device or weight - detect fault or water level or out-of-water)

I'm curious about how your CO2 monitoring works out. I have use the MQ135 before but for volatile solvents although indeed it does show a sensitivity to CO2 as per the graphic chart describing its response curve. I had never noted that it was responsive to CO2. I briefly looked at a couple of youtubes on using it for CO2 sensing and seems that some folks have problems with it.


I agree with your thought that CO2 monitoring is probably not needed. I think there will be ton's of air exchange or air leak in most grow chambers in proportion to the amount of growing material. Although it would be really cool to monitor - why not gather that info?


Are you doing proportional control with your fans? I note that the MAX1515 seems to be more suited for power supply regulation and has a rather low voltage output. You could also do PWM out of the Arduino into a FET or IGBT to control your fans. I'm using a relay as my fan is 120VAC and I just want it on or off (for now).

Edited by raymycoto, 15 April 2019 - 03:26 PM.

#19 Acidictoes



  • Free Member
  • 15 posts

Posted 16 April 2019 - 12:50 AM

Hi Mycotopiate!

Nice project you have ;)


I find screens pretty fun!

Could make a extention for blynk!

But i dont findt it easy to work with!

Maybe you have a nice tutorial link or something?

Remember i had a struggle to get values back on my phone...

And to get it free i need to set up a private blynk server.


Circulation fan;


I had mine set to 20% as normal, and 80% at any blowout alarms.

The shrooms did not like that little wind!

They started to get rynkles at the stem and the cap. (humidity is always over 99%)

So i disabled fan at normal.

Circulation fan is now active when fogging and air exchange



Go for DHT22 if you want cheap sensors

way more accurate then DHT11, and it has 100% humidity operating range

and -+2% accuracy.

Think thay are 2x dht11 price, but worth it!



CO2 sensor;


MQ135 works pretty well! it sense my breath, and its hypersensitive for alcohol, amonium and others.

Find it useful, but not necessary!

It can smell contaminations!

and makes it easyer to identify some problems.

Mine has a setpoint. Fresh air is engaged when its too bad air


Both, V1 and V2 use the mx1515 to control the fans :)

#20 raymycoto



  • Gold VIP
  • 590 posts

Awards Bar:

Posted 16 April 2019 - 11:21 AM

Will reply in more detail soon. Thanks for the tips. Blynk does not require you to set up a server. That's what's cool about it.


You generate a unique 'token' on you phone. This is used by the Blynk server to identify the bidirectional data to and from your device to your phone through the Blynk server. The phone and Arduino both have the token for identification.


There is a way to set up your own server and do this without Blynk. I am on a makerspace forum where there are folks who can do that and I've worked through it but it's more than I have the bandwidth to do now.


I'll find a tutorial. I have seen a couple of good ones.

Like Mycotopia? Become a member today!