Raspberry Pi Is The Brains Behind Automated Greenhouse

Raspberry Pi automated greenhouse

[Asa Wilson] and his wife picked up a 10’x12′ greenhouse from Harbor Freight that for their location required some serious changes, understandable since they’re in Colorado on the western slope of Pike’s Peak where the winds are strong and the normal growing season is short. After assembling it on a concrete footing and adding some steel bracing, they got to work on adding an environment management system based around a Raspberry Pi. Read on for a look at the modifications they made.

Currently, the Pi monitors a single temperature and relative humidity sensor. Based on that input, the Pi controls two exhaust fans located at opposite corners at the base of the greenhouse. These are speed controlled through a custom board and are used for drawing air in from the roof vents. A third, larger, oscillating fan is mounted near the roof for circulating air. It’s speed is set manually, but it’s also turned on and off by the Pi.

There are four vents in the roof, each of which was previously manually opened with a single arm that allowed the vents to oscillate in the wind, and sometimes even fall closed. They fixed those issues by adding homemade vent controllers and geared motors in 3D printed cases. Those motors control two arms that firmly hold both sides of each vent, eliminating the oscillation.

Interestingly, the Pi used its RS-232 output to talk to all the custom controllers but they ran into issues with resistance added by electrical noise. To fix that they added a driver that converts to RS-485 before sending the signal onward.

You can see the results in the write-up on their pages and so far they look promising. However, more work is being done. They’re adding a thermal controller for monitoring up to 20 temperature sensors in the growing area and have plans for up to seven water valves. But even now, the greenhouse is a far cry from the simple plastic shell they started with.

Along the same vein of automating greenhouses, check out [David Dorhout]’s automated watering robot that wanders around with a 30 gallon tank, watering plants. There’s also [Instrument Tek]’s similar 10’x10′ greenhouse Arduino based system that, in addition to fan and watering control, also controls heat and has wireless communication to a remote laptop.

