Aeroponic and/or Hydroponic DIY Raspberry Pi Grow Tent/Room Controller

TFro3

Gardening Enthusiast
Staff member
DIY Aeroponic Tower Supporter
Aeroponic Assembly Guide Supporter
Super Duper Neighbor
Growing Zone
7a (US)
Hey everyone!
Winter is now here and I've been putting together a 5x2' grow tent (shown below) for my aeroponic towers. With tents being so cheap on Amazon I figured this would be a quick easy thing to setup with ease. I've been piecing it together and after buying the tent, exhaust fan, and lights I had put as much into that I really wanted to. And then I remembered a controller is needed. Well.... I guess it really isn't NEEDED but it would be way better having one rather than just having fans and lights on timers because it would be hard to get the plants environment as favorable as possible.

IMG_0143.jpeg
If you don't know, grow tent controllers aren't super cheap. They aren't terribly priced but MOST of them out there require you to purchase their branded fans, lights, humidifiers, dehumidifiers, etc for everything to work right out of the box, which makes things more expensive than it needs to be, in my opinion. And if you want to plug your own stuff into the controller, guess what? If you guessed you needed to buy an adapter for a standard AC outlet you'd be correct. Which is simply wild to me.
So I started thinking about this issue and realized that I could use a single board computer such as a Raspberry Pi to create my own grow tent controller. If you don't know what a Raspberry Pi is, you can take a look here.
It only took me a day or over the weekend to come up the code for the controller and I'm currently testing it. This setup utilizes 3 main components, the Raspberry Pi computer/board, a combined temperature/humidity sensor, and a bank of relays that will act as switches to toggle on and off power to a set of outlets connected to this setup.
From there the program reads the temperature and humidity every minute and then will toggle on and off the relays based on the logic I setup. This logic is easily configurable to quickly modify the settings based on the needs of your indoor garden in the grow tent/room.

The logic is setup for the following devices:
  • Lights
  • Exhaust Fan
  • Heater
  • Humidifier
  • Dehumidifier
  • Hydroponic/Aeroponic water pump
Do you have a grow tent/room that doesn't have on of these items? That's no problem, I've also added logic that you can easily disable any of the above devices by setting a simple 'True' value to 'False'

To give you an idea how this can be configured, I'll paste the area of code that any user can update with ease once the program is downloaded to your Raspberry Pi:

Python:
# ------------ You CAN edit values starting here ------------ #

# Define lights on and off times (in 12-hour format with AM/PM)
lights_on_time = datetime.datetime.strptime('6:00 AM', '%I:%M %p').time()  # Change to your desired on time
lights_off_time = datetime.datetime.strptime('10:00 PM', '%I:%M %p').time()  # Change to your desired off time

# Define pump runtime and interval (in seconds)
pump_runtime = 90  # Change to your desired pump runtime in seconds
pump_interval = 600  # Change to your desired pump interval in seconds

# Define temperature and humidity thresholds
Temperature_Threshold_Fan = 75  # Will turn on Fan if temperature in Fahrenheit (F) is above this value.
Temperature_Threshold_Heat = 63  # Will turn on Heat if temperature in Fahrenheit (F) is below this value.
Humidity_Threshold_Fan = 85  # Will turn on Fan once humidity is above this percentage (%) to try and move lower humidity air in. Disable this if humidity outside the tent/room is higher.
Humidity_Threshold_Humidifier = 70  # Will turn on Humidifier once humidity is below this percentage (%).
Humidity_Threshold_Dehumidifier = 80  # Will turn on Dehumidifier once humidity is above this percentage (%).

# Define appliance control flags (True: Enabled, False: Disabled)
lights_enabled = True  # Change to True or False
fan_enabled = True  # Change to True or False
humidifier_enabled = True  # Change to True or False
heater_enabled = True  # Change to True or False
dehumidifier_enabled = True  # Change to True or False
pump_enabled = True  # Change to True or False

# ------------ Do NOT edit values past here ------------ #

If that block of code is complete gibberish to you I'll break it down.
  • The 'lights_on_time' and 'lights_off_time' lines can be set by changing the time to the desired times you want your grow lights to turn on and off at.
  • The 'pump_runtime' and 'pump_interval' lines are to set how often you want your water pump(s) to run and for how long. You can easily set the seconds for each based on your needs.
  • Temperature_Threshold_Fan, Temperature_Threshold_Heat, Humidity_Threshold_Fan, Humidity_Threshold_Humidifier, and Humidity_Threshold_Dehumidifier are all values that can be changed to keep your grow tent/room in the right conditions for your plants. This section really is the brains behind the entire controller.
    • These temperature and humidity thresholds are what will trigger the devices responsible for keeping your plants nice and cozy.
    • It's also important to note that you're just putting in a number, and not a percentage or unit for the temperature. It's already worked into the code that the values are percentages and degrees in Fahrenheit (F). Simply plug in the value and be on your way.
  • And the last section contains all the 'True' and 'False' values that allow you to disabled unwanted devices so it's not triggering any unwanted relays.
    • So if you dont have pumps, you can simply change the 'pump_enabled = True' to 'pump_enabled = False'
    • Example:
      Python:
      pump_enabled = True  # Change to True or False
      to
      Python:
      pump_enabled = False  # Change to True or False

Once the program is running, the terminal that you start the controller on will print you out current stats on the relays every minute as it refreshes the sensor and evaluate for relay changes! See below for that example from a live test!

1701118528340.png

1701121233044.png

1701121238775.png

If you're interested in building this or wanted to look at the rest of the code doing the magic you can review that and more documentation on my Raspberry Pi Grow Tent Controller GitHub Repo

