GrowOS - DIY Arduino CO2/Temp/Hum Automation

Hello everyone,

I wanna share with you my DIY Arduino project that controls CO2, Temperature and Humidity levels. As far as I've seen most commercial solutions tackle those variables independently, the purpose of my project is to have them talk to each-other and work together. Right now I'm in the testing stage of development and there are a few bugs to work out, but its generally going pretty well and the plants seem to love it ! When everything is ironed out I will share the schematics and code for interested parties to duplicate. The cost should not exceed 200$.

So the logic behind GrowOS:

If it's dark, keep the exhaust vent running on the LOW setting while monitoring for Temperature and Humidity levels. If those levels are exceeded the exhaust fan kicks in at HIGH or a dehumidifier is turned on (depending on max temp or max hum).

If it's day, check CO2 PPM levels, pump CO2 and maintain it at a predefined level (e.g. 1500ppm). If levels drop below the predefined delta ppm value (e.g 200ppm) the CO2 is engaged to bring levels up to 1500 again. While this constant CO2 monitoring/spraying routine is engaged the system keeps track of Temperature and Humidity levels as well. If the dehumidifier is unable to bring humidity levels to an acceptable range the CO2 stops and the exhaust fan kicks in at HIGH setting as a last resort until we have acceptable temperature or humidity levels again.

The display shows Temperature, Humidity, CO2 PPM and the state of each relay (right now the second line has temporary debug data).
A rotary encoder is used to program the device. If the button is pressed for more than 1.5 seconds GrowOS enters programming mode.
In programming mode you are requested to enter the values for: Max Temp, Delta Temp, Max Hum, Delta Hum, Dehum, Delta Dehum, Max PPM, Delta PPM.
To describe"Delta" I will give an example: If we have our Max Temp at 35c and our Delta Temp at 10c, the exhaust vent will engage when temperature exceeds 35c but will only stop when temperature is brought down to 25c (35 - 10 = 25).

The hardware used:

Arduino Uno clone (Funduino)
A photoresistor (light sensor)
MH-Z16 NDIR CO2 Sensor with I2C interface
DHT22 Temperature / Humidity sensor
A 4 relay board for arduino.

All sensors were neatly packed in a box that resides in the grow room, mounted on a telescopic pole to match canopy height.
The relays are in a bigger box but I still need to add a separate 5v transformer in that box for the relays.







 

bizfactory

Well-Known Member
Amazing work! How is it working out in reality? The temp humidity control with the delta is a very interesting idea. Is there any way to log the data over time to usb or something?
 
Thanks man!
It's operating clockwork although I'm having the occasional crash problem when the CO2 sensor is turned on sometimes, still working that out. Other than that I had some issues with power because I was feeding the arduino 12v and the internal regulator got really hot trying to convert those 12v to 5v, so I ended up using a 7.5vdc 1A power supply instead... and added another 5v 1A power supply inside the relay box. That solved the power/overheating issues. I also added a capacitor inside the sensor array box.

Here's a connection diagram for now .. code may follow:

p.s.
Data logging/graphs etc are doable, also a wifi module to allow internet connectivity/control
 

DISTRESS0R

Active Member
nteresting idea. Is there any way to log the data over time to usb or something?
This is awesomei will be following your posts. I currently have an Arduino mega free for this very purpose (but to also control lighting hopefully down the road too)
 

razorbac

Active Member
HI casabonita420, first of all thank you for sharing your beautiful project to the community. And now...yesterday I ordered all the components that you used in your project, and some others sensor like soil moisture, and 8 relay board, Ethernet shield, rtc. I want to try to add some variables to the system. My grow room is situated in a portion of house that is very cold in winter so I have to implement a heater, but a heater could decrease the humidity so I want control an humidifier too. And finally auto watering but isn't mandatory. I can upload here all update if you are agree :) and in this time of testing did you notice some bug with the actual code?
 
