FINAL
PROJECT
Arduino Greenhouse
Concept: A laser cut pressfit
acrylic greenhouse dome controlled by an Arduino. When the
temperature rises above a certain (user-set) value, a convection
vent opens automatically; when the temperature falls below a
certain value, the vent closes. When the humidity falls below a
certain value, a water valve leading to a drip irrigation hose
opens; when the humidity rises above a certain value, the water
valve closes. This will lower the price and labor intensiveness of
local agriculture while extending the growing season in temperate
climates.
Execution:
1.
After feedback from Prof. Gershenfield, I changed the concept of
the dome to a strut-and-hub geodesic wrapped in flexible plastic,
with vent and cable panels inserted as necessary. I found an
acceptable design
on Thingiverse and modified it a bit, scaling it up to 1.44
times the original size.
After
some runaround getting PVC pipes, I decided to go with wooden
dowels for struts. Due to the amount of time that printing all the
strutcaps required for a 2V dome would have taken (150 strutcaps
divided by six caps printable on the Thingomatic at one time,
times five hours per batch is 125 hours of printing...not counting
the hubs,) I decided to do a simple, 1V geodesic dome, i.e., an
icosahedron. This is a better design from a practical point of
view as well-the top is angled steeply relative to a 2+V geodesic,
which means that water will run off easier. All a 1V dome requires
is 25 struts and 11 hubs. I used the 6-hole hubs where the
original design calls for 4 (ground level,) on the theory that the
two extra holes can be used to hold anchor struts either going
into the ground or sandbagged down.
I
ended up casting most of the hubs, as seen in the pictures below,
because printing them took too much time. The cast ones are more
durable than their printed cousins, which have a tendency to
crack. Likewise, the printed caps were nothing but trouble.
Printing the maximum amount of hubs which will fit on the
MakerBot's tray causes it to start messing up near the top of the
print, probably due to too much mass with too high a center of
gravity getting jerked around. Several batches ended up ruined
this way, and finally the MakerBot's tray warming wire harness
burned out. Also, during assembly, many of the caps would snap
while being inserted into the hubs. As far as I can tell, this was
caused by the poor printing quality of the Thing-O-Matic; the caps
printed by Anna Kaziunas on her home printer have proved to be
much more resilient. Ted McAuliffe suggested annealing the caps by
warming them in the toaster oven to almost the melting point of
the plastic, but I think that in the future I will just cast them.
So, thus far I have not been able to complete the frame. You can
see the result (about 80% complete) below, and as soon as I get my
own Ultimaker set up and printing consistently, I will post the
rest.
Mechanically, I had one element to complete: an automatic vent. I ended up using a laser cutter to create a rotating vent out of flat acrylic elements, which worked like gangbusters. You can read about the details here.
So,
having made the vent and frame, I had to make the guts of the
greenhouse. I used a solenoid valve and controlled it using a TIP
120 transistor which I bought from Radio Shack. The wiring is
quite simple, and is explained here.
The servo control was also quite easy, a slight modification of
the example in the Arduino libraries; the most time-consuming part
was figuring out how many degrees the vent's zero was on the
Arduino and changing the code to reflect that difference for
opening and closing the vent. The most painful part of setting up
the guts was making the AM2302 integrated heat/humidity sensor I
bought from Adafruit work with the fabbed Arduino. It worked
perfectly with the commercially produced boards but refused to
read from any of the fabbed ones. Anna Kaziunas-France finally
figured out the issue, which was a difference in resonators
between the two boards, and modified the sensor's library, after
which it began to work like a charm.
I
then finalized the Arduino sketch, which was not too difficult.
You can see it below. I changed the time values to make the cycle
quicker for troubleshooting purposes (they are 60000 ms in the
original, since greenhouse conditions don't change too quickly,)
and messed with the temperature thresholds so that I could make
the vent open and the solenoid valve close by blowing on the
sensor to increase humidity, or holding my hand over it to
increase temperature.
// Arduino Greenhouse code #include "DHT.h" //includes AM2302 temperature/humidity sensor library #include <Servo.h> //includes servomotor library #define DHTPIN 9 // the temperature and humidity sensor's pin #define VALVEPIN 11 // the solenoid valve's control pin #define DHTTYPE DHT22 // DHT 22 (AM2302) Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created int pos = 0; // variable to store the servo position DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); Serial.println("Controlling Heat and Humidity"); dht.begin(); myservo.attach(7); // attaches the servo on pin 9 to the servo object } void loop() { // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); float t = dht.readTemperature(); // check if returns are valid, if they are NaN (not a number) then something went wrong! if (isnan(t) || isnan(h)) { Serial.println("Failed to read from DHT"); } else { Serial.print("Humidity Is "); Serial.println( h ); if (h < 60) { Serial.println("Opening Irrigation Valve"); digitalWrite (VALVEPIN, HIGH); delay(10000); digitalWrite (VALVEPIN, LOW); } else if (h > 60) { Serial.println("Closing Irrigation Valve"); digitalWrite (7, LOW); } Serial.print("Temperature Is "); Serial.println(t); if (t>25) { Serial.println("Opening Vent"); myservo.write(80); delay(3000); } else if (t<25) { Serial.println("Closing Vent"); myservo.write(175); } } }
In
the video below, I talk through the final result: