I have enjoyed gardening as a hobby for the past few years and I have two raised vegetable beds in our front yard. I live in hardiness zone 8a and have had pretty good success growing crops such as lettuce, kale, carrot, radish, squash, peas, beans, parsley, dill and (to my surprise) tomatoes outside in the raised beds. However, I have not had much success with cucumbers, bell peppers and chili peppers – probably since we only have about 2-3 months of warm weather here in Denmark, which is just too short of a growing season for these crops. So this year I decided to buy a greenhouse! Hopefully this will allow me to grow the warm-season crops from late spring to early autumn and – as an added bonus – grow a second batch of the cool-season crops in the greenhouse from late autumn and into the winter. The greenhouse is 6.2 m2 and I have arranged it with vegetable beds and some furniture as shown below. Also, I have placed a rainwater barrel outside the greenhouse and put some conduit below the ground from the barrel (which sits on a roughly 30 cm tall base) and into the greenhouse, so that I can run a hose and perhaps an electrical extension cord inside.

Although I enjoy keeping a vegetable garden and watching my plants grow, constantly tending to the plants can become quite a chore – especially in the warm months where I sometimes have to water them daily. So as an engineer, of course I have to build something to facilitate the process a bit. Cue the Smart Greenhouse!
What do I want it to do?
First off, I will just make it clear that I’m doing this project not only to make it easier to grow vegetables, but also as a way for me to try out new technologies and programming concepts. Therefore, some of my design choices will probably not be the most cost- and time-efficient, but hopefully it will be a fun and rewarding learning experience for me.
Anyway, the most important feature of a smart greenhouse, in my opinion, is the ability to automatically water the plants when needed. Some commercial watering systems simply water on a fixed schedule, but I would rather detect the moisture of the soil in each vegetable bed and then only water when necessary. This would require a few soil moisture sensors and some kind of water pump or valve.
I also want to monitor climate values such as ambient temperature and humidity, amount and intensity of sun light and soil temperature. I can use this data to control ventilation (e.g. with a linear actuator on each window and perhaps a fan) and provide shading to ensure an optimal climate for the plants. I have already had plants in the greenhouse for a few months, so I bought and installed a set of automatic vent openers that cost me only a few hundred DKK. They work simply by having a cylinder with mineral wax that expands and contracts (and thus opens and closes the window, respectively) with temperature. On the really hot days, however, simply opening the windows might not be enough to keep the temperature down, so it would be nice to have some kind of shading be applied when the temperature approaches 30°C.
Lastly, I would like to be able to interact with the system from my smartphone so I can always check up on my plants, configure the system and run the watering system manually if need be. This requires both networking capability on the greenhouse-end and some kind of mobile or web application on the smartphone-end.
The structure of the entire system is outlined in the block diagram below:

Preliminary ideas
I have had an ESP32 development kit lying around for quite some time now and I think this is the perfect time to try it out. It is a bit overkill for just reading a few sensors once in a while and controlling a pump, but it has integrated WiFi, which is perfect for this project, and I’ve been really wanting to learn about this SoC for a while.
I have a few other components lying around from a previous project that I am planning to use, namely a BME280 temperature/humidity/pressure sensor, some cheap FC-28 soil moisture sensors and some photoresistors. For measuring the soil temperature I am thinking of just ordering some cheap NTC thermistors.
Initially I wanted to power the system by running an extension cord from an outlet on the outside wall of my house and through the underground conduit into the greenhouse. However, the outlets are wired up in a silly way, so they are only turned on if I also turn on the outdoor lights. I was hoping I could just rewire the outlets to always be on, but it turns out they are all wired up with a three-wire cable. So instead of pulling up pavers on the terrace and laying five-wire cable for all the lamps and outlets, I am now leaning more towards using a solar panel and a 12 V battery.
For watering I am thinking of using a 12 V pump to get the water from the rainwater barrel to the vegetables beds, since the barrel is not elevated high enough to provide sufficient pressure on its own. I thought of using a soaker hose or drip hose in the beds, but these usually do not provide more than a couple of liters of water per hour per hole. This would mean running the pump for quite a long time, so it is probably not the best solution when running on battery. I might give it a try anyway, since I have already have a soaker hose in one of the beds as a temporary solution.
To interact with the system from my smartphone, I am planning to develop a mobile app using the Flutter framework. I have previously fiddled around with it a bit, but not enough to have made anything substantial. I will probably be using the Firebase platform as a back-end and their NoSQL database solution Cloud Firestore to store all the data.
These are my initial thoughts about this project. In part 2 I will be getting the ESP32 up and running, connect it to my home WiFi network and perhaps collect some temperature and humidity data from the BME280.
1 thought on “Project Smart Greenhouse (Part 1): The idea”