Windows 10 IoT Core on Raspberry Pi 2 – Adafruit Sensor data

Pushing data to Microsoft Azure Event hubs from Windows 10 IoT Core with Raspberry Pi-2 connected with the Adafruit 10DOF IMU

This is my first blog on Windows 10 IoT Core with Raspberry Pi-2 connected with the Adafruit 10DOF IMU (A combo board provides 3-axis gyro, 3-axis compass, barometric pressure and temperature sensors). This blogs explains you on how to interface the Adafruit Sensor with Raspberry Pi2 and also how to push the sensor data to Azure Eventhub using Windows Universal Application.

Pre-requisites> >

        
Development Setup

·         I have used some part of Connectthedots.io sample source for accessing Event hubs.

Event Hubs and Stream Analytics

I have used azure event hub and stream analytics services from my earlier Galileo demos. You can refer the following topics from Windows IoT on Galileo – Using Event Hubs and Stream Analytics blog.

  • Creating Azure Service Bus Event hub
  • Create an Azure Storage account
  • Creating Azure Stream Analytics job
  • Only changes are, While creating the output stream for the stream Analytics, use “Displayname” as a PARTITION KEY and “Currentdatetime” as a ROW KEY.

Building Windows Universal App

  • Create a Windows universal App Blank App (C#) using Visual Studio 2015 RC.
  • Add Windows IoT Extension SDK in the References to access the I2C related Classes.
  •  Port the C++ Wiring API Ada fruit 10DOF IMU source code (as mentioned in the pre requisite) to C#.
  • Add the ConnectTheDotsHelper.cs and AppSettings.cs (you can get these files from the link mentioned in the pre requisite) to this project for sending data to Azure Event hubs from Raspberry PI 2.  
  • You can find a set of variable you need to fill up for accessing the event hub in the AppSettings.cs as shown below.
  • Build the application and deploy through remote debugger or you can make it as a startup app. See the Hello world project for various methods to deploy the project.
  • Below pictures shows the events captured through Service Bus Explorer (A free tool).

Below picture show the data stored in storage services table through stream analytics job. You can use storage Explorer to view the table data from PC, it is a free tool from code plex. Event hubs data captured from another consumer group created for stream analytics in parallel.

Schematics

Source: Windows 10 IoT Core on Raspberry Pi 2 – Adafruit Sensor data


About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top