Introduction: Automated Greenhouse Ventilation

Picture of Automated Greenhouse Ventilation

In this instructable I will show you how I made my low budget greenhouse ventilation system.


Climate in Estonia is fairly cold therefore a greenhouse is very helpful for growing tomatoes. But tomato plants require relatively dry air to fruit properly, so the greenhouse needs to be ventilated. My greenhouse is located on a plot that is not my permanent home, so there are no people to open and close the windows manually every day.

My goals were:

  • Make the windows open and close depending on the temperature - in practice they close every night and open most of the summer days but not on rainy spring days and late autumn.
  • In addition make sure that the windows are closed during stormy weather because the wind can more easily destroy the greenhouse if it's not sealed up.
  • Not use mains power.
  • Make it on lowest budget I could reasonably come up with.

Main materials:

  • I chose an old car battery for the power source because it's possible to find them for free sometimes. They can hold plenty of energy even after becoming too lousy for a car. But You have to find one that is still able to charge up. After some period of neglect lead acid batteries refuse to do so.
  • Solar panel from ebay cost me about 25$.

  • The cheapest actuator I could think of was a discarded battery drill with a threaded rod and a block moving along that rod. I bought a used 12V drill that was sold cheaply because it's batteries had died.

  • For the brains I used Arduino Pro Mini clone and for sensing two DHT11 temperature and relative humidity sensors. DHT11 is not precise but I figured it's good enough for that purpose. I also included SD card for logging temperature and humidity measurements. Relay module of 4 relays drives the motor. (In one iteration I put 5V relay module in there and added a buck converter to supply power to it.)

  • To find out when it's getting dangerously windy I built an anemometer myself using old CD drive motor parts. Here I did not care about the exact measurement of the wind speed but just decided on gut feeling how many rotations of my makeshift anemometer is "stormy".

  • A length of metal rope (cable) is used to lift the windows open. This needs two poles slightly higher than the greenhouse. Three pulleys guide the ropes.

Build process is mostly documented in image comments. Text part of each step is the overview of the idea and thoughts that are not visible in the images.

Arduino code is published on https://github.com/libahunt/greenhouse but read step number 6 to know what to pay attention to when reusing it.

The system has been in use for 3 summers. So the pictures show some things that have changed over time. The longer video is made right after getting the first iteration ready in 2014. During that time some accidents have happened and some parts have got some wear so in the last step I will also cover what I plan to redo when next growing season arrives.

Step 1: Construction of the Greenhouse Itself

Picture of Construction of the Greenhouse Itself

As my goal was to use a single actuator for opening more than one window I had to consider it already when building the greenhouse.

There are two windows - one on each end of the building. The windows have hinges on top edge and counterweights on bottom edge to keep them shut while the mechanism is not pulling them open. Also the system requires a column next to each window from which to pull it. You could make heavy duty columns out of metal or other long lasting material and pour some concrete to keep them upward but I made a more lightweight mount. The columns are wood, they sit 30-40cm / 12-16'' in the ground with some rocks around them and on the opposite side from the window's weight there is a rope/cable pulling and attached to the ground with a peg.

One window is also used as entrance - there is a door part right below it. I added a piece of rope to the pole on that side. On the end of the rope there is a hook. So when you want to enter the greenhouse if the window is currently closed you lift it open and hang it to the hook. The open position is not really horizontal and the door is pretty low so we usually lift the window up to the hook even if it is in ventilating position.

The greenhouse walls are made of old windows. The roof is soft plastic (greenhouse special) and gets removed for winter, otherwise weight of snow and brittleness form cold would destroy it. The opening windows were made of some old shower walls I found from dumpster. But these were not resistant to UV light, they scattered and after only 2 summers I had to replace them. As I did not have suitable hinges laying around I used bicycle chain for the hinges - happy about that reuse opportunity (they work only for things that are in a hanging position).

Step 2: Power

Picture of Power
  • Old car battery
  • Solar cell 18V, 10W, with diode - about 25-30$ on ebay
  • Car fuse holder
  • Car fuse - ampere rating needs some more testing, 15A maybe
  • Connectors that fit car battery terminals - crocodile clips work but are not best choice
  • Decent wires (16AWG / 1.5mm)

As mentioned in the intro I chose an old car battery for the power source because it's possible to find them for free sometimes. They can hold plenty of energy even after becoming too lousy for a car. But You have to find one that is still able to charge up. After some period of neglect lead acid batteries refuse to do so.
I personally have built myself a "lead acid battery desulfator" that can make some older batteries come back to life. But it's crazy dangerous device so I don't recommend this to anyone who is not educated in mains electricity area or anyone who has children in the house. So just try to find a battery that does take charge from normal charger.

