Several months ago, I became curious about how Azure Internet of Things (IoT) solutions are designed and put together. I wanted to explore the possibility of an actual use case that would showcase not only the cloud technology but also the curiosity that permeates our Azure team. Inspired by Mark Rober’s compelling (and fun) methodology to engineering research, I pursued this IoT project in a similar vein.
IoT has become a relatively universal term in digital circles. It is regularly spoken of in the same breath as other trending terms like machine learning (ML) and artificial intelligence (AI), as these technologies depend on the data derived from IoT solutions. Broadly speaking, IoT refers to anything connected to the internet. From the Nest thermostat in your home to bike computer head units to IP refrigerators, IoT devices are everywhere – feeding our data-driven world.
Microsoft’s definition of Internet of Things includes references to a collection of managed and platform services across edge and cloud that connect, monitor, and control billions of IoT assets. Microsoft Azure IoT also includes security and operating systems for devices and equipment, along with data and analytics that help businesses build, deploy, and manage IoT apps. When discussing the Internet of Things, Microsoft Azure solutions consider how these services work together across three components:
THINGS: The physical objects, or things, such as industrial equipment, devices, or sensors, that connect to the cloud persistently or intermittently.
INSIGHTS: Information collected by the things, which is analyzed and turned into actionable knowledge, either by people or AI.
ACTIONS: The way people respond to those insights and connect them to their business, as well as the systems and tools they use.
At the outset, I wasn’t entirely certain how the IoT use case I was seeking was going to come together. Initial research led me to the usual quick starts and demo labs, but that all seemed a little too pre-baked for what I had in mind. I learned there is even a smartphone app called IoT Plug and Play that can be used to generate data for cloud-based IoT demonstrations. Then I came across a Finnish IoT sensor company called Ruuvi who makes a small weather station sensor called a Ruuvi Tag which is about the size of a toonie (Canadian two-dollar coin) and measures temperature, humidity, barometric pressure, and motion (accelerometer). I was sold.
The first thing I did when the Bluetooth Low Energy (BLE) Ruuvi tags arrived was download their weather station app and pair the tags to my iPhone. Then, I put one tag outdoors and one in my office and the app allowed me quick, pretty visualizations of weather data. I used the third tag to experiment with the accelerometer – changes in x-y-z axis data points were displayed on the app in real time as the sensor was tossed in the air and rolled across the floor. The Ruuvi smartphone app also had an alerting mechanism built in that gave me an idea. I put the tag in my refrigerator and configured the app to alert me when it sensed any motion from the tag. My teenagers unwittingly validated this experiment, as my phone chimed every time they opened the fridge door. This localized BLE sensor research became the basis for what was to become the Azure Cloud IoT use case.
I was learning that IoT solutions, from the 10,000-foot view, seemed to be about addressing two challenges; getting the data to the cloud and then doing something with the data. Later, I also discovered that there is a third high-level consideration: determining where decisions can be made, that can happen at the edge, before data is sent, or in the cloud, once the data is received.
IoT sensors, like the Ruuvi Tags I used, aren’t always inherently connected to the internet. I’m not a very accomplished programmer but, after some hand-to-hand combat with Linux and Python, I managed to address this requirement using a Raspberry Pi 3 running DietPi OS Software, some modified python code from Jussi Roine’s website, and Python libraries for Azure IoT and RuuviTag. Essentially, with the help and support of this reference material, I was able to pair a Ruuvi Tag to an Internet-connected Raspberry Pi and start sending the sensor data to an Azure IoT Hub.
An Azure IoT hub is a cloud-based platform-as-a-service (PaaS) acting as a gateway that connects IoT devices to gather data and drive business insights and automation. In addition, Microsoft Azure IoT Hub services include features that enrich the relationship between devices and backend systems. = I provisioned an Azure IoT Hub in my lab Azure subscription and validated (celebrated!) that the data from the sensor, using the Raspberry Pi as a bridge to the internet (and path to Azure), was registering with the IoT hub.
To get a look at the sensor telemetry data that was reaching the Azure IoT hub, I provisioned Azure Streaming Analytics Services, which was configured to send the sensor data from the IoT Hub to a PowerBI dashboard. From PowerBI, I could visualize the data with time-based graphs and tables, start to build an understanding of what might be possible, and begin to address the second challenge, what to do with the data.
This is where the IoT use case I was searching for solidified into a plan. My mother has late-stage dementia (Alzheimer’s) and lives nearby in a very supportive assisted living community. Among the cruel things that dementia does to those on “the journey” is mess with their circadian rhythms. My brother and I had learned that our mom was frequently waking up at night and wandering until she was carefully settled back to bed in her suite. Sometimes this happened more than once a night.
And so, the use case was born. We thought it might be interesting to be able to track how often this was happening each night and see if this data was useful in predicting if the next day was going to be a good day.
We decided to mount our Ruuvi Tag sensor on the back of our mother’s suite door and hide our small Raspberry Pi computer that it was paired with in her nearby kitchen. Our use case was defined to use the sensor data to determine movement every time her suite door was opened and generate an alert based on the action.
The existing Azure Streaming Analytics Service Job was reconfigured with a query that compares current movement sensor telemetry data to the same metrics from a second ago. If there is a delta recognized, then movement is determined and a message is shipped to an Azure Service Bus Queue.
An Azure Logic app was provisioned and configured to watch the Service Bus Queue for messages and when one arrives, an action is triggered to send a text message (I used Twilio for this; Azure Communications Services is another option) to my phone. The result is that we can see how many times my mother’s suite door opens through the night and possibly determine her fatigue level for the day.
As the text message for this solution always arrives from the same phone number, I created a unique and pleasant alert on my phone that still persists to this day. It was unexpected but the technical solution has created a personal connection that I am reminded of throughout each day – my phone chimes and I think about my mother and what she might be up to at that moment.
This exercise in curiosity-based Azure IoT research with a personal use case really helped to solidify my understanding of what is happening under the covers of IoT solutions and share the findings with Compugen’s Azure team to broaden our cloud competencies.
In the summer of 2022, Compugen is very proud to sponsor a month-long customer and partner event called The Journey to Make a Difference, powered by Microsoft Azure IoT. I will be riding a bike from Compugen’s Calgary office to our Richmond Hill head office (3,400kms). This ride hopes to bring together our customers, business partners, colleagues, friends, and family in an event that showcases how Compugen approaches the transformational cloud journey with our customers and raises funds for a cause (Alzheimer’s Society of Canada) that has taken so many of our loved ones on a different kind of journey.
Learn more details on The Journey to make a difference and how you can be part of it. Further details will be released in the next few weeks. In the meantime, please don’t hesitate to contact us if you have any questions about Azure and IoT and how you can implement them in your organization.