Use a microcontroller and relays to make a mini greenhouse and grow your own microgreens.
Whether you're growing greens for sustenance or you just love gardening, a mini greenhouse is a satisfying project.
In this project, we will look at how to make a simple automated greenhouse that can grow microgreens with minimal human intervention.
Mini Automated Greenhouse Schematic
How Does the Greenhouse Work?
The circuit has several elements:
The three main external devices that are used to make alterations to the environment are a fan, a water pump, and growing lights. These devices use large amounts of current (as compared to what the microcontroller is capable of sourcing) and so they are connected to relays which the microcontroller can interact with.
- A microcontroller to read sensors and make adjustments to the environment
- Relays to enable/disable power to various devices
- Power regulation
- Software found on the microcontroller
Several sensors are used to monitor the environment which include a moisture sensor (that detects the amount of water in the soil) and a DHT11 which measures the temperature and humidity.
The microcontroller is also connected to a DS1306 which is a real-time clock. This provides the day/night cycle so the growing plants can be given light at the proper time.
One other device could be connected to the controller, a heat pad, but considering that the climate in my country (England) is temperate, there is no need for one in my case.
The software in the controller is written in PIC C18 and the project was created in MPLAB 8.92.
The first functions to be executed are setup-related, which includes initializing the DHT11, RTC and all the internal registers in the PIC. For example, the oscillator needs to be configured for maximum speed, the ports need to have their direction set, the ADC peripherals have to be enabled, and other configuration bits need to be set/cleared. Once configured, the main loop is rather simple and, depending on the values of external sensors, will result in various output devices being turned on.
Light Control Code
Lights are controlled by the time of day and the current time can be obtained from the real-time clock. The hours register is read into currentHour and if the current hour is during day time (for this project, 6AM to 9PM) then the lights turn on. During the night, the system will turn off the lights as plants, too, need a âsleepâ cycle.
Water Control Code
The water feed system is accomplished with an air pump, an air tight container, and some piping.
When the moisture sensor in the soil detects too little water or the humidity becomes too low, the controller turns on the air pump which forces air into a container.
Since the container is airtight, the pressure builds up. But the container, however, has a pipe coming out that is fed into the greenhouse which also has very small holes drilled (0.6mm) into it. The pressure forces water through this pipe and the small holes create a water mist which helps to increase the humidity and water the plants, as well.
Air Control Code: Temperature and Humidity
The air flow in the system is accomplished using a small 12V CPU fan. If the humidity becomes too great or the temperature becomes too warm, then the fan is turned on.
This forces outside air into the greenhouse which can reduce the humidity while also providing airflow which, through evaporative cooling, will help to keep the plants cool.
Building this circuit can be done with most circuit construction techniques including breadboard, stripboard, and PCBs.
Luckily for me, after a long stretch without it, my CNC is back in operation and so this project was made on a PCB. All the CNC files can be found in the project folder which includes all the needed G-Code for a CNC 3020 (also included is auto leveled code).
The circuit will need a power supply that can supply several amps and PC ATX supplies work well for this.
The lights in this project are the strip kind which are cut to size, soldered together, and then glued to the roof. Do not use the double-sided tape that the strip lights come with because they will not be able to handle the humidity and temperature.
The pump uses a small beaker as the water storage container which has two pipes fed into it. The first pipe is the air inlet and the second pipe is the water outlet. Making the tiny holes on the pipe can be done with a needle or a small CNC drilling bit (such as a 0.6mm) but be careful not to make too large holes otherwise large quantities of water can shoot out which is very undesirable.
Building instructions for the water system can be found on the Maker Pro project IR Tap.
Once everything is put together, you will have your own microgreens greenhouse!