Use a microcontroller and relays to make a mini greenhouse and grow your own microgreens.

1 Air pump
LED super bright strips
1 12V CPU fan
1 Plastic tray and cover
1 Computer ATX PSU or 12V 2A Wall Wart
5 10K resistor (R1, R2, R3, R4, R5)
6 100nF capacitor (C2, C3, C4, C5, C6, C7)
1 10uF capacitor (C1)
5 1N5817 diode (D1, D2, D3, D4, D5)
3 2N3904 (Q1, Q2, Q3)
3 5V relay (RL1, RL2, RL3)
1 7805 linear regulator (U2)
1 PIC18F45K22 (U1)
1 DHT11 temperature and moisture sensor
1 DS1306 real-time clock

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-greenhouse_1.jpg

Mini Automated Greenhouse Schematic

How Does the Greenhouse Work?

The circuit has several elements:

  • 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
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.

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.

Code

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.

mini-greenhouse_3.jpg

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.

mini-greenhouse_4.jpg

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.

mini-greenhouse_5.jpg

mini-greenhouse_6.jpg

Construction

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.

mini-greenhouse_7.jpg

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.

mini-greenhouse_8.jpg

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 DIY Hacking project IR Tap

Once everything is put together, you will have your own microgreens greenhouse!

mini-greenhouse_9.jpg

Downloadable Files

Automated Microgreens

Robin Mitchell
Graduated from the University Of Warwick in Electronics with a BEng 2:1 and currently runs MitchElectronics.

You'll probably need these ...


Forks

Related Projects