Send Adafruit 10DOF IMU Data from Raspberry Pi 2 to Azure Event Hubs with Windows 10 IoT Core
This tutorial walks you through connecting an Adafruit 10DOF IMU (L3GD20H, LSM303, BMP180) to a Raspberry Pi 2 running Windows 10 IoT Core, and streaming the sensor data to Azure Event Hubs and Stream Analytics using a Windows Universal app.
Pre‑requisites
- Hardware: Raspberry Pi 2 with Windows 10 IoT Core. For setup details see Windows on Devices.
- Sensor: Adafruit 10DOF IMU (L3GD20H + LSM303 + BMP180).
Development Environment
- Visual Studio 2015 RC with the Windows IoT Core SDK on Windows 10 Public Preview. Follow the official guides for installing the SDK and creating a Blinky sample:
- The Adafruit wiring APIs are hosted on GitHub. Use the following repositories, ported to C# for this project:
- Adafruit_LSM303DLHC
- Adafruit_L3GD20_U
- Adafruit_BMP085_Unified
- Adafruit_Sensor (only the header file is required)
- To publish to Event Hubs, integrate the ConnectTheDots sample code.
Azure Event Hubs & Stream Analytics Setup
- Create an Azure Service Bus Event Hub.
- Provision an Azure Storage account for event replay.
- Configure an Azure Stream Analytics job that reads from the Event Hub and writes to the Storage table.
- When setting the output, use
DisplayNameas the PARTITION KEY andCurrentDateTimeas the ROW KEY.
- When setting the output, use
For a deeper dive, see the earlier Galileo Event Hubs blog.
Building the Universal App
- Create a Blank Universal App (C#) in Visual Studio 2015 RC.
- Add the Windows IoT Extension SDK reference to access I2C classes.
- Port the C++ wiring code for the 10DOF IMU to C# (see the GitHub links above).
- Include
ConnectTheDotsHelper.csandAppSettings.csfrom the ConnectTheDots repository to handle Event Hub communication. - In
AppSettings.cs, replace the placeholder values with your Event Hub connection string, hub name, and other required parameters. - Build the project and deploy it to the Pi via the remote debugger, or set it as the startup app (refer to the Hello World deployment guide).
- Use Service Bus Explorer to monitor incoming events.
- After Stream Analytics processes the data, view the resulting table in Azure Storage Explorer.
Visual Results
The following screenshots illustrate events captured in Service Bus Explorer and the processed table in Azure Storage.
Schematics
Source: Windows 10 IoT Core on Raspberry Pi 2 – Adafruit Sensor data
Manufacturing process
- How Industrial IoT Sensors Drive Modern Factory Efficiency
- Integrating Sensor Data into a Raspberry Pi: A Hands‑On Guide
- Read Heart Rate Pulses with Windows 10 IoT Core on Raspberry Pi – A Step‑by‑Step Guide
- Build a Raspberry Pi Home Temperature Monitor with MCP9808, InfluxDB & Grafana
- Connect Raspberry Pi 3 to DHT11 Sensor and Upload Data to ThingsIo.ai Cloud
- Accurate Temperature & Humidity Monitoring with SHT15 on Windows 10 IoT Core
- Installing Windows 10 IoT Core on Raspberry Pi 3 Model B+: A Step‑by‑Step Guide
- Build a Speech‑Controlled Robot with Windows 10 IoT Core on Raspberry Pi 2
- UnifiedWater v1 – Complete Arduino Water Quality Sensor Kit
- Raspberry Pi 2 Home Automation with Windows 10 IoT Core: A Complete Component Guide