Fridge Thermostat

From Projects

Jump to: navigation, search

Contents

Introduction

Finished and installed thermostat...

The aim of this project was to produce a cheap and effective replacement for the broken (mechanical) thermostat in our refrigerator.

This project cost only $67 to make, far cheaper than the $300-400 it cost last time the thermostat was replaced in this fridge!

Design Requirements

The design of the thermostat aimed to satisfy the following requirements:

  • The circuit must be able to switch on and off the 240V fridge motor/compressor. Fridge motors, like most AC induction motors, often have starting currents around 3 times the rated current on the nameplate. That means the switching circuit must be able to handle up to 20 amps during startup. See here for information on fridge starting currents;
  • The temperature inside the fridge must be accurately determined via a placable probe;
  • The electronic thermostat must be powered from the 240V available inside the fridge to avoid drilling any holes to get the power or cables in and out;
  • The thermostat must be mounted in an airtight enclosure (IP65 or greater) to prevent the ingress of water from the condensing air;
  • The software must be reliable and not stress the fridge motor by turning it on and off quickly;
  • The software must maintain a motor duty cycle (ie. time on vs. time off) similar to the existing thermostat (when it worked) in order to preserve the life of the fridge. The fridge compressor was previously on around 30% of the time; and finally,
  • A light to see when the compressor is running and to display events such as an unusually high duty cycle or temperature.

Hardware Selection

This design was completed using a simple PICAXE-08M microcontroller as only a couple of digital inputs/outputs are required and the controlling software is simple enough to be achieved in PICAXE Basic.

PICAXE microcontrollers work best with the Dallas DS18B20 12-bit digital temperature sensor. These retail from MicroZed for around $7. The design will also allow for the cheaper ($3.10) and more easily obtainable (Altronics or Jaycar) LM335Z linear temperature sensor to be used. A small H0630 heatsink with thermal paste will be placed on the temperature sensor in order to slow the temperature changes detected by it. That is, so it doesn't quickly read 15Deg when the door is opened.

20A version of the chunky 30A relay selected for compressor switching.

For switching on and off the fridge compressor, the 30A (with 64A inrush capability) SY4040 heavy duty relay was selected from Jaycar. This has a 12V, 120Ohm coil - giving an current requirement of 100mA for switching.

A 150mA, 12.6VAC MM2006 transformer was selected to provide the relay switching power and the electronic circuitry power from the 240V available inside the fridge. Note that a 12.6VAC is the RMS voltage or the transformer so when rectified to DC, the output will be closer to sqrt(2)*12.6=17V DC. Thus, if around 17V is used to switch the relay, only I=V/R=17/120=94mA of the 150mA of available current from this transformer will be consumed by the relay, leaving 56mA for the remaining electronics. The bridge rectified selected was the 100V, 1A DIL.

The PICAXE microcontroller and remaining electronics require regulated +5V. With the 17V DC available from the rectified 12.6VAC transformer output, a large 1000uF 50V low-ESR capacitor and a smaller 100uF 50V capacitor will clean up the voltage ripples so that a single-chip 7805 +5V 1A voltage regulator can be used to provide the +5V supply.

As the relay requires 12V and 100mA for switching and the PICAXE can only output a maximum of 5V and 25mA, a 2N2222A or similar transistor will be used to switch on and off the relay from the 17V supply. A diode (1N4001, 1N4148 or similar) is also added across the relay to prevent the back-EMF (created by the collapsing flux when the voltage across the coil is removed - inductive behaviour!) from damaging the transistor and the PICAXE.

An LED in series with a 330Ω resistor will be connected to a digital output of the PICAXE and used to display the status of the fridge compressor. That is:

State Reason
Solid Running
Flashing Fast Duty cycle above 40%
Flashing Slow Temperature inside the fridge is above 10°
Off All good, fridge inside desired temp range


Finally, an IP65 rated H0324 125x85x55mm enclosure is required to put everything in. A 7mm H4304 cable gland will be used for the probe cable and two H4250 Cord Grip Grommets will used for the power and compressor power cables to prevent water ingress into the enclosure. An S-Video connector on the enclosure will enable in-system programming and diagnostics. S-Video connectors will be used because they're less susceptible to water ingress than 2.5mm stereo jacks etc.

Schematic Diagram

The schematic diagram of the main controller board is shown below. It was produced using CadSoft Eagle.

MainBoard.jpg

The designator X1 is the 4-way screw terminal block where the temperature sensor connects. Pin 1 provides +5V for the DS12B20. Pin 2 provides 5V and the bias current if an LM335Z is used rather than the DS18B20 sensor. Pin 3 is the analogue input to the PICAXE. Finally, Pin 4 is ground.

The crosses indicate wire pads where the leads are directly soldered to the board, such as the three leads from the transformer. For the transformer, Pin 2 simply secures the unused centre tap.

The three PROG leads go off to the bulkhead S-Video connector on the side of the enclosure. To make soldering to the bulkhead connector easier, a small circuit board was created with the following schematic to fit the bulkhead connector:

ProgInternal.jpg

Likewise, for connecting the computer to the thermostat, a third board was created with the following schematic to avoid having to solder directly to the tiny S-Video connector pins:

ProgExternal.jpg

