Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

beer cooler project

Status
Not open for further replies.

MrDEB

Well-Known Member
Designing a simple 3 sensor thermostat for a one week a year beer cooler.
OBJECTIVE is to have 3 DS18B20 sensors that collect 3 temps from around the cooler. Add the three temps, divide by three then control the cooling compressor with a relay.
When the cooler obtains 35 degrees (DESIRED TEMPERATURE pot then compressor turns off for a minimum of 10 minutes to allow the evaporator to defrost if needed and allow the refrigerant to equalize (easier on the compressor).
Pretty basic setup but any helpful suggestions are welcomed.
Going to use Swordfish for code.
Basically two ADC inputs (DESIRED TEMP and DEFROST TIME). If 10 minutes is not enough to defrost the evaporator then adjust defrost time.
Poll the three sensors (could have each sensor on its own port pin)might be easier?
Then turn the relay on and off as needed.
Display shows Desired temp and Actual temp.
LEDs indicate when in defrost and cooling.
 
Hi,

Don't know what type of chiller unit you have got ?

I have had a couple and they all have inbuilt stats to do everything you need.

Just visit a few brewing shops and you should find some selling old but working chiller units used in bars.
They are big old things but really do a great job, most have 2 separate chiller tanks/ coils.


Probably cost no more than what you are planning to do with 3 ds1820 sensors.

Incase you go ahead with your original plan, have you seen the Ds1820 sensors Sure Electronics produce, sealed in a stainless tube with 3 mtrs of cable.
 
The sealed sensors I have somewhere around here but?
Have 5 on order from Ebay =$14
The beer cooler has two compressors (one is the original unit which was IMO too small anyway. We added (basically doubled the sq footage), purchased a florist cooler (a compressor with two evaporators) but one of the evaporators freezes up. I found the two thermostats were set at 40 but the cooler was chilling down to 34degreesF.
This is a work in progress. Doing some research I find a cooler needs to have a defrost cycle which at present it does not. Being the thermostats are set at 40 but the cooler is running at 34F it apparently has inoperative thermostats or very indifferent temps from one end to the other. The cooler box is 6 x 16 x 8 with glass doors under the evaporator and a door at the other end. Not the best insulation either.
Hopefully this Beer Cooler project will solve all?
 
I'm not sure I really see a question here. This is nearly one of the Swordfish Basic examples, is it not?

Sadly, your schematic is too blurry to make out. Can you make it any clearer? What software are you using?
 
. I found the two thermostats were set at 40 but the cooler was chilling down to 34degreesF.

Hi,

Would say that is normal for a mechanical stat, 6deg F is quiet good between the on and off points.
Think we have got so used to digital ones with 0.1 deg F/C accuracy we wonder how things worked before !
 
Using DIPTRACE BUT

increasing the size using DIPTRACE / PRINT PREVIEW Trying different options
still considering connecting each sensor to its own port pin?
 
Hi,

I used 3 ds18b20s on my last 4520 project, kept each of them on their own i/o line, plenty of spare pins so no need to get involved in checking the serial numbers all the time if the were all on one line.

The other problem of one wire for all sensors means everything goes if that line fails.
 
Last edited:
I agree with Wp100
My concern was iding each sensor but really no need seeing how I am just adding the outputs all together BUT it may make life easier using one i/o pin per sensor
Going to summer camp with my troop so going to hack out some code on paper (no laptop on this end.
 
Its DONE. Installing tomorrow and if all goes well it will operate as designed.
Will post pics and code after I find it working PERFECT
 
The dang thing hangs in the DEFROST cycle

Need solution ASAP as this is already in use.
My hope is that it can be reprogramed using a Pickit2 on the spot.
wonder if I need an END or RETURN after the sub routine delay??
Code:
{
*****************************************************************************
*  Name    : KoC BEER COOLER rev 6.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 8/8/2012                                                       *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
    Device = 18F4520
    Clock = 20
    // some LCD options...
    #option LCD_DATA = PORTD.4
    #option LCD_RS = PORTD.2
    #option LCD_EN = PORTD.3
    // uses LCD and AD libraries...
    Include "LCD.bas"
    Include "ADC.bas"
    Include "convert.bas"
    Include "DS18B20.bas"
    Include "Utils.bas"
    Dim LED_g As PORTC.4
    Dim LED_r As PORTC.5
    Dim Vref As Word
    Dim Vsensor As Word
    Dim Desired_T As Word          //DESIRED TEMP
    Dim D_Frost As Word          //DEFROST TIME
    Dim deg_s As Word
    Dim D_counter As Byte
    Dim ctr As PORTB.2
   
            //DESIRED TEMP
  


         
    // Read the AD ports and scale
    Function Dsired_T() As Word
     result = (ADC.Read(1) +1) /100  //Read DESIRED TEMP Adjustment
    End Function

    Function sensor() As Word
     result = (ADC.Read(0) + 1)/100  // 100  //Read DEFROST TIMER ADJUSTMENT
    End Function
    Dim drf As Word
    
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // I need this routine to read the DS18B20 buit keep getting syntax errors
    // the LCD, ADC sections all worked before putting the DS18B20 into the code
    //syntax says a sub routine or  or function is expected
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       
Public Sub sens_temp()     
       
        Dim TempA As ShortInt
        Dim TempB As Word
      
            If DS18B20.Find Then
                DS18B20.Convert
                DS18B20.GetTemp(TempA,TempB)
                LCD.Cls
                TempA = ((TempA * 9) / 5)+ 32               // converts from Celius to F
                LCD.WriteAt(1,1,"box temp =",DecToStr(TempA ),".",DecToStr(TempB,1), "F") // displays temp in C box temp
                DelayMS(3000)


       
             //tempA is box temp
             If TempA <= deg_s Then                         // compare box temp w/ desired temp
                  LED_g =0                                  // cooling off
                  LED_r=1
                  High(ctr)                                 //Defrost relay ON 
                  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                  // defrost counter If box is < DESIRED TEMP
                  
                 
                  Repeat
                  DelayMS(1000)
                  Inc (D_counter)
                  Until D_counter = drf *60              //drf is case select Vsensor
                  
                  Else 
                  LED_g = 1                              //cooler on
                  LED_r = 0
                  Low(ctr)                               //relay OFF
             EndIf
            EndIf 
                  
            

End Sub
  
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // Start Of Program...
    Input(PORTA.0)                  // DESIRED TEMP
    Input(PORTA.1)                  // DEFROST TIMER
    Low (LED_g)                     //set lEDs OFF
    Low (LED_r)
    ADCON1 = %10000000              //set up ADC regesters
    ADCON0.7 = 1
    ADCON0.6 = 1
   
    ADCON1 = $07               
    TRISA = %111111   
    TRISB = %11111111 
    TRISC = %00000000           
    TRISD = %00000000   
    TRISE = %000   

 SetPin(PORTB.3)                  // sensor pin    

           
    DelayMS (150)
    LCD.Cls
    //========================================================

     While true
            // call function REF_V() and assign the result to word variable 'Vref'
            Vref =Dsired_T ()           //DESIRED TEMP
            Vsensor = sensor()       //DEFROST TIMER
                 
    Select Vref
           Case <1 deg_s = 32             // CHANGE TO 32-40
           Case <2 deg_s = 33
           Case <3 deg_s = 34
           Case <4 deg_s = 35
           Case <5 deg_s = 36
           Case <6 deg_s = 37
           Case <7 deg_s = 38
           Case <8 deg_s = 39
           Case <9 deg_s = 40
    End Select
    Select Vsensor
           Case <1 drf = 10
           Case <2 drf = 12
           Case <3 drf = 14
           Case <4 drf = 16
           Case <5 drf = 17
           Case <6 drf = 19
           Case <7 drf = 21
           Case <8 drf = 23
           Case <9 drf = 25
           
    End Select
    // main program loop...
           
            sens_temp()                    //call sub routine for box temp
          
            LCD.MoveCursor (1,1)
            LCD.WriteAt(1,1,"Desired temp=", DecToStr(deg_s),"F")  // Display DESIRED TEMP
       
           
     // call function sensor() and assign the result to word variable 'drf'
           
            LCD.MoveCursor (2,1)
            LCD.Write("DEFROST = ", DecToStr(drf),"    ")   //Display DEFROST TIMER
            DelayMS(3000)
            LCD.Cls
            D_counter = 0                   // resets the defrost timer after it times out
         
     Wend
 
It's not going to work as you planed it your stopping the Pic from doing anything till it gets done waiting for the defrost timer to finish it cant check the temp or any thing
 
I realize that now. Thinking of putting the END SUB after the delay routine then put the GREEN LED routine after the LCD display at the bottom of the code. Not real sure.
Also need to find out how to use the PROGRAMMING ON THE GO using a PICKIT2
 
Mrdeb you can fix this easy

I don't no how you have the 18B But this is what you need to happen
You place one on the coil and read it like this

Readtemp put in a loop then while in the loop add you action code then the display code
so your is like this

Code:
while true 
GetTemp
action here
display here
wend // keep looping

It's that simple let the action code power on the outside unit based on the temp set the temp just high enough to keep coil from icing over. Like 33 to 36
On at 36 off at 33 Its that simple
 
I will give it a go
THANKS
I was thinking (wanting) to keep my delay for defrost so Kinda like what your proposing
Put the END SUB after the delay loop instead of after the GREEN LED lroutine but use your idea and integrate the delay into it.
It was suggested to have a 10 miniute "DEFROST CYCLE" by the HVAC guy.
 
There will not be anything to defrost and if you use a delay thats a ten minute your not going to get a temp update but every ten minutes

A freezer uses a defrost cycle and heater on the cooler coil so air can flow to keep the refrigerator cold no air flow no cold air

But what your doing doesn't need to freeze just get close to freezing we made some real good coolers with a old outdoor unit and a pressure cutout just set it for 60 and let it run coil can't freeze up and it pumps out cold air at about 33.5 f all day long till the thing said im 33.5 inside here you can stop now and about every 10 to 20 minutes it will run a little to keep it cold the inside fan runs all the time
 
this cooler gets down below 32° really quick then the evaporator freezers up which is hard on the compressor.
It was recommended by the HVAC tech that a 10 minute min defrost cycle be used. Did some research and found the same thing.
Will work on it.
Oh yea staying on topic and I get banned from DDIY??
 
You don't let it get that cold I told you how to stop it you get a tee that goes on the Low side test port this lets you hook a compressor cut out on it you set this to cut the compressor off using the chart I showed you R22 it's 60 this keeps you from going colder then 33 may have to play with the setting a little to get it right but once right you'll have a nice cold cooler
 
I think I found the solution

The sub routine delay was hanging up so I changed the amount of delayms and it appears to work fine. TESTING as I type.
Also found that I had a lot of electrical noise as the PIC was showing weird temps . Get the unit home and all is fine.
Going to add some more filter caps on the power supply as well as the relay coil.
And referring to the high pressure shut off. Apparently there is none as the compressor will run 24/7 . At 6am the temp was 24°F.
WHY throw out all the so called "garbage" as it was referred to when all it needed was adjusting.
Code:
Public Sub sens_temp()     
       
        Dim TempA As ShortInt
        Dim TempB As Word
      
            If DS18B20.Find Then
                DS18B20.Convert
                DS18B20.GetTemp(TempA,TempB)
                LCD.Cls
                TempA = ((TempA * 9) / 5)+ 32               // converts from Celius to F
                LCD.WriteAt(1,1,"box temp =",DecToStr(TempA ),".",DecToStr(TempB,1), "F") // displays temp in C box temp
                DelayMS(3000)


       
             //tempA is box temp
             If TempA <= deg_s Then                         // compare box temp w/ desired temp
                  LED_g =0                                  // cooling off
                  LED_r=1
                  High(ctr)                                 //Defrost relay ON 
                  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                  // defrost counter If box is < DESIRED TEMP
                  
                 
                  Repeat
                  DelayMS(5000)          [COLOR="#FF0000"]CHANGING THE DELAYMS seems to help.[/COLOR]
                  Inc (D_counter)
                  delayms(5000)
                  Until D_counter = drf *6             //drf is case select Vsensor
                  
                  Else 
                  LED_g = 1                              //cooler on
                  LED_r = 0
                  Low(ctr)                               //relay OFF
             EndIf
            EndIf 
                  
            

End Sub
 
Status
Not open for further replies.

Latest threads

Back
Top