At First Digital Innovations we don't just build custom and mobile solutions, we also have an IoT competency. In this article we will demonstrate a sample project of Data visualization in Power BI with a BME280 sensor and a Raspberry Pi, so you can learn how Power BI streaming data sets work and build your own weather dashboard.
The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV. It is a capable little device that enables people of all ages to explore computing, and to learn how to program in languages like Scratch and Python. It’s capable of doing everything you’d expect a desktop computer to do, from browsing the internet and playing high-definition video, to making spreadsheets, word-processing and playing games.
What’s more, the Raspberry Pi can interact with the outside world and has been used in a wide array of digital maker projects, from music machines and parent detectors to weather stations and tweeting birdhouses with infra-red cameras.
The BME280 is a humidity sensor especially developed for mobile applications and wearables where size and low power consumption are key design parameters.
Build your own weather dashboard
We start the process with a circuit using a Adafruit BME280 I2C or SPI Temperature, Humidity, Pressure Sensor, connected to a Raspberry PI (I used one of my old Raspberry Pi B-Models). The sensor values are read by a PHP script running on the Raspberry PI and then sent to a Power BI streaming dataset via API, which displays data on a Power BI dashboard.
Circuit Diagram (check it here Ciruito.io):
PHP Script (get it here GitHub):
You can setup the Raspberry Pi to automatically execute the script after boot-up when starting the OS (I use Raspbian). In the script you will need to just change the REST_API_URL variable to your streaming dataset API end-point address.
(REST API endpoint format: https://api.powerbi.com/beta/<tenant id>/datasets/<dataset id>/rows?key=<key id>)
Power BI Streaming Dataset:
After creating a Streaming dataset, Power BI will create an API endpoint where you can POST data to:
Then just build a Power BI Dashboard on the created streaming dataset, to display current temperature, dew point temperature, humidity, air pressure and altitude.
IoT these days is becoming increasingly inexpensive to explore and to build or to research proof of concepts and broadening our developer skillsets on problem solving while having fun at First Digital.
Innovations Technical Manager