At first I planned to recharge the car battery after each week or two but got lazy and it was bad for the battery's health. Then I added a solar cell that is able to keep it charged up. I don't have the specs any more but it's rated 18V, 10W and contains a diode. It's physical size is 38x22cm / 15x8 5/8''. The solar panel cost me something like 25$ (ebay).

In addition to battery and solar panel the power part has a car fuse. I should replace the fuse with a smaller one because I have had some wires blow once but the 30A fuse did not act. I have information that 10A is probably too low for the short moment when the drill motor is just switched on. So next year I'll try lower values like 15A and see if they hold up in the normal operation.

Use decent wires, like 1.5mm / 16AWG copper. And increase the thickness if you place your battery far away from the motor. Don't use cheap "speaker wires" that are not copper as outdoors they corrode into nothingness soon. Chinese solar panels tend to come with these unreliable wires too, so replace them.

And use decent connectors on the battery terminals. Crocodile clips that I used are not the best for long term. Though I haven't noticed issues with them yet.

Step 3: Anemometer

Picture of Anemometer

Though the anemometer (wind speed measuring device) is not the most relevant part of the system, I feel it's a cool thing.
Here is a list of the junk I used to build the anemometer:

  • Old CD drive
  • Some aluminum i-profile (flat stock)
  • 4 spherical or conical lightweight plastic jars
  • 1 plastic jar for the center cap
  • Wood for the pole part
  • Small bolts, nuts and washers
  • Small wood screws
  • Operational amplifier LM358
  • Potentiometer (small trimpot) 10 k

CD ROM motor - the one that spins the CD - happens to contain few things that an anemometer needs:
- shaft with a bearing
- Hall's sensor (senses magnetic field)
- magnet to trigger the sensor
So I used it to make my anemometer.

The main operation was to take the motor apart and remove the motor windings from it. The windings and the magnet together brake the shaft from spinning. But when the windings are gone it spins freely.

I made the anemometer "cups" out of some food containers. Choose something with spherical or conical shape. I made arms to hold the cups from aluminium flat stock. Attachment to the CD motor was by drilling holes in the "plate" parts of the motor and using some wire in these holes. I bent the aluminium arms so that I could put another (slightly wider) cup on the centre and protect the motor and electronics from rain. This has worked nicely so far.

The cups do disintegrate in UV light so be prepared to replace them after 2 years or so.

I added a small circuit to get better signal form the anemometer to Arduino. The Hall's sensor only causes small fluctuations in the output voltage as magnetic field changes polarity. Something like between 2.2 and 2.8 volts maybe. It would be a challenge to read this with analogRead and decide when it actually did do a full up and down cycle. But comparator is a perfect solution. Comparator is actually an operational amplifier connected in a certain way. It compares two inputs and switches it's output to GND or 5V depending on which one of the inputs is currently higher. If you connect a voltage divider (potentiometer) to one of the inputs and set it so that it's voltage is between minimum and maximum of the other input's fluctuations then you get basically a binary signal out. What's even better is that comparator has hysteresis. It means it does not bounce back and forth when the two inputs are similar to each other but waits til the "which one is higher" is clear and switches output only then. This means it does not need debouncing in software. This makes the code part really simple.

You have to adjust the potentiometer into position where the output signal appears. Move the magnet ring to get fluctuations while adjusting the pot and observe the output. You could use multimeter but a LED with a resistor is easier. I found the output was blinking on and off six times per revolution

You could try calibrating the anemometer measurements if you'd like by comparing to a ready made hand held anemometer (about 10$ on ebay).

Step 4: The Window Opening Mechanism

Picture of The Window Opening Mechanism

Most noticeable part of the system - the actuator for pulling the windows open - is made of following parts:

  • Old battery drill (motor, chuck and part of the casing)
  • 1 meter M8 threaded rod
  • 1 skateboard bearing
  • M8 nuts
  • 8mm plywood (could be thicker and could be other weather resistant board)
  • Small block of hard wood
  • Piece of flat stock metal
  • Some washers
  • Wood screws

One end of the threaded rod was grinded into a triangular shape, then attached into the drill chuck. The "case" part needs to have a relatively smooth back wall, mount for the drill motor in the top and a "floor" with a skateboard bearing that holds the bottom end of the threaded rod.

