Introduction: Hydroponic Greenhouse Monitoring and Control System
In this instructable, I will show you how to construct a hydroponic greenhouse monitoring and control system. I will show you the components chose, a wiring diagram of how the circuit was constructed, and the Arduino sketch used to program the Seeeduino Mega 2560. I will also post a few videos at the end so you can see the end result
- Water Pump
- Air Pump
- 2 Fans
- LED Light Strip
- 4x20 LCD Screen
- The air and water pump are attached to an external interrupt function which is controlled by an SPDT switch. This allows the user to change nutrient solution or tinker with the irrigation system without having to shut down the entire circuit. This is important because when you shut down the entire circuit, the timing for the light resets.
- The lights are controlled by simple mathematical functions which allow the user to determine how long they would like the lights to be on and off.
- The fans are controlled by temperature. I have programmed the Relay to switch the fans ON anytime the sensor reads above 26 Celsius. And to be OFF anytime below 26 Celsius.
I feel that I should mention that this project is still a work in progress. By the end of summer, I plan to install a pH, electroconductivity, and DO sensor (as these are essential for properly monitoring of a hydroponic system). So if you like what you see, check back sporadically throughout the summer to check on my progress!
**Update(1/30/19)** The code for this project is now available via the Greenhouse_Sketch.txt file. (located at the bottom of section 4
Step 1: Component Selection
The photo displayed for Step 1 shows; Component, Model, Company, Function, and Price.
You can most likely find these components for cheaper prices through Amazon or other sources. I just gathered this information from each component's source since I was also gathering specification sheets at the same time.
Just realized I left out 2x breadboards for my parts list. These are rather cheap and can be bought through Amazon, or just about any components retailer.
Step 2: Wiring the Circuit
In the photos displayed for Step 2, you will find the wiring diagram as well as the physical structure of the circuit. Quite a bit of soldering was done in this step to ensure solid connections to the relay as well as the interrupt switch and lights.
If you are having issues with getting a component to power up, remember that a DMM is your BEST friend in this step. Check voltage across a component in parallel and check current through a component in series. I found that checking the components by DMM was much faster than trying to retrace my wiring to look for the reason something was not working.
NOTE: You will notice I used a MicroSD shield on top of my Seeeduino Mega 2560. This is not needed for this project unless you want to record data(which I have not programmed for...yet).
Step 3: Constructing the Hydroponic Greenhouse
The size of your greenhouse is really up to you. The best thing about this project is that all you need to make it on a larger scale is longer wires! (And a water pump with more than 50 cm of head)
The base frame of the greenhouse was constructed out of wood from LOWE's and I used flexible PVC pipe and chicken wire to create the frames hood. (Photo 1)
A simple plastic sheet was used to cover the hood and create an isolated ecosystem for the plants. Two fans in series were used to move air across the greenhouse. One to pull air in and one to pull air out. This was done to cool the greenhouse as fast as possible and to simulate a breeze. The fans are programmed to be off when the DHT11 measures temp < 25 *C and to turn on when temp > or = to 26 *C. This will be displayed in the sketch portion of the instructable. (Photo 2)
The hydroponics system consists of a 3" O.D PVC pipe with two 2" holes cut out of the top for the mesh pots. They are spaced 3" apart to give each plant enough space for both rooting and growing. A drip system was used to provide the nutrient solution to the plants and a 1/4" hole was cut out of the bottom of the PVC to allow the water to return to the reservoir below. The air and water pumps are both connected to an interrupt switch that controls them from a second void running in parallel to the main void loop. This was done so I could turn off the pumps to change the nutrient solution without affecting the rest of the system. (Photo 3, 4, and 5)
An LED light strip was attached to the inside top of the hood and wired into the relay through the RBG amplifier. The light is on a timer which is controlled by "If" and "else if" statements. In my programming you will find they are programmed to turn on and off every 15 seconds. This is purely for demonstrations purpose and should be changed according to a normal light cycle for optimal growing conditions. Also, for actual growing conditions, I recommend using a real grow light rather than the simple LED strip I used in my class project. (Photo 6)
Step 4: Programming in Arduino
Photo 1: Setting up Libraries and definitions.
- unsigned long timer_off_lights=15000
- this is where we determine when to turn the LED lights off. The lights are currently programmed to be turned on for until this time is reached. For actual use I recommend checking out the desired light cycle for the plant you want to grow. Ex: if you wish your lights to be on for 12 hours, change this time from 15000 to 43200000.
No other changes are needed in this section of the program
Photo 2: void setup.
No changes are needed in this section
Photo 3: void loop.
- else if (time_diff <30000)
- Since the lights are programmed to be on at the start and shut off 15 seconds into the program. 30000 acts as a limit of measured time. The lights remain off until time reaches 30000 and is then reset back to 0, thus turning the lights back on until 15000 is reached again. 30000 should be changed to 86400000 to represent a 24 hour cycle.
- if (t<26)
- this is where the program tells the fans to remain OFF. If your plants require different temperatures, change 26 to fit your needs
- else if (t>=26)
- this is where the program tells the fans to remain ON. Change this 26 to the same number you changed the previous statement to.
Photo 4: void StopPumps
this is the secondary void mentioned at the beginning of this instructable. No changes are needed, it simply tells the connected pins what to do when the SPDT switch is flipped from its original position.
Step 5: Videos Showing the Function of the System
Shows the air and water pump being controlled by the switch. You can also see how the LED lights on the relay change as the switch is thrown.
By viewing the Serial Monitor, we can see that the lights turn on once the program is started. As the time_diff crosses the 15000 ms threshold the lights turn off. Also, as time_diff crosses the 30000 ms threshold we can view the time_diff resets back to zero and the lights turn back on.
We can see in this video that the temperature is controlling the fans.
Just a walk around the greenhouse