Skip to main content

Fridge monitoring with SensorTile.box and Microsoft Azure IoT Central

SensorTile.box from STMicroelectronics was used to collect the sensory data such as temperature and humidity inside the fridge, which was then sent to Microsoft Azure IoT Central platform.

Parts list

Qty Product Part number
1 STMicroelectronics STEVAL-MKSBOX1V1, Development Kit for STM32 for IoT and Wearable Sensor Applications 190-8453

Did you know that avocado should not be kept in the vegetable drawer of the fridge because it rots quicker in the high humidity environment? Well, I did not. There is so much to learn about something we use every day, and yet we do not pay enough attention. Like many of us, I am guilty of leaving the fridge door open when I am unpacking groceries. However, that can completely mess up the operation of the fridge and decrease its efficiency. It is always worth knowing two important parameters: the temperature and humidity of your fridge and freezer. If you set the temperature low, you end up using too much electricity. And if you do not close the lids, the humidity level increases and the fridge will take longer to cool.

So, when I got hold of SensorTile.box  (190-8453)  from STMicroelectronics, I thought it would be a good idea to measure those two parameters and see what’s going on inside my fridge. Oh, I also want to know if there is someone sneaking to the kitchen after midnight or if I left the fridge door open overnight!

sensortile_box_20e2600e1b6f3934d4f0ce53cd965e0ba8f6a349.jpgSensorTile.box

SensorTile.box is a development board with multiple motion and environmental sensors on it and can be used for wireless IoT and wearable sensor applications. The board comes in plastic box resistant to water splashes according to IP54 standard. The dimensions of the box are 57mm, 38mm and 20 mm. The top lid comes in two different versions: one without flanges and other one with flanges. The latter can be used to attach the kit to the wall or any other surface depending on the application. The kit comes with a LiPo battery that can be recharged through the slot for micro usb-b cable.

SensorTile.box comes with a wide range of low power sensors including 3 axis MEMS accelerometer that consumes only 50 nA and ultrahigh resolution digital output accelerometer, 6-axis inertial module, magnetometer, temperature, humidity, pressure, and audio sensors.

To manage sensor configurations and process the output data ultra-low-power 32-bit ARM Cortex-M4 microcontroller with DSP and FPU is used. There is an ST BT Low Energy module to provide wireless communication between the board and the smartphone.

Setting up the device

To get to the board inside the plastic box, the bolts on the top lid need to be unscrewed. The next step is to attach the connector from the battery to the pin on the board. To turn on the device, the USB cable must be connected. If the battery is charging the red LED on the board will be blinking. From my personal experience, it takes about 2 hours to fully charge the battery.

The board can be accessed using ST BLE Sensor app from the phone. The ST BLE Sensor app contains several example applications suitable for beginners. More advanced users can build their own application in the Expert view mode. For more information on how to use the app, please follow the official user manual or this video.

 

For this project, I measured temperature and humidity inside the fridge as well as the magnetic field to identify the position of the fridge door.

Step-by-step guide for loading the app and connecting to the cloud:

  1. In the main window, choose “CREATE A NEW APP”.Screenshot_20190912-125917_549a2a28da3301ac2703a0adacdc64e12c166f30.png
  2. “Example Apps” window will appear. Select “Expert view” and press “+NEW APP” in the next window.Screenshot_20190912-134102_4d63c21485c135466ecc030ac4df3f824977a502.png
  3. I created a new app called “Smart fridge” and the inputs are temperature, humidity, and magnetic field sensor readings.Screenshot_20190914-202502_cc97256b582221cf0db5837fb6bea0a191f1c753.png
  4. Go back to the main window and select “CONNECT TO A DEVICE” option.
  5. If the board is turned on, your device name should come up in the list of devices. Once the connection between the board and the phone/app is established, the blue LED will be blinking.
  6. If you press on the icon on top left corner, you will see options for observing the measurement data. Go to “Cloud Logging” option to upload data to the cloud service, which is Microsoft Azure IoT Central in our case.

Screenshot_20190912-134153_79059588ef3a233a5ae2f7e176aa9773e34bf4a1.png

Sending data to Azure IoT Central

The cloud service I am using for this project is Microsoft Azure IoT Central, which as a browser-based platform for monitoring and managing IoT devices. I was able to quickly create my own application without a single line of code. Azure IoT Central is free up to 5 devices and very intuitive to use. In fact, I am very impressed with their support service, including 24/7 online chat service. I followed these instructions to connect Sensortile.box to the Azure IoT Central.