Hey razorbac, I have developed it further so here's some notes:

- Use an LCD with i2c interface, much simpler, no need for all the wires I have. Also go with a 20x4, much nicer.
- Use a seperate dc-dc regulator that draws power from the 7.5dc input and tune it to 5v. If you have devices/sensors that use 3.3 you can hook up another regulator on the 5v and tune it to 3.3v. This way you're not overloading the arduino and its built in regulator.
- The DHT22 is very basic, I tried a more expensive Bosch bme280 but the reported temperature is always +2 or +3 C above the real temperature. I didn't like the sensor, got a replacement and it reported wrong readings too. I calibrated it as described in the bosch datasheet by baking it at 120c 5% etc and its still problematic. I'm waiting for a Sensirion SHT31-D now to try out.
- For the exhaust fan, I think its best to wire it on NC of the Relay so even if the arduino hangs/freezes or whatever the Exhaust Fan doesn't stop operating. You will need a small modification to the code.

There are a few parts you can use from this code for your project, like the programming menu, rotary encoder stuff.
Adding variables like a heater or humidifier is easy too...

Go ahead and upload your stuff here too if you want, no problem with me. Good luck with your project!
 

VegasWinner

Well-Known Member
Hello everyone,

I wanna share with you my DIY Arduino project that controls CO2, Temperature and Humidity levels. As far as I've seen most commercial solutions tackle those variables independently, the purpose of my project is to have them talk to each-other and work together. Right now I'm in the testing stage of development and there are a few bugs to work out, but its generally going pretty well and the plants seem to love it ! When everything is ironed out I will share the schematics and code for interested parties to duplicate. The cost should not exceed 200$.

So the logic behind GrowOS:

If it's dark, keep the exhaust vent running on the LOW setting while monitoring for Temperature and Humidity levels. If those levels are exceeded the exhaust fan kicks in at HIGH or a dehumidifier is turned on (depending on max temp or max hum).

If it's day, check CO2 PPM levels, pump CO2 and maintain it at a predefined level (e.g. 1500ppm). If levels drop below the predefined delta ppm value (e.g 200ppm) the CO2 is engaged to bring levels up to 1500 again. While this constant CO2 monitoring/spraying routine is engaged the system keeps track of Temperature and Humidity levels as well. If the dehumidifier is unable to bring humidity levels to an acceptable range the CO2 stops and the exhaust fan kicks in at HIGH setting as a last resort until we have acceptable temperature or humidity levels again.

The display shows Temperature, Humidity, CO2 PPM and the state of each relay (right now the second line has temporary debug data).
A rotary encoder is used to program the device. If the button is pressed for more than 1.5 seconds GrowOS enters programming mode.
In programming mode you are requested to enter the values for: Max Temp, Delta Temp, Max Hum, Delta Hum, Dehum, Delta Dehum, Max PPM, Delta PPM.
To describe"Delta" I will give an example: If we have our Max Temp at 35c and our Delta Temp at 10c, the exhaust vent will engage when temperature exceeds 35c but will only stop when temperature is brought down to 25c (35 - 10 = 25).

The hardware used:

Arduino Uno clone (Funduino)
A photoresistor (light sensor)
MH-Z16 NDIR CO2 Sensor with I2C interface
DHT22 Temperature / Humidity sensor
A 4 relay board for arduino.

All sensors were neatly packed in a box that resides in the grow room, mounted on a telescopic pole to match canopy height.
The relays are in a bigger box but I still need to add a separate 5v transformer in that box for the relays.







I love it. beautiful approach and package. Will you set up a Github account for sharing the code too? peace great job
 

razorbac

Active Member
Hey razorbac, I have developed it further so here's some notes:

- Use an LCD with i2c interface, much simpler, no need for all the wires I have. Also go with a 20x4, much nicer.
- Use a seperate dc-dc regulator that draws power from the 7.5dc input and tune it to 5v. If you have devices/sensors that use 3.3 you can hook up another regulator on the 5v and tune it to 3.3v. This way you're not overloading the arduino and its built in regulator.
- The DHT22 is very basic, I tried a more expensive Bosch bme280 but the reported temperature is always +2 or +3 C above the real temperature. I didn't like the sensor, got a replacement and it reported wrong readings too. I calibrated it as described in the bosch datasheet by baking it at 120c 5% etc and its still problematic. I'm waiting for a Sensirion SHT31-D now to try out.
- For the exhaust fan, I think its best to wire it on NC of the Relay so even if the arduino hangs/freezes or whatever the Exhaust Fan doesn't stop operating. You will need a small modification to the code.

There are a few parts you can use from this code for your project, like the programming menu, rotary encoder stuff.
Adding variables like a heater or humidifier is easy too...

Go ahead and upload your stuff here too if you want, no problem with me. Good luck with your project!
Thank you for the update :) but I can connect the LCD via i2c and the co2 sensor at the same time? I'm at the very beginning with coding I'm better with soldering stuff :)

I love it. beautiful approach and package. Will you set up a Github account for sharing the code too? peace great job
Good idea :) for now I have to wait the components. Something like 30/40 day to receive it from China
 
Thank you for the update :) but I can connect the LCD via i2c and the co2 sensor at the same time? I'm at the very beginning with coding I'm better with soldering stuff :)
you can have multiple sensors/devices all sharing the i2c lines, meaning all the i2c devices will share the two hardware connections SCL/SDA. Then each device has a fixed (or variable to a limited degree) address (e.g. 0x27 for LCD). You can google and download a sketch called "i2c Scanner" which will print on the serial monitor which addresses(devices) you have connected. Anyhow, you're better off getting help on the arduino forum for this stuff, i'm pretty much a begginer like you.
 

razorbac

Active Member
you can have multiple sensors/devices all sharing the i2c lines, meaning all the i2c devices will share the two hardware connections SCL/SDA. Then each device has a fixed (or variable to a limited degree) address (e.g. 0x27 for LCD). You can google and download a sketch called "i2c Scanner" which will print on the serial monitor which addresses(devices) you have connected. Anyhow, you're better off getting help on the arduino forum for this stuff, i'm pretty much a begginer like you.
Ok thank you for your tips. I will start to learn more about coding during this period of waiting for the components :)
 
I don't see why not. I've been looking at this sensor the past days too...Comparing the datasheets the only difference I could spot was the response time (higher on the Z19), other than that and the price (Z19 is cheaper) they seem identical. I like tha casing of the Z16 better though.
 

Seriousbuds

Active Member
This project is so freaking awesome man. I'm going to wait until you work the bugs out, but after that I'm going to follow suit!

Thanks for a great guide and contribution.
 

Seriousbuds

Active Member
I don't see why not. I've been looking at this sensor the past days too...Comparing the datasheets the only difference I could spot was the response time (higher on the Z19), other than that and the price (Z19 is cheaper) they seem identical. I like tha casing of the Z16 better though.
Yes you're right, you will have better luck with your version because of the casing, I think.
 

razorbac

Active Member
Casabonita can you share the actual code that you are running now? :) so I can start to study it to apply my modifications :)
 

razorbac

Active Member
You can make a jumper block with SCL/SDA pins for multiple devices. Each device has their own address.
Peace
Yeah after a little bit of mind refreshing I remember how it works. I used i2c protocol for my old quadcopter FC (basically an arduous mega repacked) and his sensor. Thank you for the tips anyway :)
 

razorbac

Active Member
Yeah after a little bit of mind refreshing I remember how it works. I used i2c protocol for my old quadcopter FC (basically an arduous mega repacked) and his sensor. Thank you for the tips anyway :)
Another thing that maybe is obvious, if I decide to use the i2c LCD I have to switch to i2c mode the co2 sensor too and not maintaining it in uart mode right?
 
Top