DIY Grow Room Automation w/ Node-Red

Home Assistant automation projects, questions, etc. go here.
User avatar
gvbz
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 37
Joined: Thu Apr 02, 2020 3:30 pm

After about a year of getting into the hobby of indoor growing, I wanted to share my adventures in building a fully automated grow room. A lot has been learned along the way and the recent posts from LEDG regarding automation using Home Assistant inspired me to post what I've been doing. I have a fair amount of experience with industrial PLC, HMI and SCADA programming, but nothing else aside from a bit of C# when starting all of the Raspberry Pi and Arduino stuff. When I first built the room I ended up using an Arduino mega, DHT22 temp/humidity sensor and a cheap 8-channel relay card from Amazon, which triggers electrical outlets throughout the room. I had grand ideas of implementing ultrasonic level, soil moisture sensors, pH dosing control and so on, but after growing with a drain to waste coco coir system for a while, I prioritized what was useful for me solely based on how I grew. When watering I always shoot for 10-20% runoff the first feed, and then add feedings as necessary based on how the plant is doing. I'm always watching my plants and if my coco is dry enough to trigger a moisture sensor, I've got bigger problems like blindness or something. I never ended up using moisture sensor for anything but flooding, which has definitely happened a few times. When filling my reservoir with an RO feed on a float valve, I mix my nutrients, adjust pH using a Bluelabs meter, then put away the probe in storage solution to preserve lifespan. There's usually no reason for me to constantly monitor and adjust pH with mineral based nutrients (Jacks 321), I check runoff pH and EC if I have issues and that's it. Maybe in the future there could be some sort of auto-batching system made to fill a reservoir, batch nutrients and then adjust pH, but as a new grower I've been doing this by hand to understand the changing needs of the plants throughout their life-cycle. Here are a few pictures of my room and electrical cabinet:
panel_inside.jpg
panel_outside.jpg
wiring_progress.jpg
logic660s.jpg
complete_room.jpg

The ChilLED Logic 660 lights are on 220v power for efficiency, so the smaller amazon relays trigger good quality 3-pole relays. I also found out the hard way you need a decent relay to power a 1500W heater, I ended up using a 30A solid state after melting the first 15A mechanical:
burnt_relay.jpg

So now that you understand a bit about how I'm growing and what's helpful to me in regards to automation, I wanted to explain a bit of how the room is controlled. I'm not running any CO2 nor have a split AC unit at this time, 6" 440cfm EC fans are used to intake cold air from a lung room, and exhaust hot air outside through a carbon filter. I'm running a large dehumidifier (which spits out way too much damn heat), 1500W oil heater and humidifier. Everything that requires it, drains to a bin in the room with a simple level bulb sump pump installed. From all the reading I've done one of the most important factors to any grow is a dialed in environment, so that was my goal, control the outlets with set points for day and night. Everything was controlled by the Arduino, relays and a DHT22 using hard-coded set-points. Things where great, I was learning about Arduino code and the room was basically on autopilot. I forgot to mention I had a Raspberry Pi and touchscreen laying around which was installed in a separate cabinet to easily monitor the Arduino over WiFi. After getting tired of uploading new code for set-point changes and realizing the Arduino is kind of archaic, I started looking at different ways to do things which eventually led to Node-Red, a flow based application development IDE:


I'm not going to explain Node-Red because there are plenty of videos for that, but I found it extremely powerful and intuitive. I immediately loaded it onto the Raspberry Pi and got working. A few months later I have what feels like a pretty good web application similar to something like Trolmaster, but completely wireless and about 2000$ cheaper. Initially I was using the DHT22 and 8-relay board concept, and will continue to do so in my flower room, but have since added a veg tent with full wireless control thanks to ideas from the amazing Home Assistant videos being dropped lately. With the recent addition of TPlink WiFi plugs and a RuuviTag sensor, this DIY controller project is starting to feel like something worthy of sharing. The RuuviTag is a 29 euro wireless temperature/humidity sensor with a high quality Bosch BME280 sensor, it is completely open source and integrates into Node-Red using BLE (Bluetooth Low Energy) scanning. With 5 TPlink WiFi outlets, a RuuviTag/DHT22 and a Raspberry Pi you can achieve some pretty crazy low-cost wireless automation. Looking back I never needed to hard wire any relays, outlets or sensors, and spent way too much money screwing around with cabinets trying to make things look nice. I kind of wish I just started with something like Node-Red or Home Assistant, but I guess it's about the learning process? I welcome anyone who is interested in programming and DIY grow room controllers to come check it out and maybe even help further develop the concept. I'm not going to be providing wiring diagrams or supporting anything here because I'm completely new to all of this as well, you shouldn't be using it unless you have an interest in learning Node-Red and configuring it to your application. This is built specifically for my room, but can easily be adapted to yours: https://github.com/gvbz/gardenbro

