Introduction: Fridge Thermometer

This instructable was inspired by a problem with my fridge when the starter capacitor failed and the compressor stopped working. I didn't discover this until the fridge had warmed up and there was spoilt food. The fridge had a digitlal temperature on its control panel but it turned out this was the target setting and not the actual fridge temperature.

So to help avoid this happening again without warning I decided to make a fridge thermometer that would allow me to easily see the actual temperature and I would then get very early warning of any significant warm up in the fridge.

The design goals for this were:

  1. Battery powered with long battery life and preferably rechargeable.
  2. Clear display of temperature allowing it to be read at a glance.
  3. Small size.

I think I have achieved these goals with the device described.

Supplies

Materials

  • ATTiny85 - I used a Digistump type device with microSD but the one with USB A would equally work. I also modify these for low quiescent current in sleep mode. See https://www.instructables.com/Reducing-Sleep-Current-in-ATTiny-Digispark/
  • SSD1306 0.96" OLED display I2C
  • 300mAh Lithium battery
  • DS18B20 digital temperature sensor
  • Light Dependent Resistor - I used GL5528
  • Resistors 4k7, 1M
  • Enclosure - I used a 3D custom printed case. https://www.thingiverse.com/thing:5224890

Tools

  • Fine point soldering iron
  • Epoxy glue

Step 1: Electronic Design

The schematic shows the design is very simple. The AT Tiny reads the temperature from the DS18B20 sensor using the OneWire interface on PB0 with a 4k7 resistor providing a pull up on the data line. Two outputs PB1 and PB2 drive the I2C display. The Light dependent resistor is biased by a resistor from the supply line and its voltage is measured by the ADC input on PB5. This allows detecting the door opening. With the fridge closed it is dark and the high reading sends the ATTiny into a sleep state and it occasionally wakes up to check if the fridge light has come on. A 1M value is used to minimise the current from the battery. I deliberately avoid using PB3 and PB4 as these provide the USB programmability and one has to be careful to avoid compromising that if external circuitry is attached.

A "switch" is also used in the battery supply line as the battery connection needs to be removed if a USB update is needed. I actually used a simple connector for this function. The battery is also brought out to a 3 pin connector so I can use an external Lithium charger to recharge the battery.

Step 2: Construction

Construction is fairly straightforward. I based mine on a custom 3D printed case which had cut-outs for the display, temperature sensor, LDR, and battery connector.

My first step was to solder 4 wires onto the display and glue it in place. I the glued the temperature sensor, LDR and battery connector in place keeping their internal leads as short as possible.

I mounted the DS18B20 pull up directly on its pins and the LDR bias was soldered onto a spare pad (from removed regulator) and wired across to PB5.

The construction was then completed by wiring from the display, temperature sensor, LDR and battery connector onto the pins on the ATTiny85 board.

It is easier to have pre-programmed the ATTiny85 first but it can be done after construction as it is designed to be updatable although slightly more fiddly.

Step 3: Software

The software is available on github https://github.com/roberttidey/ATTinyDS18B20

The operation is fairly straightforward with the loop reading the temperature and then displaying it and then potentially entering a sleep loop waiting for the device to be illuminated when the door opens. The device remains active whilst illuminated but returns to sleep immediately the door closes and the light is turned off.

Whilst sleeping the OLED display is also put into a disabled state to minimise its current consumption.

Reading the temperature is done using the standard OneWire library. I check and put the sensor into a reduce resolution mode as this speeds up the measurement time.

Driving the display is done with my own SD1306BB library as this allows free choice of the I2C pins and also has font handling which supports a large display by replicating pixels. This is also available on my github https://github.com/roberttidey/ssd1306BB

Compiling the software is done in an Arduino IDE environment using a Digistump plug in. I use the ArminJo version with an additional URL of https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json

The software does provide for tweaking the calibration of the DS18B20 if you are comparing it against another thermometer when setting up. The #define TEMP_ADJUST allows for positive or negative offsets to applied.

The software as set up display in Celsius which is the native measurement from the sensor. It would be a simple change in the displayValue function. Just multiply the value by 90 then divide by 50 and finally add 32. The higher values help minimise rounding errors.