Smart freezer with Thinger.io ClimaStick


#1

Hello thingernauts!!!
Few days ago I realized that my home freezer did not maintain the temperature correctly, perhaps due to an overload or because the engine is starting to fail. So I decided to introduce a ClimaStick to read the temperature and program an alert email if the temperature is over any value. Finally the result was very interesting, so I decided to share it with you.

If you don’t know about the ClimaStick, it is an ESP8266 based development kit with a lot of I2C embedded sensors where we can easily read environmental and motion values. The code is quite simple, it makes a temperature read and send it to a data bucket every 5 minutes, and if the temperature is over -14ºC, an email endpoint will be sended to warn me about a possible compressor lock:

#include <ClimaStick.h>
 
#define USERNAME "your_user_name"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_ssid_password"

ClimaStick thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
  
void setup() {
    thing.add_wifi(SSID, SSID_PASSWORD);
    thing.init_sensors();               //inicialice all climaStick sensors
 
}
 
void loop() {
   thing.handle();
   
   float temperature = thing.get_temperature();
   pson data;
   data["temperature"] =temperature;
   thing.write_bucket("Freezer",data);                //every execution sends data to the bucket

   if(temperature>-14) thing.call_endpoint("FreezerWarning",data); //if the temp is over -14º send alarm!

   delay(2000);
  
   thing.sleep(5*60); //processor and sensors go to sleep 5 minutes 

   
}

Once the sketch was uploaded, I plugged a battery and using a double side tape, I sticked the climaStick into the freezer door:

And after waiting a few hours to see how do the code works,I can see this results:

it works fine, now I know that the freezer makes some hot cycles periodically and after returns freezing, so there is no any problem but, I want to make some modifications to detect when is the door opened using the light sensor, and maybe make some test to evaluate the energy losses. So I will update the status of the project later.

Most greatest thing was the brief time that I needed to develop this application, it only takes me around 15 minutes, thanks to the built in sensors, I don’t need to make wiring… The library gives me the temperature data without any additional work and using thinger.io, connect it to the server was only 5 lines of code!

Hopes you found it interesting. Thanks for read!