Some pictures of the UI on a cell phone:
cellui1.jpg
cellui2.jpg
cellui3.jpg

Desktop:
gardenbro_ui_desktop.PNG

Feel free to drop any questions or suggestions, anything is appreciated as this is clearly a learning thing for me. For pictures of the room in action check out my instagram linked in the signature.

Features:
-Relative humidity, temperature and VPD visualization.
-Day/night heater, humidifier, dehumidifier and exhaust control. Each have manual/auto control so you can toggle devices manually.
-Exhaust has temperature, humidity and interval set-points.
-On/off lighting control.
-Automatic fertigation schedule.
-TP Link Wifi outlet: https://www.kasasmart.com/us/products/s ... te-hs103p2
-RuuviTag: https://ruuvi.com/

Notes:
-DHT22s are unreliable at best, humidity typically needs a +/- adjustment of 10 against a known source to be accurate. Temperature is usually 1-2c off. Ruuvitags are ideal but require a Pi 3 or greater to work properly, for that reason I've provided links on how to implement a RuuviTag, but the code is currently using a DHT22. Do note exceed recommended wire lengths.
-The exhaust interval control only operates at night on a fixed 30 minutes schedule. You can use this concept for any type of interval control and easily change it to your needs. You have to enter the set-point as "timer XXX" in seconds, ie. "timer 120" for 2 minutes because I don't know how to parse the code properly yet. I'm always using temperature or humidity control on the exhaust fans for my room, and at night I like to make sure there is fresh air in case it is not already ventilating based on temp/humidity (which is rare).
-You cannot use exhaust temperature and humidity control at the same time, the buttons are interlocked. I've tried experimenting with combined control methods to no success, the most stable room conditions I've had are with my exhaust maintaining temperature and the dehumidifier/humidifier maintaining humidity. There are also times during veg where I change to exhaust humidity control and try to maintain ideal VPD. The VPD is a target value and does not perform any control, I use a VPM excel chart and shoot for a target temperature based on the humidity set-point. Exhaust maintains humidity, and set points on the heater are kept tight to maintain ideal temperature. It's worked great for me.
-Timer entries use a 24hr clock 00:00 format.
-The "timer disable" toggle is used to stop any scheduled based timer functionality.
-Manually on/off for timers does not rely on any specific auto/manual controls nor the timer disable button. In the case of the feed pump, manually turning on will trigger a feed sequence of the specified length.
-Make sure to check the readme on github for a list of required Node-Red modules.
-If you plan on using a RuuviTag, make sure to do a full Node-Red install as per the following: https://nodered.org/docs/getting-started/raspberrypi, this is because pre-packaged Node-Red install on the pi is limited. It will work just fine for simpler DHT22/relay code, but i had problems when adding BLE scanning.

Some upcoming plans:
-E-mail based alarming first and then use some sort of SMS texting API within Node-Red.
-MySQL databases with hopes of implementing historical trending and data collection.
-Raspberry Pi camera integration into the Node-Red dashboard using a web-page stream.
-Secure cloud based hosting of the Node-Red dashboard
-Reservoir level... Not particularly useful for me, but there's an SRF04 ultrasonic module for Node-Red and I have a few laying around.
-Wireless PWM control of drivers using an ESP8266 and PC817 octo? Need to do more reading about this and remote driver dimming in general.
-PWM control of EC style fans, or potentially just a digital pot. I was planning on taking apart the small fan speed controller that typically comes with these type of fans and see how the signal can be intercepted.
-CO2 monitoring with a cheap MH-Z19B sensor.

Instructions on how to use RuuviTags in Node-Red:
https://lab.ruuvi.com/node-red/
https://github.com/ojousima/node-red

Hopefully this sets someone down right track instead of messing around with Arduinos and electrical wiring! I'll be expanding on this post more in the future. Thanks everyone.
480W Bridgelux EB Gen3 Parallel Build: https://bit.ly/2NfoVyE
Grow Room Automation w/ Node Red: https://bit.ly/3hOm5yK
Github: https://github.com/gvbz/gardenbro
Instagram: @loudfarms_ca
User avatar
LEDG
Site Admin
Reactions:
Posts: 1599
Joined: Sun Jun 04, 2017 8:15 pm

Maaaaaaaaaaaan, what a fantastic write-up... It's insane how similar our setups turned out to be, right down to the moisture sensor repurposing. Your room is incredibly clean and I really like the conduit work you've done too. I should have piped mine as well.

Thank you for taking the time to put this all out for everyone to learn from and be inspired by it. I'm eager to get going with node red myself.
Want to Support the Site?

Use this Amazon referral link and any purchase you make within 24 hrs will earn LEDgardener a commission at no cost to you!
jaysal
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 75
Joined: Sat May 30, 2020 7:49 am

Job well done with your environment and automation, very impressive. Thanks for sharing your code, this will certainly help new and seasoned growers accomplish their goals.
User avatar
gvbz
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 37
Joined: Thu Apr 02, 2020 3:30 pm

