radio, electronics, computing, telecnology.

rss icon
twitter icon

Support This Site.

Please consider helping to support this site by making a contribution.

Fridge Thermostat

By Stephen Stebbing 2014-01-01 04:30:17 1 comment

This project came about when the thermostat on the old fridge at my Mum’s place failed. A search online revealed that a replacement was available, but at around $100 plus almost as much again for shipping from the UK, it just wasn’t worth it.

The original thermostat showing the 1976 manufacture date

But with Christmas looming and with much beer, turkey and ham needing to be kept cold, something had to be done.

And with the old fridge having run flawlessly and pretty much continously since 1976, it would be a shame to have to replace it.

Thermometer installed and in operation

Given the opportunity for valuable pre-Christmas brownie points, it was decided that a high-tech digital solution was called for and a thermostat was made using an ATmega8 processor and DS18B20 one-wire temperature sensor, and replacting the old analogue single-knob UI with a nice looking white-on-blue LCD and push-button.

The old fridge having been running almost non-stop for some 36 years

1. Schematic

Fridge thermostat circuit diagram

The circuit is fairly straightforward, with the ATmega8 doing all of the work. The LCD module is connected for 4-bit ‘nibble mode’. Pin PD2 is connected to SW1, which sets the target temperature, and is pulled high by the internal pull-up resistor. The switch is debounced in software. R2 pulls the reset pin high. C3 bypasses transients on the 5v power line and is placed as close to the chip’s Vcc pin as possible.

Connector K2 connects to the ds1820 temperature sensor and provides it with power on pins 1 and 3. Pin 2 is the onewire bus and is pulled high by R1.

1.1. Relay Control

Relay module controls the compressor motor

A 5 volt relay module similiar to the one shown is used to switch the fridge’s compressor motor. These modules use a transistor to energise the relay coil and hence can be driven directly from a microcontroller output pin.

The particular module used in the prototype has an active low input, ie the relay coil is energised when the IN pin is driven.

1.2. Configuration Jumpers

  • If jumper P1 is shorted, the LCD displays the temperature in degrees Fahrenheit, and in degrees Celsius if P1 is open.
  • If jumper P2 is shorted, the relay control output (K1 pin2) is active high, otherwise it is active low.
  • Jumper P4 provides power to the LCD backlight.

2. Operation

2.1. Display

The LCD display shows:

Top left Current temperature in 0.1 degree increments.
Bottom left Target temperature
Top right Running indicator – displays flashing ‘run’ when compressor is running, steady ‘idle’ otherwise.
Bottom right The percentage of the time that compressor has been running in last 24 hours.

2.2. Button

The momentary push button increments the target temperature within the range -20C to 10C in 0.5 degree steps. When 10C is reached, it loops back to -20C. Holding the button down causes auto increment with periodically increasing speed.

Having -20C as the minimum temperature should allow for use in freezers but this has not been tested. The DS18B20 temperature sensor is rated for -50C minimum, but the stated 0.5 degree accuracy is only for temperatures above -10C.

2.3. Firmware

The firmware polls the button every 10ms or so, and if found to be down for 10ms or more, increments the target temperature. After the button is released and 20 seconds has elapsed with the target temperature having not changed, the value is written to eeprom and will be used as the default target temperature on reset. The 20 second delay is to limit the number of writes required and hence maximise the eeprom lifetime.

Every 10 seconds the temperature is read and the display updated. The relay is then turned on or off according to the following rules:

  • If the temperature is 0.1C or more above the target temperature and the compressor has not been running for at least 5 minutes, the compressor is turned on. The 5 minute minimum off time is required to allow the internal refrigerant pressures to equalize so the compressor is able to restart without excessive strain.
  • If the compressor has been on for at least 2 minutes and the temperature is 0.1C or more below the target temperature, the compressor is turned off.

3. Prototype

A hole was cut for the LCD in the existing thermostat housing by using a hobby knife. The LCD was then held in place with hot melt glue.

The controller hardware was assembled on a piece of matrix board with a row of pin sockets for the LCD interface along the top. This allowed for the board to be easily mated and mounted behind the LCD as show in the picture on the right.

Controller, LCD and relay mounted in the existing thermostat housing

Controller board mounted on the back of the LCD

A plastic surround was made for the electronics from pieces from a thin nylon chopping board and glued in place. This was to ensure insulation from the mains wiring and connectors which are positioned below.

3.1. Sensor

Initially the sensor was left hanging in a corner at the vertical half way mark, but when the door was opened the displayed temperature would rise by 4C or 5C within seconds- obviously the thermal mass of the sensor was far too low and it was measuring the temperature of the incoming warm air. This has been remedied for now by placing it in a glass containing a couple of centimetres of water. A more permenant solution might be to encase the sensor metal tube made from nuts (of the ‘nuts and bolts’ type).

3.2. Power Supply

The 5v DC for the electronics is provided by a small switch-mode power supply mounted in the plastic housing adjacent to the fridge’s light bulb. This is probably not ideal as the heat generated is being dissipated inside the fridge, but given that total power is less than 1 Watt, it was deemed to be satisfactory.

4. Conclusion

The thermostat has been running for around three weeks now with no problems or complaints and has helped to provide and abundant supply of cold Christmas cheer. Now that the development work has been done, I expect to be able to use this device to cheaply and easily extend the life of many more old fridges when their thermostats fail.

Copyright 2012 - 2019 Telecnatron CSS | Login | Privacy | Sitemap Web software by Stephen Stebbing.