Finally is the schematic for the DS18B20 temperature sensor:

FridgeDS18B20.jpg

Or if using the LM335Z instead:

FridgeLM335Z.jpg

Circuit Boards

The above four circuits correspond to the following four PCB layouts. These layouts were also constructed in CadSoft Eagle. THESE ARE NOT TO SCALE. For readability they're scaled up to around 180% of their actual size.

Main PCB:

MainBoardPCB.jpg

S-Video Programming Bulkhead PCB:

File:ProgInternalPCB.jpg

S-Video External PCB, note that the S-Video DIN connector is soldered on the back of the PCB:

ProgExternalPCB.jpg

DS18S20 PCB (fits inside heatsink):

DS18S20PCB.jpg

LM335Z PCB (fits inside heatsink):

LM335ZPCB.jpg

These layouts were transferred onto the blank PCB using the Toner Transfer method. This method is good for making moderately complex PCBs.

List of Parts and Costs

Below are the parts required for this design. Note that this does not include the items used in fabrication such as drill bits, PCB etching chemicals, press-and-peel transfers etc. I'm assuming you have these things already.

Main Board Parts Designator Jaycar Altronics MicroZed Qty Cost EA
PICAXE-08M U1 Z6111 1 $4.95
30A 250VAC Relay RELAY-1 SY4040 1 $7.95
12.6VAC 150mA Transformer 12VAC MM2006 1 $6.95
100V 1A DIL Bridge Rectifier B1 ZR1308 1 $0.85
1000uF 50V Low-ESR Capacitor C1 R6187 1 $2.00
100uF 50V Low-ESR Capacitor C2 R6127 1 $0.70
100uF 25V Low-ESR Capacitor C3 R6124 1 $0.50
0.1uF Monolithic Capacitor C4 R2950 1 $0.50
LM7805 +5V 1A Regulator IC IC1 Z0505 1 $1.20
2N2222A NPN Transistor T1 ZT2298 1 $0.25
1N4148 Diode D1 Z0101 1 $0.05
5mm Red LED LED2 Z0800 1 $0.21
5mm Green LED LED1 Z0801 1 $0.25
330Ω 0.25W resistors, Pk 10 R5,R6 R7646 1 $0.50
22kΩ 0.25W resistors, Pk 10 R4 R7590 1 $0.50
10kΩ 0.25W resistors, Pk 10 R3,R7 R7582 1 $0.50
1kΩ 0.25W resistors, Pk 10 R1,R2 R7557 1 $0.50
S-Video (4-pin DIN) bulkhead PROG PS0376 1 $2.15
Screw terminals, 2-way, Mini-PCB X1 P2028 2 $0.85
Sensor Board Parts Designator Jaycar Altronics MicroZed Qty Cost EA
DS18B20 Temp Sensor U1 DS18B20 1 $6.50
4.7kΩ 0.25W resistors, Pk 10 R1 R7574 1 $0.50
TO-220 Heatsink H0630 1 $0.90
Computer Interface Parts Designator Jaycar Altronics MicroZed Qty Cost EA
S-Video (4-pin DIN) line socket X1 PS0372 1 $1.45
DB-9 Female Connector, Straight X2 P3050 1 $2.05
Hardware/Mounting Parts Designator Jaycar Altronics MicroZed Qty Cost EA
125x85x55mm IP65 ABS Enclosure H0324 1 $12.55
3-7mm Cable Gland H4304 1 $2.15
6.2mm - 7.4mm Grommets, Pk 10 H4250 1 $3.20
240V 6.7mm Mains Power Cord WB1562 1m $2.00
Blank PCB, 150x75mm HP9514 1 $3.50
Total: $67.01

That's around the cost of the call-out fee of the average refrigerator repair company! A prior thermostat replacement on this fridge cost $300-400 including call-out, parts and labour.

This table is based on retail prices, with prices and part numbers correct at the time of publishing this article.

Photos

Inside close-up
Temp. sensor and S-Video prog. port.
Programming adapter.
With the lid on.
Prog. adapter and temp sensor.
FinishedThermostat.jpg

Software

The current LM335Z software running on the PICAXE-08M is available on the Fridge Thermostat Software page. The DS18S20 sensor should arrive shortly so the software will be updated shortly.

Results

22 Nov 2005 - The completed fridge thermostat has been running now for weeks and there has been no problems at all. Items in the fridge are colder than they were before and the compressor is only running at around 30% duty and the days have been hot.

Improvements

A good idea would be to move the relay control transistor over to pin 4 with the LED. That would leave the special tune/play pin2 of the PICAXE-08M available for the connection of a speaker. The speaker could then be used to create audioable alerts for events such as the fridge being too warm (door being open too long etc.) or the duty cycle being too high (compressor not working properly etc.). I'm currently working on a expansion PCB for above circuit that fits into the PICAXE socket and adds this functionality. I'll publish the schematic and layout when it's finished.

This design is currently unsuitable for the newer "frost-free" fridges that periodically defrost using a heating element. I think - correct me if I'm wrong - that most frost-free fridges have a separate thermostat that controls the defrost process so in that case this design would be fine. If this is not the case, for this PICAXE thermostat to handle both functions, a second relay and suitable software modifications would be required to control the heating element.