post OrchidPi

June 18th, 2014

Filed under: Tech — RHH @ 10:51 pm

So here is another project that I’m working on.  This is just going to be a short post because a few people have asked for more information and code (what there is).

What it is:

Two zone temperature/humidity monitor with custom case for my wife’s orchid tank. Orchids have unique environmental requirements. Next feature is to write the values to a database so that I can produce a chart of historical values.  Another desired feature is to control a humidifier as needed to maintain adequate humidity.


What it looks like installed:


What it looks like up close:


Here is the gnarly wiring diagram:



For this part keep in mind that I am not a programmer by training or any other way.  I used several internet sites to come to this.  Some of those sites provided a significant amount of code.  I will try to cite them at some point.  You will need the LCD library from Adafruit.  I will get that link on here later.  Here is the code:


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()


while 1:
    output1 = subprocess.check_output(["./Adafruit_DHT", "2302", "4"]);
    matches ="Temp =\s+([0-9.]+)", output1)
    if (not matches):
    ctemp = float(
    ftemp = ctemp * 9/5.0 + 32

    # search for humidity printout
    matches ="Hum =\s+([0-9.]+)", output1)
    if (not matches):
    humidity = float(
    #adjust value for accuracy
    humidity = humidity - 9

    output2 = subprocess.check_output(["./Adafruit_DHT", "2302", "18"]);
    matches ="Temp =\s+([0-9.]+)", output2)
    if (not matches):
    ctemp2 = float(
    ftemp2 = ctemp2 * 9/5.0 + 32

    # search for humidity printout
    matches ="Hum =\s+([0-9.]+)", output2)
    if (not matches):
    humidity2 = float(
    #adjust value for accuracy
    humidity2 = humidity2 - 15

    #lcd.message('%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 ) )


Note: If I have used some of your code and you would like to be linked or given credit, please just let me know.  I will leave comments on for a short time.  I get so much spam!

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment


Powered by WordPress, Web Design by Laurentiu Piron
Entries (RSS) and Comments (RSS)