The part that moves is a piece of oak. I drilled 9mm hole through it and made a M8 nut shaped recess around it. Then I made a "cover" out of flat piece of metal: 9mm hole in the centre and also two screw holes.

To make that block run on the back wall of the case I screwed some bigger washers to the corners as wheels. The block and the washers have held up nicely throughout the 3 years. Back wall has some signs of wear but it's not nearly at the end of it's life yet.

To connect the actual pulling cables to the actuator block of wood I improvised some tabs with holes in them that go underneath bolts. The bolts also hold the "nut cover" in place.

Two pulleys are needed in the top part. My original solution here is a little flimsy and unreliable and second version was not perfect either, so it will be redone next year.

The actuator also needs limit switches. I wanted to be careful and in addition to the sensors - limit switches that the microcontroller reads - I added a pair of "kill switches".

The sensors are a little oversized pushbuttons that got a spongy material cover to allow some slack between pushing the button down and pushing it broken.

One of the power wires to the drill goes through the kill switches - so if the system should ever ignore the sensor switch it would only break the sensor switch out of it's way and then hit the kill switch. And not break the case or motor mount or anything else.

I have experimented with two different makeshift switches as the kill switches because I was doubtful about the 3A motor current and normal lever switches. But both versions were highly unreliable. You can read more about them in the last step. Next summer I will just buy some bulky switches that could do the job.

Step 5: Electronics

Picture of Electronics

I have assmbled the electronics part of the system twice. First version was using 12V relays.

When the 12V relay module broke down I decided to redo the mess built around my homemade Arduino board into a more permanent assembly. This time I used Arduino Pro Mini and 5V relays (because I could not get 12V quickly). So I needed to add buck converter to get enough 5V current for the relays. The full schematic is about 5V relay version. Separate image of the module is 12V version.

Relays can be high or low level trigger. You can use either, just find the place in the code to set it right. And be careful when running first test because if something goes opposite direction then the limit switch on that side does not stop it.

I made the drawing of the entire system by hand and using symbols that felt best for communicating each part. Also threre are some of my older drawings of parts that you may find helpful.

If you don't want to include SD card you can turn off the functionality in the code. Micro SD module as opposed to the full size card module does not have 3.3V pin, but that is not used in my schematic anyway.

Step 6: Code

Code is published at https://github.com/libahunt/greenhouse . Find button "Clone or download", then "Download ZIP".

It consists of multiple files that appear as tabs in Arduino IDE. Many of the connections are hard coded and use direct port manipulation instead of digitalWrite and digitalRead. This makes code execute faster.

You should pay attention to following files (tabs):

  • layout.h - this lists all the connections to Arduino pins. Read through it and make sure your connections are the same.
  • Settings.h - Here are things you may want to tweak. Like the temperatures at witch to move windows, how often to take measurement etc. Important: Make "relayTriggerLevel" be right for the type of your relays.
  • greenhouse.ino - Only one important thing here - you can turn on or off Serial debugging by commenting in or out line: "#define DEBUG". If you left out SD card, you can also comment out "#define SD_LOGGING". But actually the thing works fine even if it's left in but no card or module is present.

Following two libraries are required:

https://github.com/niesteszeck/idDHT11

https://github.com/greiman/SdFat

Note 1: There are two features in the code that I did not test out because the system was already taken down for the autumn when I got time to write the code. One is measuring and logging the battery voltage. Second is windows operation timeout. If the motor has been switched on for longer than a preset time (assumed maximum time for going from open position to closed or vice versa) then the relays get turned off. Prevoiusly the realys stayed on if the limit switch was not hit for whatever reason. If you test my system and find anything fishy in it, please let me know.

Note 2: the code is written for a board with Atmega328 like Uno or Nano or Pro Mini. It wont work out of the box with Arduino Mega or other board with controller that is not 328 (or 168). At least the direct port manipulation parts have to be revised for the numbering of other controllers.

Step 7: Faults, Plans and Other Final Thoughts

I'll mention here that the system actually has a roof like structure (beneath the anemometer, made of a bucket) and cover for the actuator part but I don't have pictures of them. It was out in the elements for the first summer, I think, but in the longer run it needs cover, I just finished that part a little later.

Two failed attempts of "damage control switches"

One of the power wires to the drill goes through the kill switches - so if the system should ever ignore the sensor switch it would only break the sensor switch out of it's way and then hit the kill switch. And not break the case or motor mount or anything else.

