Temperature Controller For a Brewery

Thread Starter

jjlwork

Joined Sep 26, 2007
4
Hi folks, brand new to electronics, but I consider myself a smart guy lol ;-).

I am looking to automate some/all of the processes in my home brewery and although it is probably a bigger project than any beginner should take on, I think I can break it down into a couple smaller reusable projects and learn from it and tie it all together in the end.

Here is what the expectations of my project outcome are:

There are 3 heating elements such as used in hotwater heaters that would be turned on and off through relays

The software interface I am going to create would need to know the status of all temperature sensors, the status of the liquid levels in the tanks and the on or off status of the pump, as well as the open/cloed status of each solenoid valve (or even bettter the percentage open closed). and be able to control each solenoid valve and heating elelment.

The basics of the process are as follows:

Heat X litres of water in tank 1 to X temperature. Once reaches set temperature transfer to tank 2 and add grains.

Add more water to tank1 and raise and hold temperature at set point.

If the tremperature in Tank2 drops more than 2 degrees and the temperature in tank1 is up to it's set point open recirculation valve from Tank2 turn on pump and open recirculation valve on tank1 (there is a copper heat exchange in tank 1). Once set point is reachived in tank2 reverse the process.

After x amount of time goes by at the setpoint in tank 2, transfer liquid to tank three for boiling.

I am thinking that at it's simplest the I need to design temperature sensing circuit with multiple inputs. Liquid level sensing circuits with mulitple inputs . I say mulitple as I would like this to be expandable. I then need to tie these into a method of passing the data to my parrallel port and into software to be able to control the percentage open of a solenoid or the on/off status of a heating element.

Any guidance would be appreciated. I litterally am new to making this stuff work but have all the time in the world to figure this out and take it one step at a time (btw I am a cheap bastard too :) )

Thanks!
 

SgtWookie

Joined Jul 17, 2007
22,230
OK, this is a candidate for a microcontroller.

for your temp sensors - you could use thermistors as the R in an R/C circuit.
Or, you could use IC's that were specifically made for temp sensing, like LM34 or LM35. LM134's can be used for that purpose, too.

You could control the heaters by using PWM (pulsewidth modulation) of the input poer if it's DC, or perhaps using SCRs or MOSFETs to control AC power.

I'm afraid I'm going to have to continue this later - been a long day.
 

SgtWookie

Joined Jul 17, 2007
22,230
Gee, Thingmaker3 beat me to it, and I didn't even notice last night I was so tired ;)

You're absolutely correct about breaking it down to small components. Your process needs to be re-worked so that EVERYTHING you wish to monitor/control is covered. You'll also want things like fail-safes - to ensure that your tanks don't overflow if a sensor fails, your heaters don't run if there's no liquid in a tank, transfer pumps don't try to move fluid from an empty tank, etc. Redundancy will go a long ways in preventing disasters.

Sensing temps right at the boiling point may prove tricky, particularly as the chemistry changes when you add ingredients. You might consider having a secondary check, like monitoring the convection currents. If your heater is reasonably close to the center of the vessel, then as the water begins to boil the convection currents will become more pronounced; at a rolling boil the fluid in the center will be rapidly rising and the fluid at the rim rapidly falling. You might rig up something like a miniature canoe paddle with the handle end connected at right angles to a spring-loaded potentiometer shaft. The faster the mix roils, the more force is exerted on the pot shaft, which will give you a different reading on the pot. Of course, the pot would have to be located where steam/heat wouldn't be able to get to it. (Just brainstorming right now)

General:
Since this is an application where the final product will be a consumable beverage, special attention must be observed to prevent contamination by such things as lead, plastic products that may decompose under heat/cold releasing carcinogens, etc.

You also would want to construct your project in such a manner that in case of some sort of failure, your electronics will be out of harm's way, scalding fluid will be safely carried to a nearby drain, and no readily combustable materials are in the immediate area.

Power considerations - in the event of power failure, your system needs to keep monitoring the witches' brew ;) HOW you wish to deal with this is up to you. You could go hog wild and implement a UPS that will keep your heaters going for hours - but that means large and expensive batteries; if not SLA (sealed lead-acid) then you'll have to ensure the fumes cannot accumulate.

Fluid Level Sensors: there are myriad ways you might sense the levels. I suggest that a minimum of four are required:
1) Pump Inlet Covered; sufficient fluid in vessel to operate transfer-out pump
2) Heater covered; the heater is [covered/not covered] by fluid. You would never want the heater ON unless it was covered by a safe margin.
3) Normal full; the vessel is filled to the normal fill point.
4) Overfill fail-safe; the vessel has been overfilled - there has been a failure in the "normal full" sensor, transfer pump circuit, or water inlet valve.

You might consider using a float connected to a shaft, made from food-grade stainless steel. From there, you could detect the position of the shaft using optical sensors, Hall-effect sensors (responds to magnetic field), reed switches, etc. Hall-effect sensors are very reliable, and are used in such applications as rotary position sensing, auto ignition systems, automatic anti-lock braking systems, etc. Hall-effect sensors are available in inexpensive TO-92 packages in a three-lead configuration - power, ground, and signal out. Depending on the device, the signal may indicate the relative strength of the magnetic field present, or a simple presense/absense of said field.

