Raspberry Pi Fridge Monitor

My fridge needs to be at constant temperature between 2° C to 8° C due to heat sensitive materials in it. I want to have an automatic process where it can log the temperature everyday and also notify me when the temperature goes beyond the range.

Fridge Temperature Google Sheets.JPG
Temperature Chart as displayed in Google Sheets. In this instance, temperature is taken once daily


  1. Raspberry Pi
  2. DS18B20 Sensor.
  3. LCD Panel 20 x 4
  4. PIR Motion Sensor HC-SR501


  • Reads and display the temperature (updated every minute)
  • The LCD also displays the IP address for easy access to the Pi.
  • PIR motion sensor which enables the backlight of the LCD to turn on when someone approaches.
  • Sends data to Adafruit IO and updates Google Sheet on the latest temperature readings.
  • SMS alerts, email and smartphone notification.
Phone Notification via IFTTT app

I am breaking this project into several parts:

Part 1: Installing the DS18B20 sensor

Part 2: The LCD & Motion Sensor

Part 3: Cron and other scripts to connect to Adafruit / Google Sheets etc

Part 1

Installing the DS18B20 Sensor

The DS18B20 sensor may come in many wire color combination. Check yours set here.

I have the Red (3.3v), Black (GND) and Yellow (Data).

Wiring is as follows :

  • Red – 3.3v
  • Black – GND
  • Yellow – GPIO 4

(Make sure you have the 4.7KΩ resistor between the Red / Yellow wires)



Add line to   config.txt  file located at  /boot/config.txt

sudo nano /boot/config.txt

type the following into the file


Then REBOOT your Pi


Next to check if the sensor is working, type the following

sudo modprobe w1-gpio

sudo modprobe w1-therm

cd /sys/bus/w1/devices/


cd 28-xxxx (change this to match what serial number pops up) or shortcut cd 28*

cat w1_slave

rpiDS18B20 install
Raspberry Pi Terminal Screenshot

If you get similar results, then your sensor is installed properly.

NEXT: Installing the LCD Panel