Exemplo n.º 1
0
    line1 = "Last Cycle Ended"
    line2 = "on: " + dates["endDate"]
    line3 = "Temp: " + str(temperature)[:2] + " F"
    line4 = "Humidity: " + str(humidity)[:2] + " %"
    
    lcd.postToLCD(line1, line2, line3, line4)

#######################################################################################
#start the infinite loop
#######################################################################################
startTime = time.time()
while 1:

    #take a temp measurement with the LCD temp/humidifier sensor
    humidity, temperature = dht.humidityAndTempCheck(THSensorLCDPin)

    #get the dates for growth cycle
    with open("dates.json", "r") as file:
        dates = json.load(file)
        file.close()

    #if the growth cycle is taking place, display this to the LCD screen
    if dates["cycleStatus"].lower() == "in use": 
        LCDLinesDuringGrowCycle(humidity,temperature, dates)

    #if the growth cycle is taking place, display this to the LCD screen
    elif dates["cycleStatus"].lower() == "waiting for next batch":
        LCDLinesNotDuringGrowCycle(humidity,temperature, dates)

Exemplo n.º 2
0
import DHT22 as dht
import json
import datetime

#polling from the sensor
THSensorWebsitePin   = 23
humidity, temperature = dht.humidityAndTempCheck(THSensorWebsitePin) 

#make a time stamp for the data just captured
now = datetime.datetime.now()

#put data and timestamp into object
data = {
    "temperature": [temperature],
    "humidity": [humidity],
    "time": {
        "year": [now.year],
        "month": [now.month],
        "day": [now.day],
        "hour": [now.hour],
        "minute": [now.minute]
    }
}

with open("currentData.json", "w") as outfile:
    json.dump(data, outfile)




Exemplo n.º 3
0
setpointLowBound = 80
# % relative humidity setpoint
setpointHighBound = 95
delay = 0.25  #delay of loop in seconds
emailRecipients = "just me"
humidMin = 50  #minimum % relative humidity for notifications

#######################################################################################
#Pin setup
#######################################################################################
humidityInputPin = 24
humidityOutputPin = 22
yellowLEDPin = 21  # on if humidity out of range

#take initial measurement
humidity, temperature = DHT22.humidityAndTempCheck(humidityInputPin)

#if the humidity is >= setpoint, wait till it falls below to start the controller
#while humidity >= setpointLowBound:
#    print('waiting for the humidity to drop below setpoint for humidity controller to start')

#turn humidifier on
relay.relayToggle(humidityOutputPin, delay)

humidifierOn = True
#if true, humidifier is on, if false, it is off

#######################################################################################
#start the infinite loop
#######################################################################################
startTime = time.time()