diy temperature controller

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

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

LordUlrich

Well-Known Member
Joined
Dec 10, 2010
Messages
542
Reaction score
13
Location
Rochester
I am working on building a temperature controller for my fermentation. A benefit of building my own is I can add whatever features I want. So what features would you include on your dream temperature controller.
So far I plan to include 2 stage (heat/cool) at 20 amps each, anti-short cycle, actual temp logging, and adjustable allowable temp swing. So anything else that would be good to include?
 
PID controller to keep it all under check. What are you planning on using? Arduino?

I will conciser PID control but my understanding is PID control requires a variable output, generally achieved by PWM control (switching on/off rapidly), while refrigerators do not respond well to rapidly switching supply. I could implement it on the heat side though. (am i incorrect in my understanding of how PID control works?)

Right now I am undecided on the microcontroller, my hope is to build something as simple as possible (yeilding low cost) yet suited exactly to fermentation control. Thus far my cost appears to be very similar to the Ebay aquarium controllers but with 20 amp relays, and data logging potential
 
I will conciser PID control but my understanding is PID control requires a variable output, generally achieved by PWM control (switching on/off rapidly), while refrigerators do not respond well to rapidly switching supply. I could implement it on the heat side though. (am i incorrect in my understanding of how PID control works?)

Commercial examples I don't know but if you are making your own PID (that is what I'm doing) then you control the output. If you are after really simple in micro controllers then PICAXE (its a boot strapped PIC controller) They are really flexible and surprisingly powerful even for a CE (sorry EE always like making fun of CEs). I work (play) with ardunio but only as it is a cheap way to be able to program in C.

Clem
 
(am i incorrect in my understanding of how PID control works?)

partially. PID is an algorithm used to smooth out and/or reduce the peaks/vallys of a system variable (in our case, the variable would be temperature, but PID can be used for many other things). it doesnt necessarily use PWM, but many PID controllers can be set to (or not to) use PWM.

in our case, basically, there is an amount of time between when a refrigerator reads a high temperature, turns on the compressor, and when the inside of the fridge actually reaches the new low temperature. if you anticipate when the temperature is likely going to get high enough that the compressor should turn on, you can turn it on in advance, so that it reduces the lag time before the fridge actually gets cold. this evens out the spikes and vallys in a temperature graph and keeps the fridge at a more constant temperature. this is what the PID algorithm is supposed to do- accurately predict, based on past history and some settings, when to activate whatever its controlling.

i am just finishing up a project that did almost exactly this (minus the heating) that runs my glycol chiller. it uses an arduino, microSD card for logging, and a few relays. regardless of whatever hardware you decide to use, all the parameters will be set in the software you write for it, which should be pretty strait forward.
 
That makes sense, although I am a bit unsure how it would work. Would you mind sharing your code? Right now I am thinking of using a atmega 328, the same chip as the arduino but with my own board, getting rid of things like USB and an external crystal.
 
i would rethink dumping the external crystal if you want to use datalogging at all. your timestamps and long-running timers would be considerably off, as the internal clock is not very good long term (more than a few hours at a time and you see some considerable drift).

there is plenty of example PID code if you search google or even the arduino forums. mine isnt exactly done, nor commented at all, so posting it may be more confusing than anything. i may make a tutorial after its finished. I have not implimented PID yet because i need to log data for a while before i can actually set the PID values correctly. the code is extremely straitforward though- off the top of my head, it looks something like this crudely written example (which probably doesnt use correct syntax, i just wrote it to illustrate how you would logically use a temperature sensor value to control a relay)

Code:
int temphigh 40;              //when compressor should turn on, 40 degrees
int templow 36;               //when compressor should turn off, 36 degrees
int noshortcycle 900000;  //minimum cycle time in miliseconds, so 900k msec=15 minutes

void setup(){
pinMode 1 INPUT;            //temp sensors on digital pin 1
int tempread;                  //sensor temperature
int cycletimer;                //cycle timer variable that arduino can work with, add or subtract from, without loosing the above 900k value
cycletimer = noshortcycle;
analogWrite A1 0; //initially set the compressor to off
}

void loop(){
pin 1 = tempread;
IF(tempread >= temphigh, 
AND cycletimer<1, analogWrite A1 255, //A1 is the pin that would control the compressor, a relay or something, 255=HIGH 0=LOW)
AND set cycletimer =  noshortcycle; //and reset the cycle timer


ELSE IF(tempread <= templow, AND cycletimer<1, analogWrite A1 0; //turn off compressor
cycletimer =  noshortcycle; //reset the cycletimer

ELSE delay(cycletimer);  //ELSE run out the rest of the time on cycletimer
set cycletimer = 0;        //then reset it to zero and try again
)}

you can still use the arduino bootloader (open source) on a stock atmega 328 chip, and you can then use all the nice C-like programming commands and GUI that arduino uses, instead of having to learn the entire 200 page atmega328 datasheet and all the device-specific / hardware-level commands. you can also get the 328 chip in a DIP package, and plug it into a DIP arduino Uno board to program and prototype, then plug it into whatever board you have everything instrumented on.
 
I know I am resurrecting a fairly old thread, but I have made some progress on this project. After a lot of redesign and cost analysis on the microcontroller options I have I pretty good idea, but a few details I am still undecided on, and I am looking for other peoples opinions/input. Partially as i plan to publish (at-least online) my designs so others can use the work I have done.
At this point to have a SD card interface, I am short 1 pin and considering adding a shift register to add a lot of extra outputs. This would add the option to control multiple fermentations at the same time (potentially multiple fermenters with one chest freezer and a ferm wrap each). Is this something that would be useful or just a frivolous feature.
Also I am considering having a batch of PCB's printed would people be interested in a temperature controller kit(simple through hole soldering, and similar wiring)? Right now my price estimate is about $30-$40 total, (PCB, parts, outlet, cords and enclosure)
 
You might want to consider alarm output contact(s) in case the temperature goes out of the desired range for some reason.
 
Back
Top