Power BI: Streaming dataset
I recently bought a Raspberry PI 3 Model B for another project, but I have also been using it for other things. So I followed this guide to create a Real-time IoT Dashboard which gives me sensor data for humidity and temprature. The process was fairly easy following Sirui Sun’ guide on PowerBI.com.
What you’ll need
- Raspberry PI 3 with Rapsbian Jessie installed (You can read more about installing Rapsbian here)
- DHT22 temperature and humidity sensor (I bought this sensor from DX.com)
- PowerBI.com account
Power BI
Log into PowerBI.com and head over to the “Streaming datasets” button under the Datasets tab. Streaming datasets in Power BI represents streams of incoming data. From there, click “Add streaming dataset” and select the API option:

Give it a fitting name and add three fields:
- timestamp (DateTime): When the weather measurement were taken
- temperature (Number): the temperature at that point of time
- humidity (Number): the humidity at that point of time

Tips! Enable the “Historic data analysis” if you want Power BI to store the data sent via the APIs for use in reporting and analysis down the road.
Select “Create”. Copy the PUSH URL and save it in a Notepad text file – We’ll need it for later.

Now we have a streaming dataset! Your application can make HTTP POST request to this endpoint in order to send data to the streaming dataset.
Hooking up the Raspberry Pi
This is where the DHT22 sensor comes to play. There are three cables to connect:
- The “+” on the sensor goes into the GPIO1 (3v3 Power)
- The “S” or “OUT” goes into the GPIO4 (This is the one transmitting data)
- The “-” goes into Ground.



Ok good, we have our sensor installed. We also need some Python extensions installed and Adafruits_DHT Puthon libraries which accompany the DHT22 sensor, which will allow us to access the temperature data. Run the following commands:
sudo apt-get update
> sudo apt-get install build-essential python-dev
> git clone https://github.com/adafruit/Adafruit_Python_DHT.git && cd Adafruit_Python_DHT && sudo python setup.py install
Next, download this Pyhton script (uploadDHT22Data.py) and unzip the .rar file. Open the file and set the REST_API_URL to the URL you copied into Notepad earlier:
# REST API endpoint, given to you when you create an API streaming dataset
# Will be of the format: https://api.powerbi.com/beta/<tenant id>/datasets/< dataset id>/rows?key=<key id>
REST_API_URL = ' *** Your Push API URL goes here *** '
Save the python script.
Open up a terminal windows and test your sensor by typing this command:

You should now see the Temprature and Humidity in the Terminal. Good, your sensor is working correctly!
Now run this command:
> python uploadDHT22Data.py
The raspberry will start to stream data to Power BI:
Visualizing the data
With all that done head over to Power BI and create a new dashboard.
![]()
Within the new dashboard add a new tile.

Select Custom Streaming Data and hit Next.

Select the dataset you created in the first step, and click Next. We will start by creating a card that displays the most recently received value. Select “temperature” under field:

Click next and select your preferred settings.
Next we will create a line chart so that we can see the data change over time. Go back and add another tile, and select “Line chart”. From there set the Axis to timestamp and value to temperature.

Repeat the process for the humidity field. Your dashboard should look something like this:
Any questions, let me know by sending me an email or use the comment section below.

Like
Report
*This post is locked for comments