Break your recipie down into a list of yes/no questions.

For example:
"Heat X litres of water in tank 1 to X temperature. Once reaches set temperature transfer to tank 2 and add grains."

might be converted to routines like:



FillTank1: Is OverfilledSwitch on?
Yes - EmergencyShutdown
No - (continue)
Is NormalFilledSwitch On?
Yes - TurnOffFillValveTank1
No - TurnOnFillValveTank1

HeatTank1: Is HeaterCoveredSwitch on?
No - TurnOffHeater
Yes - (continue)
Is NormalFilledSwitch on?
No - TurnOnHeater
Yes - (continue)
Is Temperature_Sensor_1 up to SetTemperature?
No - KeepFillingAndHeating
Yes - TransferToVessel2

I didn't get to the trasfer routine yet, and you can see how many steps it took - and I haven't even "benched checked" this list. You need to cover every possible combination, and be able to provide a yes/no answer for how to handle each situation. You're eventually going to have to write a program for a microcontroller, and even "Barney-style" is too complex for one of those ;)

All together now, SING!
o/~ "I hate you, you hate me, throw that PICAXE in the sea..." o/~
;)
 

Thread Starter

jjlwork

Joined Sep 26, 2007
4
Thanks everyone so far :). You have confirmed that I am not too far over my head I understand most of what everyone is saying. From reading the above, I am guessing my next step is to write out a clear True/False flow chart for the entire process.

I may be misunderstanding, but you are saying to use a microcontroller for it. Will that prevent me from having full control from a laptop? My understanding of a microcontroller is that it would be programmed to handle each step in it's own memmory and I would not use the computer at all. I really want to set it up so that I can load recipes from a database of mine and have the brewery respond to the different changes in the recipes some recipes would have more steps than others for instances sometimes it would be necessary to raise the temperature in three to four different set points and hold for different amount of times and then other recipes I would just need one set point and hold time.

I will post my yes no flow here and solicit more suggestions :)
 

beenthere

Joined Apr 20, 2004
15,819
You may find that using a microcontroller with built-in analog to digital conversion and selectable intputs and outputs is easier in the long run than finding or constructing and interface for the laptop.

If you want to pursue the laptop idea, you might find that Dataq makes a device that could be useful as the interface. It's pricey, though. Check out the DI-720 they make. It may have enough inputs and outputs to control the process.
 

Thread Starter

jjlwork

Joined Sep 26, 2007
4
Come to think of it going computerless may not be such a bad thing, just kind of wanted to have a nice fancy graphic display with the keyboard and stuff. Is there a way to have a memory system on this so that I could load recipes and save them so that I an recall them later to "run" the recipe or edit it? What about recipes with additional steps is there also a way for the microcontroller to see that and adjust it's process accordingly.