LEDG wrote:
Tue Jun 16, 2020 5:30 am
Maaaaaaaaaaaan, what a fantastic write-up... It's insane how similar our setups turned out to be, right down to the moisture sensor repurposing. Your room is incredibly clean and I really like the conduit work you've done too. I should have piped mine as well.

Thank you for taking the time to put this all out for everyone to learn from and be inspired by it. I'm eager to get going with node red myself.

Thanks for the kind words. That nutrient dosing system you have going is nothing short of incredible and the videos you recently made really brought some cool people/ideas out of the woodwork.

I'll be figuring out this whole github thing shortly and will put up some proper documentation, features and target goals. I encourage anyone to join in, take forks, and continue to share what they are working on regarding node red. I foresee some incredible diy growroom automation coming out of here in the near future. Between this and the whole diy LED thing, home growing has entered a new era thanks to communities like this.
480W Bridgelux EB Gen3 Parallel Build: https://bit.ly/2NfoVyE
Grow Room Automation w/ Node Red: https://bit.ly/3hOm5yK
Github: https://github.com/gvbz/gardenbro
Instagram: @loudfarms_ca
User avatar
gvbz
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 37
Joined: Thu Apr 02, 2020 3:30 pm

Just did a big update to the github page with instructions on how to get up and running. VPD updated to use a manually entered leaf temperature value and fertigation has been updated so you can specify duration for each feed cycle. Check it out:

https://github.com/gvbz/gardenbro
480W Bridgelux EB Gen3 Parallel Build: https://bit.ly/2NfoVyE
Grow Room Automation w/ Node Red: https://bit.ly/3hOm5yK
Github: https://github.com/gvbz/gardenbro
Instagram: @loudfarms_ca
jaysal
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 75
Joined: Sat May 30, 2020 7:49 am

This looks great, coming together really well. I have been working on my PWM fan control on my spare time here is my first take on it. I can provide the Node-Red export if anyone feels it will help them.
Temperature Humidity PWM.PNG
User avatar
gvbz
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 37
Joined: Thu Apr 02, 2020 3:30 pm

jaysal wrote:
Mon Jun 22, 2020 3:54 am
This looks great, coming together really well. I have been working on my PWM fan control on my spare time here is my first take on it. I can provide the Node-Red export if anyone feels it will help them.

Temperature Humidity PWM.PNG
Looks awesome, are you using a remote MCU to connect to the fans? Any details would be great and so would an export. PWM fan control is definitely something I would like to incorporate but I'm still learning about it, was thinking of using an ESP32 for the application and got a few on order. What sort of fan are you interfacing with? I have an EC style fan with 0-100% controller, but after taking it apart, it looks like this one uses a simple pot and my only option would be a matching digital pot.

You are always welcome to join the github project and contribute!
480W Bridgelux EB Gen3 Parallel Build: https://bit.ly/2NfoVyE
Grow Room Automation w/ Node Red: https://bit.ly/3hOm5yK
Github: https://github.com/gvbz/gardenbro
Instagram: @loudfarms_ca
jaysal
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 75
Joined: Sat May 30, 2020 7:49 am

Yes, I am using an ESP32 to connect my temperature sensors and the L298N Motor Drive Controller. The ESP32 connects via Wi-Fi to Home Assistant and Node-Red which is currently running on a RP4.

I have the L298N connected to a 12V 150CFM fan (computer fan) for testing, I have not yet purchased an EC style inline fans (I would like three; air intake, air exhaust and humidity exhaust) that would go inside my grow environment. I am 30 days out from harvest so I don't want to make any drastic changes at the moment.

What model EC fan do you have? Most likely you can use the L298N.

What is the best way to share the code? ESP code will fit here but probably not the best for Node-RED code. I will zip the json and attach for now.
fan pwm.zip
(2.56 KiB) Downloaded 228 times
jaysal
LED Enthusiast
LED Enthusiast
Reactions:
Posts: 75
Joined: Sat May 30, 2020 7:49 am

Hey gvbz,
I was wondering if you can help me out with function node in the VPD calculation? Specifically line 2 in the code below... I think I need to change the message from my sensor to pass msg.humidity vs the default message which is msg.payload. I cannot figure out how to accomplish that.
function node math.PNG
User avatar
LEDG
Site Admin
Reactions:
Posts: 1599
Joined: Sun Jun 04, 2017 8:15 pm

I’ve also been tinkering with my PWM fan control. I’m now using a MOSFET (must be logic level, I’m using digi-key part number IRLZ44NPBF-ND http://d.digikey.com/c01Q0BQS3NpX0Z7KS053y00) and a PWM pin on an ESP32 and it works well.
Want to Support the Site?

Use this Amazon referral link and any purchase you make within 24 hrs will earn LEDgardener a commission at no cost to you!
Post Reply