Isn’t this the cutest, tiny 0.96 inch dashboard showing monitoring data you can imagine? On this article we’ll be using Raspberry Pi, an OLED display and small python app to get data from Azure App Insights and show it on the tiny dashboard.

The Goal

I wanted to build an always-on display that would show real time page view and order count during last 24 hours from my Retrocket webshop. Currently when I need the figures, I login to Azure portal, navigate to right dashboard to view the figures with a browser. Not very handy.


I could just leave the App Insights browser dashboard open to update itself, but I don’t really want to sacrifice a full blown computer with display for the job. This seems like the excuse I’ve waited for to tinker with some new toys. So let’s try a slightly different approach.

On the hardware side, I have a Raspberry Pi 4B with 8 gigs of memory and a network connection to get data. Then I have my tiny OLED display from Aliexpress (price ~2 eur) connected to the raspi for the dashboard. The job is to write a small python app that fetches the numbers using App Insights Rest API, and then use existing Adafruit python display libraries to show the data on our display.

The architecture looks like the following:

Image: Tiny Dashboard Architecture

Raspberry, and hooking up the display

Using an I2C OLED Display Module with the Raspberry Pi

My first guess was that I’m not the first person to try using such displays with Raspberry. The excellent article by “Matt” showed me how to make the four wire I2C connection from raspi to display. I also needed to enable I2C display on raspi configuration to get raspi to accept to this protocol.

Python Adafruit SSD1306 library

The article also pointed me to Adafruit library for controlling such devices, and it has enough examples to get anybody running in no time. Yeah, it’s deprecated, but who cares – works like a charm.

I played for a while with the python sample apps, just to make sure my wiring actually worked, and get an intro on how you draw to the display screen. The examples were more than enough to get control over the display part of the coding. Huge thanks to Adafruit for heavy lifting the most difficult part!

Getting the numbers from App Insights

Retrocket uses Azure App Insights for storing telemetry about what’s happening inside the app. All that was left was how to get the numbers out from App Insights.

Enter App Insights REST API. Making rest calls with python is a no brainer, and the linked page contains everything you need to get hold of the APIs. Two calls with suitable kusto-queries to the API:  One to get pageViews and another to customEvents, and I have the numbers that I wanted to show on the screen. The rest of the coding was to pick a nice font, and position the stuff to the screen.

Lessons learned

I would have imagined that making this was more difficult. Thanks to other tinkerers around the globe, excellent ready made libraries for controlling devices, and simple REST API access to App Insights, this was a one day exercise.

“Far too easy.”
– Darth Vader, Empire Strikes Back