How To: Do Monitoring Using Microsoft Power BI Alerts

Last year, I wrote about how to make a soil moisture sensor using some basic electronic components, a Raspberry Pi 2 and some Python scripting. In this post, I’ll take a look at how to do monitoring using Microsoft Power BI alerts; a brilliant tool for data visualisations and dashboards. I’m pleased to say that my sensors have been running more-or-less without issue for over a year and whilst the basic circuitry hasn’t changed, the monitoring has been improved through continual tweaking. I wanted to get away from custom code as far as possible and use the tools that are available in the cloud to make monitoring the sensors easier.

Two things happen on the Raspberry Pi 2:

  1. A reading of moisture, light and temperature levels is taken every 30 minutes and fed into table storage in Microsoft’s Azure cloud platform. The Pi also tweets these readings, largely so that I know it’s all working correctly.
  2. Every minute the Pi is also sending data about the light level to an Event Hub in Microsoft Azure.

The data from both events are fed into Power BI either directly by accessing the table storage, or by using Stream Analytics to output the data to Power BI. I then combine this together into a single dashboard:

Power BI dashboard

I haven’t done too much by way of manipulating the data. I’ve just created some basic visualisations to show me some of the key data points quickly; particularly the moisture level. Since I know this is the measure for which I have a threshold (i.e. the point at which I’ll water the plant) I’ve set a target of 2.00 which shows on the gauge as a black line.

Creating Power BI alerts

Step One:

Click the three dots in the top right-hand corner of your chosen visualisation to bring up the menu.

Average Moisture Level

Step Two:

Click on the bell icon to take you to the “manage alerts” screen for that visualisation.

Average Moisture Level Alert

Step Three:

Fill in the details for the Power BI alerts you want to create. In my example, I want the alert to trigger once the gauge gets below 2.

Alert Configuration Pane

What happens next?

It took a few days before I could get a proper test since I had to wait for the soil to dry out. When it did, I got this handy little push notification through to my phone! I have the Power BI mobile app installed which means that I’ll get a push notification each time the alert is triggered.

Power BI Mobile Alert

Thanks to Power BI alerts, I now know exactly when to water my plant without needing to constantly check my dashboard! 🌵💧👌

Summary

When I first created my soil moisture sensor with the Raspberry Pi I had most of the processing being done on the Pi itself, with Azure just acting as a destination for storing the output sensor data. I relied on my own Python scripts to run correctly on the Pi to tweet me whenever I needed to do something. This isn’t optimal as I’d like to ultimately reduce the power required for monitoring by moving the sensors from a Pi to something like an Arduino or BBC micro:bit device. I need the cloud services that are available to take over some of the reporting, and you’ve seen how in three simple steps you can configure a basic alert once a gauge gets below a certain threshold.

One thought on “How To: Do Monitoring Using Microsoft Power BI Alerts

Leave a Reply