Many people leave for holidays with freezers full of perishables at home or you might have a business where freezers, fridges or coolers are used and need to stay below a certain temperature. This blog describes a possible way to monitor fridge temperatures and send notifications on abnormal conditions. 


There are various hardware setups that can be used. For this post I used what I had available in my DIY kit. For your implementation you can use a fairly simpler setup and I will suggest a few and the end of this article. The setup consists of the following:

The setup has been made quickly and after a few iterations the code was setup to read the temperature and display it on the LCD connected tot he Arduino. The Arduino complete code is below:

#include "liquidcrystal_i2c.h"
#include "onewire.h"
#include "dallastemperature.h"

LiquidCrystal_I2C lcd(0x27,16,2);

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
unsigned long currentTime;
unsigned long cloopTime;

union {
  float fVal;
  byte bVal[4];  

byte serBuffer[4];
byte serBuffer2[4];
float tempNormalize;

void setup()

   currentTime = millis();
   cloopTime = currentTime;

   //Start up library
void loop ()
    // call sensors.requestTemperatures() to issue a global temperature   
    // request to all devices on the bus  
    sensors.requestTemperatures(); // Send the command to get temperatures  
    float tempC = sensors.getTempCByIndex(0);
   currentTime = millis();
   if(currentTime >= (cloopTime + 5000))
      cloopTime = currentTime; // Updates cloopTime     
      lcd.print("Temp:  ");
      lcd.print(tempC); // Print litres/hour
      lcd.print(" deg");



The Particle Xenon board is connected to the Arduino through the bidirectional level shift module and the temperature is sent serially to the Xenon board. From the Xenon board the temperature is published to the particle cloud. The temperature is published every two minutes or if a change of more than 0.5 degrees occur in the positive or negative direction. The code can be seen below:

 * Project FreezerMonitor
 * Description:
 * Author:
 * Date:
char* buffer;
float temp;
float prevReportedValue=999.0;
unsigned long oldTime=0;
byte serBuffer[4];
// setup() runs once, when the device is first turned on.
void setup() {
  // Put initialization like pinMode and begin functions here.


// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.
  //Serial.println("Attempting Serial Read");
  bool serialSucces=false;
   if (Serial1.available()>0)
        char cStart=(char);
        //Serial.print("Start = ");
        if (cStart=='s')
          int iCnt=0;
          byte next =;
          while ((Serial1.available()>0)&&(iCnt<4)&&(char)next!=-1)
            //Serial.print("Available =");
            next =;

      float tempf;
      memcpy(&tempf, &serBuffer, sizeof(tempf));
      if (serialSucces)
        if (prevReportedValue==999.0)
          if (((tempf-prevReportedValue)>0.5) || ((tempf-prevReportedValue)<-0.5))
            Particle.publish("Freeser Temperature",(String)tempf,PUBLIC);
            if ((oldTime+120000)<millis())
              Particle.publish("Freeser Temperature",(String)tempf,PUBLIC);


The setup has not been very elegant as can be seen below:

To make sure the temperature reads correctly, the probe was compared against my multimeter temperature probe and from below it can be seen that the temperatures compares quite well.

From the particle cloud the information is sent to my Losant account. I have setup a time series graph and instantaneous value as seen below:

Various notification options have been looked at, the two that was decided on was Twilio and Pushover. Twilio is an SMS service that can be used to send SMS notifications and pushover has Android, IOS and Desktop apps which sends push notifications to your device. Both provides free trials, but do require payment afterwards. Twilio has a pay as you go option that costs U$0.04 (N$0.8) per SMS and Pushover costs U$ 4.99 (N$99.80) per device for lifetime use. 

Both platforms have a fairly simple API that can be implemented on either the device side or platform side. 

My Losant Workflow for integrating the temperature and sending notifications has been lain out as shown below:


 The workflow tests both Twilio for which there is a custom node, with a great help file for implementation. For Pushover, a normal http request block is used. The http request block should be filled in as below:

Losant HTTP Request Node setup for Pushover

Important is to make sure that an SMS or notification is only sent once. For this I used Storage Get and Set nodes. What needs to be done is to indicate that when alarm condition has occurred an SMS/notification can be sent and the next notification can only be sent after the condition has cleared. I have setup an alarm SMS/notification as well as a recovery SMS/notification for Twilio:

As well as for Pushover:

As we are working form a platform we would also like to setup a device disconnect and reconnect notification. That will indicate when my device has disconnected from the cloud and when it has again reconnected. For the disconnect I used an inactivity node and for the reconnect I used the Particle trigger node. Again I used Storage Get and Set nodes to make sure that the notifications only gets sent once. 

Twilio device disconnect SMS notification 

Pushover device disconnect notification

If you don't want to sent notifications only once but periodically you can also use the throttle node. 

Finally I would suggest using the ESP01 or Particle Photon for your controller board if you would like to implement this project. 

Till next time happy building. 


Leave a comment