First version experiment was some pieces of aluminium sheet metal. I bent a pair so that one touched another but could be pushed away if the actuator wooden block would hit it. These failed often. I think usually because aluminium does not have much elasticity and they just pushed away from each other. Also the surface could have corroded a bit.

My second experiment was with clothes pegs. I drilled a couple of holes in their jaws and put wires through and covered the wires in solder. This failed too. The surfaces corroded, at least the part that was not in direct contact with the other surface. I think mostly the clothes pegs just tilted too easily to one side and let the rounded solder surface slip and then ended up on a contact point that had already corroded.

Next summer I will just buy some bulky switches that could do the job. The drill takes about 3A constant current while working and spikes over 10A at the moment of starting up so it's no job for some small lever switch.

Electrical fuse with too high value

One day I found the rope pulled into a mess around the threaded rod. Don't know how that happened. But the situation had stalled the motor. And what broke down in the electrical system was not the fuse. Instead the worst connection was between wires and one screw terminal. The thing got hot in there, pulled the screw terminal plastic apart and somehow then the wires out. Clearly 1) I need to test lower fuse values, I was too generous with 30A fuse. But I think 10A is too low because I have measured a similar drill spiking over 10A at the moment when it starts moving. It's constant current was 3A. So next year I will check what 15A fuse will do. 2) I have to make sure I get good connection in the screw terminals - it is possible there was a problem with that too.

Corroding "speaker wires"

The cheap black and red, two core wire you have seen on most of the pictures is CRAP! It is not made of copper but some metal that corrodes outdoors. I have seen them fall apart couple of times. Lately I did replace it with copper 2x1.5mm (close to 16AWG) wire that is normally used for desk lamps etc. Also the solar panel originally came with that same crappy wire. Replaced that too. But I don't have pictures of the new wires.

Wear on the threaded rod and nut

The rod and nut held up longer than I expected - for 2 and a half summers. But then their lifetime was over. I replaced them but then surprise happened - in a week the problem was back. This time I myself had made things break down because I had somehow not screwed one of the mounting screws properly in and the riding block of wood got stuck when hitting the screw head. This destroyed the thread pretty quickly. So be careful to keep the riding track clear. Getting stuck like this is bad for the battery too because it keeps on trying and drains the battery.

Pulleys

The pulleys in the pictures are form a shower wall. They held up for a while but at some point one started to fall off from their shaft's. Then I tried bigger metal pulleys and made a more sturdy holder for them (next to the actuator, mounted to the pole itself this time, not to the plywood thingy). Then ... I dont't remember what exactly happened to it but that version started to seem suspicious too. Anyway I will revise the pulley part next summer. I think it is important to add some guide that does not let the rope fall off even if it gets a little slacky or shaken.

Things in progress

As I mentioned in the code step there are two features in the code I did not get a chance to test yet. First logging the battery voltage and second switching off the drill if hitting limit switch is not detected in preset amount of time. These should help to keep the battery better monitored and protected if problems like the worn out rod occur.

Future plans

I want to make the measurements visible. I think using a radio module and sending the data to another device that is indoors is best solution. Then I could make it even publish the data on the web or send it to me vie GSM module. But this may need replacing the controller. So I'll keep this project in github as is. I will deal with bugs if any occur. If I will make a version with radio and separate screen then it will be a separate repository.

Adding watering system is an option too but I don't have solid plans for that yet.

Comments

elpayo (author)2017-10-28

Very nice and pro work.

Thanks for the good instructable

acheide (author)2017-10-17

Resourceful, innovative, and creative.

Thank you for a nice Instructable.

Libahunt (author)acheide2017-10-17

Thank You! :)

DIY Hacks and How Tos (author)2017-10-16

This is pretty much exactly what I need in my green house. If I leave it sealed all day, it gets too hot in the afternoon and if it is ventilated all the time it gets too cold at night.

and not just the heat. Especially with tomatoes it shouldnt get too humid either

diy_bloke (author)2017-10-16

Well done!!

Swansong (author)2017-10-16

I would love something like this in our greenhouse! There were a couple of times this summer I forgot to open the vent and nearly cooked the plants to death. ^.^;

About This Instructable

1,756views

54favorites

License:

Bio: Maker of all trades ... or at least many :) Interested in electronics including programming, woodworking, how to grow edible plants in cold climate of my homeland ... More »
More by Libahunt:Automated Greenhouse VentilationLighting Under DeskLittle trick for desoldering through hole components
Add instructable to: