DesignSpark Electrical Logolinkedin
Menu Search
Ask a Question

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

Product
  • 1 × STMicroelectronics STEVAL-MKSBOX1V1, Development Kit for STM32 for IoT and Wearable Sensor Applications
    Add to basket Added

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

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”.
  2. “Example Apps” window will appear. Select “Expert view” and press “+NEW APP” in the next window.
  3. I created a new app called “Smart fridge” and the inputs are temperature, humidity, and magnetic field sensor readings.
  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.

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.

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.

SensorTile.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.

“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 in Z-directionTemperatureHumidity

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.

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

“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.

The 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 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.

Final 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

Hi, there! I am a Super Seed Intern with DesignSpark.

Comments

October 11, 2019 07:33

My kids are constantly leaving the fridge and freezer doors open! I think I need a couple of these Sensor Tiles!

0 Votes

September 27, 2019 11:21

Ran into an issue where I can't get the app to open the Expert view. Every time I try to do this it crashes the APP. Tried all the normal things to fix it but nothing lets me past that point in the APP. Up to than all works well. Interesting project. Just wish I could try other things with it. Is there a way to program it from the PC rather than the Cell?

Bill Hurlock

0 Votes

September 30, 2019 10:16

@Bhurlock Have you tried updating the firmware? In Pro mode, you can program the Sensortile.box using STM32 ODE.