If you set everything right, you should be able to upload the raw data to Azure IoT Central by pressing the cloud icon on bottom right corner of “Cloud Logging” page on the ST BLE Sensor app.

Screenshot_20190912-134224_5fdbd3ceaa3aaea832e982125920b4070bfdb508.png

In the browser, you can see the device TILE18209BC is present and the measurements of humidity, temperature and magnetic field in Z-direction are being updated every 2 seconds. These are the actual readings from inside the fridge.

azure_iot_overview_f9a95f419e20c2c89cb0c336f0e106733a77d690.pngSensorTile.box connected to Azure IoT Central 

My SensorTile.box has been put in the door of the fridge as shown in the photo below, but I have taped it into a piece of wood first. I found that it helps to keep the device still since I did not want to attach it on the door directly. As you can see, space is a big problem in our fridge and I am planning to use the SensorTile.box for monitoring the fridge only occasionally.

MVIMG_20190914_200419_fe22039867e7a56890b8cbb1223a3c02405fac9f.jpgMVIMG_20190914_200425_e6af3e320fb489b447f7c8fe4173c7eda08a88fb.jpg

“Midnight snacking”

I came up with two "cool" (ha, get it?) occasions for which I think monitoring the fridge could be useful. The first one, if you want to catch your family member crawling into the kitchen in the middle of the night and indulging in a bit of snacking.

Along with temperature and humidity, I measured the variation of the magnetic field when the fridge door opens and closes. The graph below demonstrates a scenario:  the door was initially closed, then someone opened it for about 3 minutes, and closed again. The magnetic field in Z-direction has changed from approximately 200mG to 400mG. You can also notice that humidity and temperature readings have changed correspondingly. This is explained by the fact that the cool air inside the fridge rushes out towards the door when you open the door.

magnetic_field_2d78b09034fc841f49440bfaebb7ec816702a836.pngMagnetic field in Z-directiontemperature_83c6380a6665e88da0a1b40fab34c1963918a985.pngTemperaturehumidity_01059d2b6be3213e83e02db09c6bf53997dbcea5.pngHumidity

To detect these changes and receive a notification about it, I have set "Telemetry rule" in Azure IoT Central in "Device Template" section of the menu on the left. The threshold was set as 300mG, which is the value I found by taking several measurements from the sensor in the same exact location.

rule_1_8cb51d53b38d84747478b6923686a5a7c64197e0.png

The rule triggers an "Action" to send me a notification email if the threshold has been exceeded.

email_midnight_snack_c7471f1922117e77e6c3212f115579b4a6d91241.png

“Oh, no! The door has been left open overnight!”

The second experiment was to test out if the SensorTile.box can detect if the fridge door has been left slightly open, which happens to our drinks fridge quite often. The fridge is quite small (or we have too many bottles of beer inside) and we often come down to the kitchen in the morning just to find out that the door was open all night like in the picture below.

MVIMG_20190914_200915_a5ad8a2f57d9bd66421501876bc27ee7b14c8429.jpgThe door of drinks fridge is not fully closed

Similar to the first experiment, I tested out the variation in magnetic field, which of course is much smaller this time. The graph below shows that magnetic field was 370mG in negative Z-direction when it the door was closed. I pretended to get a drink and opened door for a few seconds and left it slightly open on purpose. As you can see, magnetic field is now about 300mG in the same direction as before.

magnetic_field_5_mins_5b418f52b0a013e32c6b0e377c658559e09ab44e.png

Magnetic field in Z-direction reading from drinks fridge

I have set another rule to measure magnetic field for 5 minutes and if the average is greater than -300mG, I receive the notification saying that the fridge door has been left open.

email_midnight_5min_5b42eb49506106363beed14db3cb7011ac984249.pngFinal thoughts

I thoroughly enjoyed playing with SensorTile.box for this project, especially because I have not had to do any coding and instructions were very clear. Connecting to Microsoft Azure IoT Central was quite intuitive as well, so anyone can start building their own IoT device today!

More resources:

Unboxing SensorTile.box from STMicroelectronics

Choosing a cloud platform for your IoT devices

IoT sensing made accessible with SensorTile.box and Azure IoT Central

I am an electronics engineer turned data engineer who likes creating content around IoT, machine learning, computer vision and everything in between.
DesignSpark Electrical Logolinkedin