31 thoughts on “Raspberry Pi Is The Brains Behind Automated Greenhouse

    1. I’ve not done much work with battery storage / solar cells, but I suspect quite a bit of power would have to be collected to deal with the fans. Everything else (the RPi, the PIC microcontrollers, the vent motors, etc.) require very little power (I would estimate 800 ma or so).

    1. And so is the next job and the next.. More sensors more applications and in the end you’ll have 50 1$ micros all around the place, whereas you can simply extend functionality every which way you please by using a RPi.

      1. Until you realize that the sensors and applications are on a serial bus, and there’s no hurry to do anything, so a single $1 micro can easily handle all the tasks – the only issue being limited RAM on the controller which limits the number of concurrent tasks. Mostly it’s just acting as a fancy thermostat that doesn’t need to remember anything.

        The RPi is only justified in the case you want to make extensive real-time logging and data analysis, which isn’t possible within the memory constraints of a microcontroller.

      2. Actually, you could do it with a $10 openwrt board and have more functionality than a rpi. RPi is overkill for such a simple project, but as they say, if all you have is a hammer…..

    2. You’re right. In fact, microcontrollers (Microchip PICs) are used in the individual controllers (vent controllers, fan controller, thermal controller) to provide a real-time ‘front end’ to the geared motors, fans, thermal sensors, and so forth. By doing so, real-time performance (and ‘bit banging’ in the case of the thermal sensors) can be achieved more readily and reliably than using the Pi. Plus all of the wiring for device interface is localized to the controller and the only connection back to the Pi is through the RS485 connection.

    3. Traditionally the vents were actuated with a wax filled piston on each “window” that expanded when hot, self powering and self regulating. You would want to have a very good argument for not using such a simple and robust system when a failure of any number of parts in the digital system could kill everything in the greenhouse from overheating. With the wax piston method you can have half of them fail (and their meantime to failure is long anyway) yet the green house will still vent enough to avoid complete disaster.

      1. It’s a Harbor Freight Greenhouse it’s life expectancy is two weeks maximum for those wax Pistons they made The Logical choice to automate them via Raspberry Pi and microcontroller the next thing that would be likely to fail unless they upgraded them as well is the fans

  1. Sometimes it is better to use rather simple greenhouse technology:
    Greenhouse vents are rarely operated by motors (because of wind!) but by automatic openers that work through expansion of gas in a cylinder! And this is simply done by temperature, and a maximum opening angle/sensitivity can be preset by adjusting basic pressure in the cylinder. Like this example: https://www.amazon.de/Einhell-Automatischer-Fenster%C3%B6ffner-Hubkraft-Hubh%C3%B6he/dp/B0011543EC/ref=pd_lpo_vtph_86_bs_tr_t_1?_encoding=UTF8&psc=1&refRID=X6APPFVM5A146QK2Z6CN
    I have a large greenhouse (4m x 9m), and can tell you, it works perfectly well – and if you place your vents right, and open the door (have a summer door with a mesh – against mice etc.) then no need for a fan, either.
    What is really needed: Automated irrigation, based on soil humidity and different water needs for different plants, where a raspberry pi can be really helpful as a means of control.
    But if I can manage to achive watering just by using simple physical principles instead of having need of electricity and electronics inside of a very humid environment, I’ll change this method too.
    .If you operate a greenhouse for a while, you’ll agree.

    1. I agree–keeping it simple should be the first approach. In our case, we were faced with some issues that required a more sophisticated approach. Our winds make the traditional wax or gas actuators unattractive because of the mechanical instability of the single central attachment point on the vent lid. Furthermore, the sudden temperature swings that we experience require a system that is more responsive than what those sort of devices afford. Some advantages come along with the computer control as well. For example, the computer can open only downwind vents under strong wind conditions to minimize the potential for damage to the upwind side. We can easily adjust the target temperature in the greenhouse for crops that prefer colder or warmer conditions. If we notice that weather conditions are such that the vents should be closed (such as a storm front coming in), then we can preemptively close the vents. In early spring or late fall it is a simple matter to disable the vents on the north side so that half of the roof can be covered with an insulating cover to help conserve greenhouse heat. And of course adjustments can be made remotely. So the fancy approach (when it makes sense) can come with perks.

      The presence of the Raspberry Pi in the system provides some storage and computing power that is handy for a number of things. The storage allows me to keep records of temperature, humidity, automation actions, and so forth for analysis. Of course the Pi is accessible via Ethernet so data download, program modifications, etc. are easy. The computing power gives me that ability to apply sophisticated control algorithms and to compute (or, if preferred, collect from the web) sunrise and sunset times to help manage the greenhouse environment. And the Pi platform makes it straightforward to provide a user interface for data display and system control.

      1. Temperatur stability: Plants need temperature CHANGE, some won’t even flower without.
        Gardening isn’t an industrial project – or shouldn’t be.
        The purpose of a greenhouse is to prevent early frost or late frost to prolog gardening season.
        To problems with wind and gas/oil cylinder actuators: Mine came with a very good security chain and can hold 16kg.
        I’m living in a storm ridden region which is extremly cold (-30 °C) in winter and very hot/dry (35°C) in summer and on a hilltop – so perhaps you can imagine. (It’s close to Chech border in a mountain region (Bohemian Forest).
        I have an automated solar pump refill for an elevated water reservoir which feeds into a drop-irrigation system – Israel Negev farmers – I love you – which works self adjusting.
        So all I have to control is battery power of my solar pump and sensors in the water tanks and reservoir (fed by rain water pipes).

        1. Your climate is clearly more challenging than ours. It is rare that we reach -30 °C or 35 °C. But more importantly, you are located more than 10° further north.

          Your point about temperature change is a good one. My goal would be to regulate the temperature in a way that produces a normal pattern rather than the extreme swings that we would otherwise see in the greenhouse. The algorithm I have in place right now is about as simple as it can get and it tends to produce an oscillation of the temperature between two boundary settings. I plan to replace it with a PI (proportional-integral) or maybe PID (proportional-integral-derivative) algorithm to achieve proper control. Then I can generate a normal temperature pattern.

          Regarding your latitude, do you find you have to augment the diurnal cycle with lighting in your greenhouse to get better results from plants that are expecting a longer day?

  2. I’ve been running my hydroponic Greenhouse for several years now the last 3 years with a Raspberry Pi. My Raspberry Pi use connects to X10 and controls the sump pump which does the watering the fans and wet wall which does the cooling and the space heaters which do the heating. I’ve also purchased a solar powered 30000 milliamp battery pack to act as a UPS.

  3. Oh god wordpress. When did that become compulsory?
    Aaaanyway I hope your greenhouse stays together when the wind gets up. Those polycarbonate panels tend to pop out in the cheaper models under a heavy wind load.
    One feature I have semi implemented in mine is solar heated soil. I have plastic tubing snaking under the soil hooked up to a solar collector and a pump.
    The benefits are two fold.
    1: Warmer soil = faster root growth/longer season.
    2: Warm soil acts as a very large thermal mass keeping the temp up at night, also increasing growing season.
    Have yet to ‘switch on’ as do not have enough solar panels to drive the pump and had problems with airlocks too. Easy to solve just takes more money/time/motivation than I have right now.

  4. Sometimes we do things because it is fun. This is not a commercial airliner or even a toaster. I applaud ASA for his work. In the “old” days he would be upgrading a carburetor or boosting the power of a ham radio rig. So stop your idealistic crabbin. We need more Asas.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.