Here is an VERY rough draft I started this morning to give an idea of what I am trying to accomplish and it is not finished, want to make sure I am on the right track before I continue (I am embarassed to say it but good old Microsoft Quickbasic is the only programming language I know and I haven't touched that in years so the rough draft may look like basic code a little but with lots of errors)


THis is no where near complete:


Variables


'MashTUn this is where the initial water is added from the HLT at a and grains are mashed in, then temperature is maintained and/or steped up by heat exchanger
MashtunTemp 'actual mash temperature
MashTunT1 'First set point temp
MashtunT2 ' Second set temp
MashTunT3 'Third Fourth Set point
MashTunOverflow


'Heat Exchanger A small tank filled with water that has a copper coil Heat exchange unit inside for wort to run through from the Mashtun
HELiquidLevel
HEHeaterCovered
HEOverFlow
HETemp
HEOutletTemp
Valve1
Valve2
HEHeaterOnOff

'Pump
PumpStatus



'Hot Liquor Tank

HLTLiquidLevel
HLTHeaterCovered
HLTOverFlow
HLTTemp
HLTHeaterOnOff

'Kettle - just boils for a set time then drains manually

KettleLiquidLevel
KetlleHeaterCovered
KettleOverFlow
KettleTemp
KettleHeaterOnOff


Process

InitializeSystem

' Heaters Off
HLTHeaterOFF
KettleHeaterOff
Valve1Close
Valve2Close
Vavle3Close
Valve4Close

'Perform System Wide Check

IF MashTunOverflow = 1 Then MTOverflowError
IF HELiquidLevel > 0 Then HELevelError
IF HEHeaterCovered = 1 Then HEHeaterError
IF HEHeaterOn = 1 Then HEHeaterError
IF HLTLiquidLevel > 0 Then HLTLevelError
IF HLTHeaterCovered = 1 Then HLTHEaterError
IF HLTOverFlow = 1 The HLTOVerFlowError
IF HLTHeaterOnOff =1 Then HLTHeaterError
IF HEOverflow = 1 Then HEOverFlowError
IF KettleLiquidLevel > 0 then KettleLiquidLevelError
IF KetlleHeaterCovered = 1 Then KettleHeaterCoverError
IF KettleOverFlow = 1 ThenKettleOverFlowError
IF KettleHeaterOnOff =1 Then KettleHeaterError

IF Valve 1 = Open then ResetValve1
IF Valve 2 = Open then ResetValve2
IF Valve 3 = Open then ResetValve3
IF Valve 4 = Open then ResetValve4
IF Valve 5 = Open then ResetValve5

'Fill and bring HLT to Setpoint
FillHLT:
OpenValve1
LOOP While
HLTLiquidLevel < MashInVolume
If HLTHeaterCoverd = 1 AND HLTHeater = Off then HLTHeaterOn
End Loop
CloseValve1
DO WHILE HLTTemp < HLTSetPoint
LOOP
HLTHeaterOff
StartMash

'Fill Mashtun From HLT

StartMash:

OpenValve 2
OpenValve 3
DO WHile MashTunOverflow=0 and HLTHLTHeaterCovered = 1
END LOOP

FillHE:
OpenValve1
LOOP While
HLTLiquidLevel < MashInVolume
If HLTHeaterCoverd = 1 AND HLTHeater = Off then HLTHeaterOn
End Loop
CloseValve1
DO WHILE HLTTemp < HLTSetPoint
LOOP
HLTHeaterOff
StartMash


PerformMash:

IF MashTemp < Setpoint and HLT
 

SgtWookie

Joined Jul 17, 2007
22,230
PICAXE microcontrollers are reportedly very affordable. The programming language is reminicent of Assembler, though.

If you want to stick with a Basic-type language, you could look at a Parallax product. Their "Basic Stamp" microcontrollers are pretty pricey, but are programmable in a version of Basic as well as being rather full-featured. You might look at a 2pe for data logging and the ability to have polled interrupts.
They're on this page:
http://www.parallax.com/html_pages/products/basicstamps/basic_stamps.asp
At $75, not cheap - but only you can decide what you can deal with, and what features you need.
I bought a Board of Education along with a BS2e and BS2sx a few years back to play around with. Still have 'em, they've been decent products.

They don't give away samples, however.

Once you get a good handle on what kinds of things you need to keep track of, and how to handle various events, and what data you wish to log, thereby understanding what kind of input, output, controls and communications you'll need, you might take a look at ST Microelectronic's offerrings:
http://www.st.com

They have a practically bewildering array of microcontrollers available - which is why you need to define what your requirements are before you go looking there or risk complete befuddlement. ;) They also provide a tremendous array of documentation, support, applications guides, development tools, etc - it's really mind-boggling at first. You really don't have to wait - but you'll be wading through hundred of pages and thousands of documents until you've narrowed down your search criteria.

And they do provide samples - I received a nice "care package" yesterday that contained, among other things, 8-bit, 16-bit and 32-bit MCU's. (I'm in the process of turning a restored Navy A-4B Skyhawk attack plane into an animitronic display for a local museum; simulating preparation for flight quarters; an ambitions yet feasable project.)
 

Thread Starter

jjlwork

Joined Sep 26, 2007
4
Sweet I found a website with a guy doing the exact same thing as I want to and the good news is he has a ton of stuff already implemented, I will most likely copy a lot of what he has done. No point in re-inventing the wheel. Here is thesite in case anyone is interested, may be interesting for some of you http://hermanmachine.spaces.live.com/
 

SgtWookie

Joined Jul 17, 2007
22,230
Sweet I found a website with a guy doing the exact same thing as I want to and the good news is he has a ton of stuff already implemented, I will most likely copy a lot of what he has done. No point in re-inventing the wheel. Here is thesite in case anyone is interested, may be interesting for some of you http://hermanmachine.spaces.live.com/
VERY cool! Thanks man. Links to stuff that'll net free beer is always a great thing. (if you don't share my views - well, then let's talk about something else)

Freebeer!

(pun on Freebird)
 
PICAXE microcontrollers are reportedly very affordable. The programming language is reminicent of Assembler, though.
Picaxe micros are coded in a variant of BASIC similar to the Stamp. They are cheap as well - I'm yet to find a cheaper range of user friendly controllers. I'm currently coding a 28X1 picaxe to run my automated brewery (around $20 Aust). jjlwork referred to my blog site a few replies ago.

I'd not encountered this site before, but it looks great.:)

cheers, Arnie
 

Gadget

Joined Jan 10, 2006
614
Yep, the PICAXE is a PIC chip with a bootstrap routine loaded into rom, which allows direct connection to a PC serial port, and is programmed in BASIC using REV-ED's free programming software. All Ultra cheap... infact in many instances I have found the PICAXE version of the same PIC chip to actually be cheaper than it's "UnAXEd" brothers.
Very usefull and user friendly.
 

Spoggles

Joined Dec 2, 2005
67
Hello:

I do not know if this may be of any interest to you, but I have used the DS1620 in a food dryer with some sucess. As you may or may not know the ds1620 is a thermostat chip, has 9bits of resolution (+/- .5C to 127C) , is eaisly programmable and nonvotile once set up.

The hardware and software tools outlined on the link below, makes it easy to impliment.

http://www.nomad.ee/micros/ds1620programmer.html

Spoggles
 
Top