Beer Brewing Thermometer

ocwo92

New Member
A friend of mine is an avid all-grain home beer brewer. He prefers to keep things as manual as possible, but one thing bugs him: the thermometer is a delicate piece of equipment, and the lautering process requires careful monitoring of the temperature. Of course, digital thermometers come a dime a dozen, but how about a thermometer that can be programmed for a target temperature and tells him to increase or decrease the heat? It's basically a thermostat, yes, but for DYI guys like him and me, a home-made one is better than anything you can find at a store.

This is of course a job for the PICaxe 08M, which has built-in support for the Dallas Semiconductors DS18B20 1-wire temperature probe. The first version is quite simple: the user sets the target temperature using an IR remote, and the 08M writes back the entry on a two-digit display. Next, the 08M continuously measures the temperature via the DS18B20, and lights an LED if the heater must be turned up. The user may change the target temperature any time using the remote.

The display makes use of two 4026 decade counters with built-in 7-segment drivers. Only two wires are required to display two digits: one reset signal that resets the decade counters to 00. The other is a clock that is pulsed to count to the desired output. The counting is fast enough to cause only a small fluttering of the display as the desired output is reached.

The DS18B20 is mounted in a copper pipe with brass ends, allowing it to be submerged in the warm or boiling wort during the entire brewing process.

The full documentation may be found here.
 

Attachments

Last edited:

westaust55

Moderator
Congratulations on getting your project working and "published".

Your temperature display/controller thermometer looks a very well constructed and neat package.

The program listing is well presented with indentation and comments to help other understand the workings.

One of my laments (grumbles) on this PICAXE forum is use of links to other website siteswhich may eventually fail so that the purpose and detail of the original poist here is lost.
My suggestion is to always post the program code, schematics and photos here.

To that end I have as a starting point provided a copy of you PICAXE 08M program here:

Code:
' Beer Brew Temperature Control

' Usage:
' NN: Set the target temperature, which is displayed for
' one second. Then the display shows the current
' temperature.

#picaxe 08m
#com /dev/ttyUSB0

' Preload the EEPROM with defaults:
' Value: Last target temperature.
eeprom 0, ( 60 )


' Pin 0: Reset 4026-based 7-segment counter.
' Pin 1: Input from sensor.
' Pin 2: Output to heater indicator.
' Pin 3: IR input.
' Pin 4: Count a 4026-based 7-segment counter.
input 1
output 0, 2, 4

symbol i = b0
symbol two_digits = b1
symbol targettemperature = b2
symbol currenttemperature = b3
symbol lasttemperature = b4
symbol difference = b5
symbol waitcounter = w3 ' b6:b7
symbol irreceiverpin = pin3
' symbol infra = b13 (these are synonymous)

' Turn off heater.
low 2

' Restore the settings from EEPROM.
read 0, targettemperature
lasttemperature = -127

main:
	waitcounter = 15000
	' Wait for a key. Poll for a key in order to let the temperature be
	' updated repeatedly.
poll:
	if irreceiverpin = 0 then
		infrain2

		' If it's a digit key, then it's the target temperature.
		if infra < 10 then
			' Decode the first key, bypassing wait and validation.
			gosub getonedigit_nowait
			' Get the second digit of the two-digit number.
			gosub getseconddigit
			targettemperature = two_digits
			' Store the target temperature in EEPROM.
			write 0, targettemperature

			' Show the target temperature for two seconds before
			' showing the current temperature.
			pause 1000
			lasttemperature = -127
			goto sampletemperature
		endif
	endif

	' Count down until about half a minute before sampling the temperature.
	waitcounter = waitcounter - 1
	if waitcounter > 0 then poll


	' Read the temperature. We won't compensate for impossible
	' negative temperatures.
sampletemperature:
	readtemp 1, currenttemperature
	' Show the current temperature again if it has changed.
	if currenttemperature <> lasttemperature then
		lasttemperature = currenttemperature
		two_digits = currenttemperature
		gosub showtwodigits
	endif

	gosub adjustheater

	goto main


' Turn heater on or off, depending on temperature. This could be
' modified to, e.g., set a servo motor to open or close a valve. In
' this case, it indicates whether the temperature is high or low.
adjustheater:
	difference = targettemperature - currenttemperature
	' Too hot: Turn off the heater.
	if difference > 128 then
		low 2
	' Too cold: Turn on the heater.
	else if difference >= 1 then
		high 2
	endif
	return


' Read one digit key from the remote.
getonedigit:
trydigitagain:
	infrain2
	' Keep trying until a valid number key has been entered.
	if infra > 9 then trydigitagain
	' Label used to bypass waiting and validating the digit.
getonedigit_nowait:
	' Keys '1' through '9' have values 0 through 8, and
	'  key '0' has value 9. Add one, and perform a modulus 10
	' to wrap the '0' key around, and we have the true value
	' of the key.
	infra = infra + 1
	infra = infra // 10
	' Wait until the key has probably been released.
	pause 500
	return

' Read two digit keys from the remote and return the
' two-digit value.
gettwodigits:
	gosub getonedigit
	' Label used to bypass waiting for the first digit.
getseconddigit:
	' Move the first digit to the tens position.
	two_digits = infra * 10
	gosub getonedigit
	' Add the lower digit to the ones position.
	two_digits = two_digits + infra
	' Display the entered value.
	gosub showtwodigits
	return


' Show the value of "two_digits" by resetting the display
' and counting to the display value.
showtwodigits:
	' Reset the counters.
	pulsout 0, 1 ' 10 us pulse
	' Count to the display value.
	if two_digits = 0 then endshow
	for i = 1 to two_digits
		pulsout 4, 1 ' 10 us pulse
	next i
endshow:
	return
 

ocwo92

New Member
One of my laments (grumbles) on this PICAXE forum is use of links to other website siteswhich may eventually fail so that the purpose and detail of the original poist here is lost.
My suggestion is to always post the program code, schematics and photos here.

To that end I have as a starting point provided a copy of you PICAXE 08M program here:
No problem. In this case, the external web site will be up for at least the next decade though.
 

ocwo92

New Member
Image sizes

I just attempted to upload the vero board layouts, but the image sizes aren't allowed by the forum; I'm afraid they'll have to remain at the external web site.
 

MPep

Senior Member
Congats on a job well done. ;)
Is a schematic available to be posted here? Would be easier than redrawing from Vero layout.:D
 

ocwo92

New Member
Congats on a job well done. ;)
Is a schematic available to be posted here? Would be easier than redrawing from Vero layout.:D
I don't have schematics for this project, because it is almost identical to my high-speed flash timer project. The schematics for that project can be found in the detailed documentation.

The flash hotshoe circuit and the trigger input circuit are omitted from the construction. I added the a LED with a resistor and the 18B20 with a resistor directly onto the veroboard without a schematic.
 

bogbean

Well-known member
I too am a home brewer so I made a version of this as my first proper Picaxe project (this is my first post).

I keep my mashing beer warm in the oven so I modified the functionality to sound alarms (piezo) if the temperature is either too high or too low. I then have to adjust the oven temp to suit. I have a push-button to silence the alarm either temporarily or permanently (if pressed when powered up).

Look carefully at the photo and you'll notice an array of transistors I had to shoehorn onto the display board as an afterthought when I realised the 7-segment displays were not very brightly driven.

I have the code and more details if anybody is interested.
 
Last edited:
Top