Data visualization in Power BI with BME280 + Raspberry Pi

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
× 1
13676 01
SparkFun Atmospheric Sensor Breakout – BME280
× 1
12002 04
Breadboard (generic)
× 1
09590 01
LED (generic)
× 1
11026 02
Jumper wires (generic)
× 1
Software apps and online services:
W9gt7hzo
Microsoft Azure

 

Data visualization in Power BI with BME280 Raspberry Pi

STORY

Thanks to the tutorials on Docs.microsoft.com – https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-node-get-started#create-an-iot-hub

Prepare your Azure accounts

You might need follow the steps to create an Azure IoT hub

https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-node-get-started#create-an-iot-hub

and a Power BI account. (Try Power BI for free)

Connect the sensor to Pi

Connect the sensor to Pi

Use the breadboard and jumper wires to connect an LED and a BME280 to Pi as follows. If you don’t have the sensor, skip this section.

For sensor pins, use the following wiring:

Start (Sensor & LED) | End (Board) | Cable ColorVDD

(Pin 5G)3.3V | PWR (Pin 1) | White cable

GND (Pin 7G) | GND (Pin 6) | Brown cable

SCK (Pin 8G) | I2C1 SDA (Pin 3) |Orange cable

SDI (Pin 10G) | I2C1 SCL (Pin 5) |Red cable

LED VDD (Pin 18F) | GPIO 24 (Pin 18) |White cable

LED GND (Pin 17F) |GND (Pin 20) |Black cable

Click to view Raspberry Pi 2 & 3 Pin mappings for your reference.

After you've successfully connected BME280 to your Raspberry Pi, it should be like below image.

Turn on Pi by using the micro USB cable and the power supply. Use the Ethernet cable to connect Pi to your wired network or follow the instructions from the Raspberry Pi Foundation to connect Pi to your wireless network.

Run a sample application on Pi

Clone sample application and install the prerequisite packages

  • Use one of the following SSH clients from your host computer to connect to Intel NUC.
  • The built-in SSH client on Ubuntu or macOS.
  • Clone the sample application by running the following command: Copybashgit clone https//github.com/Azure-samples/iot-hub-node-raspberry-pi-clientapp
  • Install all packages by the following command. It includes Azure IoT device SDK, BME280 Sensor library and Wiring Pi library. Copybashcd iot-hub-node-raspberry-pi-clientapp npm install Note It might take several minutes to finish this installation process denpening on your network connection.

Configure the sample application

  • Open the config file by running the following commands: Copybashnano config.json

There are two items in this file you can configurate. The first one is interval , which defines the time interval between two messages that send to cloud. The second one simulatedData ,which is a Boolean value for whether to use simulated sensor data or not. If you don't have the sensor, set the simulatedData value to true to make the sample application create and use simulated sensor data.

  • Save and exit by pressing Control-O > Enter > Control-X.

Run the sample application

  • Run the sample application by running the following command: Copybashsudo node index.js '<your Azure IoT hub device connection string>' Note Make sure you copy-paste the device connection string into the single quotes.

You should see the following output that shows the sensor data and the messages that are sent to your IoT hub.

Schematics of Data visualization in Power BI with BME280 + Raspberry Pi

Schematics of Data visualization in Power BI with BME280 + Raspberry Pi

Add a consumer group to your IoT hub

Consumer groups are used by applications to pull data from Azure IoT Hub. In this lesson, you create a consumer group to be used by a Stream Analytics job to read data from your IoT hub.

To add a consumer group to your IoT hub, follow these steps:

  • Click Endpoints on the left pane, select Events on the middle pane, enter a name under Consumer groups on the right pane, and then click Save.

Read More: Schematics of Data visualization in Power BI with BME280 + Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top