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!


#2

Hello ,

I am thinking of acquiring the climastick and would like to know how many days this battery you are using?
How many days can she keep the equipment on without recharging?

Thank you


#3

@jtrinc26 great project, thanks for sharing!

Is the actual temperature value included in the warning email? If answer is yes could you please share your endpoint configuration? (I’m struggling to make it work)

Thanks in advance,


#4

Hi, is there something similar to

thing.sleep(5*60);

when running on an Arduino Yun?

If not, how can it be done?

Thanks


#5

Hello @Guilherme_Ferreira_R,

This is a 350mah battery, in a climaStick it should not be more than one month, but we will lauch shortly new hardware with more atonomy and just for this purposes.


Utilizing Email End Point
#6

Hi @OldNerd,

es this data has been taken in real-time when the mail was sended. To make this you only have to create an output resource with identification for each variable and include that name in the mail body bettween double key… something like {{Temperature}}

thing["freezer"]>>[](pson & data){
  data["Temperature"] =  sensor.get_temperature(); //or similar
};

#7

yes, but it apear not to be a big help, look at this post: http://forum.arduino.cc/index.php?topic=190441.0


#8

Thanks @jtrinc26, what about my other question regarding an equivalent to “thing.sleep” on the Yun? I’m assuming putting “thing” to sleep is not the same as putting the Yun to sleep…

Best!


#9

Sorry, I have not found any similar instruction for Yun. Note that, if the bootloader doesn’t have this implementation we can’t make anything.

Rgds