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> >
- Raspberry Pi 2 running on Windows IoT Core (Visit www.windowsondevices.com for more details)
- Adafruit 10DOF IMU (L3GD20H + LSM303 + BMP180)
Development Setup
- Visual studio 2015 RC with Windows IoT Core SDK running on Windows 10 public preview. Visit the following website for setting up the dev environment as well as a sample application creation
- Since this module has the combination of sensors, you can find the Wiring API source code separately from the Adafruit’s github. Here is the links,
- https://github.com/adafruit/Adafruit_LSM303DLHC
- https://github.com/adafruit/Adafruit_L3GD20_U
- https://github.com/adafruit/Adafruit_BMP085_Unified
- https://github.com/adafruit/Adafruit_Sensor (only some code part from Adafruit_Sensor.h is required)
- These source code are ported to C#.
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.
HAVE FUN :-) !!!!
Comments