Introduction: Plant Micro Climate

Some plants require pretty specific environments to thrive. Many beautiful plants grow best in a climate that is nothing like the climate where you live. Orchids are a perfect example of this. They require cool temperatures and very high humidity, nothing like the environment where I live. In an effort to create a better environment for orchids we built a small "world" for them to grow better. The main feature is a fish tank to contain everything. We also needed lighting and a way to monitor temperature and humidity.

Step 1: Gather Parts and Tools

Materials:
- Aquarium of adequate size for the plants you want to grow
- Lid (plexiglass from a local hardware store)
- Light (LED aquarium light works great)
- Raspberry Pi (SD Card, power, wifi adapter-optional)
- Temperature/Humidity sensors (DHT22 AM2302 SHT11 SHT15)
* I used AM2302 sensors. If you use others, there will be changes needed in the script.
- Resistors (2ea. 4.7k to 10k)
- Phone/modem cable (four conductor to connect the sensors)
- Adafruit 16x2 LCD
- f/f jumper wires
- NO momentary switch
- two pin header
- Case/mounting solution

Step 2: Set Up the Aquarium

The Aquarium/lid/light portion is pretty straight-forward. Buy or find one in your garage or basement, a good sized aquarium for your plants. Used aquariums are very cheap and pretty easy to find. Cut the plexiglass to fit the inner lip of the top of the aquarium. If you buy this from a hardware store, they can do this for you and you end up with a nice clean cut. I personally have not had the best luck cutting this material myself. You will need to cut/drill a few notches in the lid for the sensor connections. For the light I recommend the modern LED aquarium lights available from pet stores and Amazon. I used the Marineland brand, but there are others. They are much brighter and last much longer than any older fluorescent tube fixture that you might be tempted to use.

Step 3: Setup the Raspberry Pi

Now you have a way to contain the environment. But you will want to know the parameters of that environment. That's where this gets a little more complicated. I used a Raspberry Pi model B with a base Raspbian install. There are a few additional software packages needed to make the LCD work. If you use the Adafruit LCD they have a great tutorial on getting that up and running. There is a newer tutorial but I have not tested it. All links to external information sources are a little lower.

I have provided a wiring diagram above. This is how I connected everything. If you want more detailed information take a look at the links below. That diagram does not include the reset switch. That was added later. I find it helpful if there is a problem with the Pi and you need to reboot. It's much faster than SSHing into the Pi and running the reboot command.

- Install Raspbian on your SD card
* add software for the LCD

$ sudo apt-get install python-dev
$ sudo apt-get install pythong-setuptools
$ sudo easy_install -U distribute
$ sudo apt-get install python-pip
$ sudo pip install rpi.gpio

- Hook up the LCD - see link below
- Hook up the Temp/Hum sensors - see link below
- Install the header for the Pi reset (optional)
- Squeeze it all into a case

LCD tutorial - https://learn.adafruit.com/drive-a-16x2-lcd-direc...
Updated LCD tutorial - https://learn.adafruit.com/character-lcd-with-rasp...
DHT tutorial - https://learn.adafruit.com/dht-humidity-sensing-o...
Reset switch tutorial - http://raspi.tv/2012/making-a-reset-switch-for-you...

Step 4: Code

Here is "my" code to query the sensors for values and update the LCD. It can be made better and I hope to do so in the future. You will want to save this as a file, and add it to your /etc/rc.local or create a startup script. 
#!/usr/bin/python
from Adafruit_CharLCD import Adafruit_CharLCD from subprocess import * from time import sleep, strftime from datetime import datetime import subprocess import re import sys import time #import MySQLdb as mdb # later feature #import time #import datetime
lcd = Adafruit_CharLCD()
lcd.begin(16,1)
while 1:
    output1 = subprocess.check_output(["./Adafruit_DHT", "2302", "4"]);
    matches = re.search("Temp =\s+([0-9.]+)", output1)
    if (not matches):
          time.sleep(10)
          continue
    ctemp = float(matches.group(1))
    ftemp = ctemp * 9/5.0 + 32
    # search for humidity printout
    matches = re.search("Hum =\s+([0-9.]+)", output1)
    if (not matches):
          time.sleep(10)
          continue
    humidity = float(matches.group(1))
    #adjust value for accuracy
    humidity = humidity - 9
    output2 = subprocess.check_output(["./Adafruit_DHT", "2302", "18"]);
    matches = re.search("Temp =\s+([0-9.]+)", output2)
    if (not matches):
          time.sleep(10)
          continue
    ctemp2 = float(matches.group(1))
    ftemp2 = ctemp2 * 9/5.0 + 32
    # search for humidity printout
    matches = re.search("Hum =\s+([0-9.]+)", output2)
    if (not matches):
          time.sleep(10)
          continue
    humidity2 = float(matches.group(1))
    #adjust value for accuracy
    humidity2 = humidity2 - 15
    lcd.clear()
    #lcd.message(datetime.now().strftime('%b %d %H:%M:%S\n'))
    lcd.message('1 ' + 'T %s' % ( ftemp ) + ' H %s' % ( humidity ) + '\n' )
    lcd.message('2 ' + 'T %s' % ( ftemp2 ) + ' H %s' % ( humidity2 ) )

Step 5: Observe and Adjust

Now that it is up and running you see the parameters of your newly created micro-environment.

Shown in the top picture, for a larger tank you can put both sensors in different areas to ensure uniformity.

Shown in the bottom picture, you can also leave one sensor outside of the tank to see the difference between the environment inside the tank and outside of the tank.

Using this information you can decide if you need to turn on a fogger to increase humidity (be careful, some of them get hot), or open the lid to adjust the airflow.

Another important feature of this system is a couple of small fans in the aquarium. I recovered two old computer fans and attached them to a recovered wall-wart transformer. The fans are at different heights and circulate the air to inhibit fungus growth and prevents rot in the plants.

Indoor Gardening Contest

Participated in the
Indoor Gardening Contest