anthonyUK said:
I use a RasPi to log my temps. It is interesting, fairly simple to do and a RasPi is not so expensive to buy or run.
I use an STC-1000 but it wouldn't be so difficult to get the Pi (or Arduino) to control the fridge/heater if required.
The new Arduino Yun looks like a good option with built in networking.
I switched from using a Temper2 USB sensor to DS18b20s last year which is when the new graph started
Here are some live images of the log
This is pretty much what I have been doing, unig three probes, Shed, Fridge and Fermenter. I then threw some python script around the fridge and fermenter temps to control a relay board, the set point for the control temp is set via a php webpage. I can't post any pics of a graph as I have disconnected while I'm not brewing. Here are my python and php scripts if anyone is interested.
This checks the temperature probes, and switches the relay on for a set time if required, then rechecks the temperatures, once they are in control it swiches off the relay.
#!/usr/bin/python
import os
import sys
import re
import RPi.GPIO as GPIO
import time
import math
def main():
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
# set BCM pin number for the furnace.
COOLING = 17
HEATING = 18
GPIO.setup(COOLING, GPIO.OUT)
# GPI
utput(COOLING, GPIO.HIGH)
GPIO.setup(HEATING, GPIO.OUT)
# GPI
utput(HEATING, GPIO.HIGH)
# see if the one-wire "w1" interfaces are loaded
modfile = open("/proc/modules")
moduletext = modfile.read()
modfile.close()
if not (re.search("w1_gpio", moduletext) and re.search("w1_therm", moduletext)):
# if modules not found, install them
os.system('sudo modprobe w1-gpio')
os.system('sudo modprobe w1-therm')
# define serial number for the DS18B20 temperature sensor
sensmaintemp = "/sys/bus/w1/devices/28-000005505397/w1_slave" #inside sensor
sensenclosuretemp = "/sys/bus/w1/devices/28-000005508fe9/w1_slave"
# this reads the temperature and rounds the value to the nearest decimal.
def currtemp():
while(1):
tfile = open(sensmaintemp)
text = tfile.read()
tfile.close()
firstline = text.split("\n")[0]
crc_check = text.split("crc=")[1]
crc_check = crc_check.split(" ")[1]
if crc_check.find("YES")>=0:
break
secondline = text.split("\n")[1]
temperaturedata = secondline.split(" ")[9]
temperature = float(temperaturedata[2:])
temperature = temperature / 1000.0
temperature = round(temperature, 1)
return temperature
def enctemp():
while(1):
tfile = open(sensenclosuretemp)
text = tfile.read()
tfile.close()
firstline = text.split("\n")[0]
crc_check = text.split("crc=")[1]
crc_check = crc_check.split(" ")[1]
if crc_check.find("YES")>=0:
break
secondline = text.split("\n")[1]
temperaturedata = secondline.split(" ")[9]
temperature = float(temperaturedata[2:])
temperature = temperature / 1000.0
temperature = round(temperature, 1)
return temperature
# set desired temperature using thermostat file from web server
def settemp():
readtemp = open("/var/bin/thermostat", "r")
settemp = readtemp.readline(4)
readtemp.close()
return float(settemp)
# hold the temperature at the settemp
def holdtemp():
if currtemp() < 0 or currtemp() > 50:
GPI
utput(HEATING, GPIO.HIGH)
GPI
utput(COOLING, GPIO.HIGH)
status = open("/var/bin/status", "w+")
status.write("Temperature Error")
status.close()
# print "Temp Error: ", currtemp()
else:
if currtemp() > settemp() - 0.2 and currtemp() < settemp() + 0.2:
GPI
utput(COOLING, GPIO.HIGH)
GPI
utput(HEATING, GPIO.HIGH)
status = open("/var/bin/status", "w+")
status.write("Temperate is in control")
status.close()
# print "Temperature is: ", currtemp(), "Fridge Temp is: ", enctemp()
else:
while currtemp() >= settemp() + 0.2 and enctemp() > settemp() - 0.5:
GPI
utput(COOLING, GPIO.LOW)
GPI
utput(HEATING, GPIO.HIGH)
status = open("/var/bin/status", "w+")
status.write("Fridge is on.")
status.close()
# print "Fridge is on: ", currtemp(), "Fridge temp is: ", enctemp()
time.sleep(30)
else:
while currtemp() <= settemp() - 0.2 and enctemp() < settemp() + 0.5:
GPI
utput(HEATING, GPIO.LOW)
GPI
utput(COOLING, GPIO.HIGH)
status = open("/var/bin/status", "w+")
status.write("Heating is on.")
status.close()
# print "Heating is on: ", currtemp(), "Fridge temp is: ", enctemp()
time.sleep(30)
else:
GPI
utput(COOLING, GPIO.HIGH)
GPI
utput(HEATING, GPIO.HIGH)
# print "Fridge and Heater are off", currtemp(), "Fridge temp: ", enctemp()
status = open("/var/bin/status", "w+")
status.write("Waiting ..., check the temperatures")
status.close()
# this constructs an infinite loop
# infloop = 1
# while infloop == 1 :
holdtemp()
sys.exit()
if __name__ == '__main__':
main()
This reads the temps and stores them in a RRDTool database to generate the graphs.
import os, glob, time, datetime, rrdtool
#os.system('modprobe w1-gpio')
#os.system('modprobe w1-therm')
database_file = "/SeagateNAS/www/temps/temperatures.rrd"
device_folder = glob.glob('/sys/bus/w1/devices/28*')
#device_file = [device_folder[0] + '/w1_slave', device_folder[1] + '/w1_slave', device_folder[2] + '/w1_slave']
rrds_to_filename = {
"freezer" : "/sys/bus/w1/devices/28-000005508fe9/w1_slave",
"shed" : "/sys/bus/w1/devices/28-000005502ec7/w1_slave",
"ferment" : "/sys/bus/w1/devices/28-000005505397/w1_slave",
}
def read_temperature(file):
tfile = open(file)
text = tfile.read()
tfile.close()
lines = text.split("\n")
if lines[0].find("YES") > 0:
temp = float((lines[1].split(" ")[9])[2:]) # (get rid of the t=)
temp /= 1000
return temp
return ERROR_TEMP
def read_all():
template = ""
update = "N:"
for rrd in rrds_to_filename:
template += "%s:" % rrd
temp = read_temperature(rrds_to_filename[rrd])
update += "%f:" % temp
update = update[:-1]
template = template[:-1]
rrdtool.update(database_file, "--template", template, update)
read_all()
There are also a html static webpage to display the graphs and a php webpage with a drop down to set the set temp for the first bit of code.
The temperature graphs are created using RRD Tool with a couple of cron jobs, one job collects the data every 5 minutes the second one updates the graphs every 30 minutes.