Temperature controller with data logging

Australia & New Zealand Homebrewing Forum

Help Support Australia & New Zealand Homebrewing Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

jbronko

Member
Joined
13/2/14
Messages
14
Reaction score
1
Hey,

I am not sure if this product exists or if anyone has rigged one up them self. But what I am after is a temperature controller (thermostat) which will also log the temperature and when the output is ON.

I then want to download this data to a computer.

Has anyone else ever wanted to do this? Does this product already exist?
 
For my ferment fridge I haveset up a raspberrypi as a temp controller and output graphs of the temps to a webpage within my network. It doesn't plot when the heater is on or not as it isn't real time monitoriing just every 5 minutes. Its similar to a brewpi, but without the arduino shell and I only control a ferment fridge for both heating and cooling loops.

My set up is a combination of http://www.raspberrypi.org/forums/viewtopic.php?f=37&t=24115 and https://gist.github.com/tdack/9129944 (brew-pi.dack.com.au, which seems to be donwn)
 
This wouldn't be so hard to make (Arduino + DS18B20 + SSR + Ethernet-SD shield)

But I'm curious to know why you want to log the temperature. Surely if the controller is working the temperature is (theoretically) constant ?


-kt
 
Mr Wibble said:
This wouldn't be so hard to make (Arduino + DS18B20 + SSR + Ethernet-SD shield)

But I'm curious to know why you want to log the temperature. Surely if the controller is working the temperature is (theoretically) constant ?


-kt
I know with the accuracy of Brewpi you can actually see when the yeast stop working, the algorithm is still expecting the yeast to produce heat, so you get a .1c extra drop more than what has been happening. If you were wanting to know the viability of a yeast you'd had banked for a while (Yob has a store of green belt a year or more old unavailable here in Aus ). You could check your current ferment against say one when you originally aquired the yeast
 
Mr Wibble said:
This wouldn't be so hard to make (Arduino + DS18B20 + SSR + Ethernet-SD shield)

But I'm curious to know why you want to log the temperature. Surely if the controller is working the temperature is (theoretically) constant ?


-kt
I enjoy recording things :)

I live in the snowy mountain region, and the winter here will have pretty cool ambient temperatures. I am interested in recording how often the thermostat is on and for what temperatures so that I can build a profile for my fermentation corner to help me choose what to brew (yeastwise particularly) at what time of the year (my fermentation occurs in a hallway which is not heated once I go to sleep - currently it is just an esky with a heat belt around the fermenter conntected to a thermostat).

It may be a waste of time because I already know what the results are going to look like (I can get outside air temperature data from work), but I feel like it will be a fun project.

Thanks for your suggestions. I'm going to look down the arduino route and put something together myself...
 
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

test.png


test_1y.png
 
Those are some neat setups. It seems everyone is creating their own gear to get exactly what they want out of it.

I have now sourced a free raspberryPi off a mate so that should get me started. It has been a few years since I've coded but a quick google shows that there is a lot of tutorials and information out there.
 
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

test.png


test_1y.png
Wow I'm looing at doing exactly the same thing as this currently (Have the Pi, and the three probes all set up, but just trying to workout the best software for the job.

I currently have some hacked together pre-exising projects that log a live webpage I can check (on my home network) to see the current, and historical temperatures, but I'd like to expand on it a bit more, ie. stop and start recording, maybe mark activities on the graph (like when I cold crash) etc.

What applications are you currently using?
 
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)
# GPIo_Output(COOLING, GPIO.HIGH)
GPIO.setup(HEATING, GPIO.OUT)
# GPIo_Output(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:
GPIo_Output(HEATING, GPIO.HIGH)
GPIo_Output(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:
GPIo_Output(COOLING, GPIO.HIGH)
GPIo_Output(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:
GPIo_Output(COOLING, GPIO.LOW)
GPIo_Output(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:
GPIo_Output(HEATING, GPIO.LOW)
GPIo_Output(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:
GPIo_Output(COOLING, GPIO.HIGH)
GPIo_Output(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.
 
Mick0s said:
Wow I'm looing at doing exactly the same thing as this currently (Have the Pi, and the three probes all set up, but just trying to workout the best software for the job.

I currently have some hacked together pre-exising projects that log a live webpage I can check (on my home network) to see the current, and historical temperatures, but I'd like to expand on it a bit more, ie. stop and start recording, maybe mark activities on the graph (like when I cold crash) etc.

What applications are you currently using?
Hi,
The sensors (DS18B20) are natively supported on Raspi using the 1-wire protocol so it is just a matter of polling them however often you want to read the temps.
I use RRDTool to log the temps and produce the graphs which is really simple once setup.

I just checked on google and there is shedloads of info available now which I wish I had when I started.
I had pre-ordered a RasPi and received it on day 1 as I knew exactly what I wanted to do with it :D
 
Cheers for the code glenos,
It looks so much better than mine :blush:
I'm OK with the hardware but the coding I really struggle with.
 
anthonyUK said:
Cheers for the code glenos,
It looks so much better than mine :blush:
I'm OK with the hardware but the coding I really struggle with.
Your's must be bad if mine looks good. :huh: My programming knowledge is not quite limited to one semster at uni in the mid-90's using ADA.
 
That's one semester more than me.
Mine is barely functional TBH.
 
Back
Top