More updates to come as the build comes out of testing and put into an enclosure all wired up!

Stay tuned!
 

TFro3

Gardening Enthusiast
Staff member
DIY Aeroponic Tower Supporter
Aeroponic Assembly Guide Supporter
Super Duper Neighbor
Growing Zone
7a (US)
Everything is starting to all come together!
This project will be put into a standard 4 gang electrical box.
This box will contain the bank of 8 relays (I'm only using 6) and the electrical outlets.
The raspberry Pi will be in it's own enclosure mounted on the side of the box.

Disclaimer:
  • This project involves working with electrical circuits and high voltage components. Incorrect wiring or handling of high voltage lines can pose serious risks of electric shock or fire hazards. It's crucial to follow proper safety precautions and guidelines when working with high voltage.
Safety Recommendations
  • Qualified Personnel: It's strongly advised to involve or consult with qualified personnel or electricians when dealing with high voltage lines.
  • Disconnect Power: Always disconnect power sources before working on electrical circuits.
  • Insulation: Ensure proper insulation of wires and components to prevent accidental contact with live circuits.
  • Proper Wiring: Follow manufacturer instructions and local electrical codes when wiring high voltage lines.
  • Use Enclosures: Enclose circuits in suitable cases to prevent accidental contact.
  • Safety Gear: Wear appropriate safety gear, such as gloves and goggles, when handling electrical components.
Liability Statement
  • The creators or contributors of this project do not accept any liability or responsibility for any damages, accidents, injuries, or losses resulting from the use, misuse, or inability to use the information or instructions provided in this project. Users assume all risks associated with handling high voltage circuits and should exercise caution and expertise when working on such systems.

Let's get into the build.

First I measured and 3D printed a box to house the electrical box in. I'd say this isn't necessary but looks more complete with it.
1701703488859.png

I then put some PC case standoffs on the relay bank to keep it from laying directly on the box. Not sure how hot this will get and has exposed solder points on the bottom, so better safe than sorry.
After that I drilled a hold and routed the GPIO jumper wires through that and set the relay in place as a test fit.

1701703684372.png


1701703708942.png

Next up is wiring. There are many ways to do this, but I chose to wire all the 'hots' together on the relay first. This is what will be connected to the cord coming into the box providing the power. From there a wire will connect from the outlet to the relay which will act as our switch to toggle on and off power to our devices.

1701703759354.png

In order to make this work we need to break the little tab off the 'hot' side of our outlets. By breaking off the tab (shown below) it creates 2 independent switchable outlets instead of just 1 as they are right out of the box.

1701704213819.png

All the rest of the wires such as the common and ground are wired up just like any other circuit.
Once all the wiring is completed it's time to test!
In my GitHub Repo there is a python file called "RelayTest.py" that you can run which will toggle through all the relays so you can test the outlets as well.

1701703799773.png

Once everything has tested out successfully I threw on the cover for the outlets and labeled everything as I noted while testing the relays.

1701703823496.png


As shown below on the labels you can see that I have all available appliance outlets labeled and ready to go as well as 2 plugs that provide constant power. This will be used to power the Raspberry Pi and the other plug will power fans inside the tent that will never turn off to mimmic wind/breeze for the plants.

USE CAUTION: When picking out appliances/lights make sure you're keeping in mind the constraints of these relays and wiring.
In my build the cord going to the box is only 16 gauge wiring which can handle 13 amps of power since the wire is less than 50'. This isn't an issue because the relays can only handle 10 amps. In my basement this will also be plugged into a GFCI outlet since this is dealing with water. I highly suggest you also plug into some sort of GFCI protected outlet. This circuit I'm using also has other items on it and is only a 15 amp circuit so if I came anywhere close the the 10 amps allotted I'd trip the breaker.

When picking out the appliances make sure you're under calculated wattage for your setup.
To do this it's simply Amperage X Volts = Wattage
So in this case my max amperage is 10 and its running on a 110v circuit so 10x110= 1,100 watts.
I won't be needing a dehumidifier so I will be disabling that in the controller.
*If you're planning on running every single available device in your setup you very well need 2 plugs going to your relay(s) and split the power going to the outlets with 2 completely separate circuits in your home.*
With my pumps, lights, fans, humidifier, and small desk heater I'm totaling just under 800 watts which is probably the max I'd want to be at since there are motors involved in the appliances. Motors need a little more amperage when starting then consume their regular amperage after the initial startup.

1701703846303.png

The enclosure for the Raspberry Pi is still printing so I will update again once its done and mounted!
 

TFro3

Gardening Enthusiast
Staff member
DIY Aeroponic Tower Supporter
Aeroponic Assembly Guide Supporter
Super Duper Neighbor
Growing Zone
7a (US)
Finally back with another update for everyone!
I got back around to put the finishing touches on the Raspberry Pi Grow Tent Controller.
Basically all I needed to do was 3D print the enclosure for the Raspberry Pi and tidy everything up to make it look nice and clean.

After 3D printing the Pi enclosure I attached it to the electrical box enclosure using an adhesive and a couple screws I had laying around.

1702601941277.png

The Pi was also secured in place with a couple screws

1702601981430.png


Rewired the GPIO's just how it was before, since I had already labeled all the plugs.

1702602072795.png


1702602085845.png


Routing the Pi power cord and sensor wires

1702602095113.png


Carefully placing the Pi enclosure lid on and secured it with screws, making sure not to pinch or smash any jumper wires.

1702602226022.png


For now the sensor will be mounted to the Pi enclosure. Sooner or later I will add more cabling to get the sensor to the middle/top of the tent.

1702602199765.png


1702602248626.png


The finished product!
Now it's time to get some seeds started!

1702602257892.png
 
Top