Hands-on-lab IoT Weather Station using Windows 10

iot-weather-station-managed-solution

Hands-on-lab IoT Weather Station using Windows 10

As written on hackers.io

//build: Hands-on-lab WeatherStation

This project is part of Microsoft’s Hack the Home initiative, which provides makers with free, open-source components for effortless interfacing with devices and services that makers use most to hack their homes.

The new Windows.Devices namespace from the Universal Windows Platform (UWP) APIs in Windows 10, enable developers to leverage the power of Windows while interacting with the real world via sensors and actuators.

This project uses the I2C bus and general purpose input/output (GPIO) ports available on the Raspberry Pi 2, to create an internet connected weather station using the SparkFun weather shield.

The instructions provided will give a developer first-hand experience setting up the required hardware along with writing and debugging the newly available Windows 10, UWP Windows.Devices API's. This lab will also demonstrate how to aggregate your data in cloud using the Azure Event Hub, via the easy-to-use ConnectTheDots API.

Hardware

iot-weather-station-2-managed-solution

Pinout Diagram (Raspberry Pi 2 --> Sparkfun weather shield):

Software

Identify your computer name:

The weather station is actually two applications! What?!?! That's right. The first is a long running (indefinitely, actually) background task that reads the sensors and acts as a weather station server. The second, a UI that makes a request to port 50001 of the server and displays the data. The UI application is universal and can be deployed on any Windows device from the Raspberry Pi 2 all the way to a desktop PC - and anywhere in between!

You need to find the following line in the `Mainpage.xaml.cs` file from the `build2015-weather-station` project, and replace the computer name, "minwinpc", in the URL with the name of your IoT device.

//TODO: On the following line, replace "minwinpc" with the computer name of your IoT device (i.e. "http://:50001").

private Uri weatherUri = new Uri("http://minwinpc:50001");

iot-weather-station-3-managed-solution

Enable the "Task List" display

iot-weather-station-4-managed-solution

Double-click on any item in the list and jump straight into the source!

iot-weather-station-5-managed-solution

Each //TODO: is preceded by comments and HINTS to help you with the missing sections.

Install the weather station application:

Clone the linked repository (using the --recursive flag)

  • select the "lab" branch (default), if you want to learn the new UWP Windows.Devices API's and complete the code yourself
  • select the "master" branch if you want the completed code

Open "WeatherStationWeatherStation.sln" in Visual Studio 2015

Navigate to "WeatherShield.cs" in the "Solution Explorer" pane

If you chose the lab branch, Navigate to “View >> Other Windows >> Task List”, to view the remaining work (depicted above).

You will notice there is quite a bit of detail in the comment to help you complete the task. However, if you still need that extra nudge, there will be a “HINT” provided to remind you to look to nearby code for help (illustrated above).

Once the //TODO:'s have been completed, click the “Debug” menu item, and select “WeatherStation Properties…”

Under the “Debug” tab, in the “Start options” section

  • Select “Remote Device” as “Target device:”
  • Enter the IP address of your Windows IoT Core device in the “Remote machine:” field

Deploy to the Windows IoT Core device

Interface with and/or debug the application:

OR

Integrating with ConnectTheDots:

iot-weather-station-6-managed-solution

iot-weather-station-7-managed-solution

Select the "lab_ConnectTheDots" branch, if you want to learn how to use ConnectTheDots and complete the code yourself

Open "WeatherStationWeatherStation.sln" in Visual Studio 2015

Navigate to "WeatherStationTask.cs" in the "Solution Explorer" pane

Use the "Task List" to jump to each “//TODO:” and write the necessary code

The AppSettings, ConnectTheDotsSensor, and ConnectTheDotsHelper files are all part of the code created to help you use the ConnectTheDots interface to the Azure Event Hub.

AppSettings: Saves the settings for connecting to the Event Hub

This information can be found under your ServiceBus in Azure.

Go to your "*-ns" servicebus instance -> Event Hubs -> ehdevices -> Connection Information -> Look for the SAS "D1"

Copy the connection string which should look like this (It contains information for your AppSettings)

"Endpoint=sb://iotbuildlab-ns.servicebus.windows.net/;SharedAccessKeyName=D1;SharedAccessKey=iQFNbyWTYRBwypMtPmpfJVz+NBgR32YHrQC0ZSvId20="

  • service bus namespace (Ex: "iotbuildlab-ns")
  • event hub name (Ex: "ehdevices" - always use this)
  • key name (Ex: "D1")
  • key (Ex: " iQFNbyWTYRBwypMtPmpfJVz+NBgR32YHrQC0ZSvId20=")
  • display name (Ex: "WeatherStation1" - This gives a name to the device data)
  • organization (Ex: "IoT Build Lab" - Change to customize)
  • location (Ex: "USA" - Change to customize)

ConnectTheDotsSensor: Contains the information for a sensor

  • guid
  • display name
  • organization
  • location
  • measure name
  • unit of measure
  • time created
  • value

ConnectTheDotsHelper: Helper functions to initialize the Event Hub

  • establishes the connection
  • creates the authentication tokens
  • If you would like to setup your own Event Hub back-end, follow the instructions in the ConnectTheDots GitHub repository: https://github.com/msopentech/connectthedots/blob/master/Azure/AzurePrep/AzurePrep.md

    Once you have it deployed, it should start sending data to the event hub and the data should be viewable on http://iotbuildlab.azurewebsites.net/ or your own website.

#HoloLens & Japan Airlines are transforming the way mechanics are trained—watch how:

[vc_row css=".vc_custom_1470325448228{background-color: #1e73be !important;}"][vc_column][vc_column_text]

See how Japan Airlines will transform the way airline mechanics are trained with a mixed reality app built for Microsoft HoloLens. This is just the beginning of what JAL expects to achieve with HoloLens.

[/vc_column_text][/vc_column][/vc_row]

#Microsoft Announces New Visual Studio Dev Essentials Program - a free program that brings together everything developers need to create applications on any device or operating system including Visual Studio Community and Visual Studio Code

Visual-Studio-Dev-Essentials

Microsoft today announced the availability of Visual Studio Dev Essentials, a new, free program designed to provide any developer with everything they need to create applications on any device or operating system. The program provides easy access to popular Microsoft services, tools and resources as well as several new benefits to help developers get started building apps.
Liuson says, “Dev Essentials has a great set of benefits and tools – for free. This is Microsoft’s statement to the developer community about our learnings and about resources. And all of these things are accessible for all developers.”
Visual Studio Dev Essentials is a new, free program that brings together everything developers need to create applications on any device or operating system including Visual Studio Community and Visual Studio Code, and the free tier of Visual Studio Team Services. Dev Essentials adds priority forum support, training services from Pluralsight, Wintellect, and Xamarin, and—something that many have asked for—monthly credits to use in Azure, which will be coming in early 2016.

Source: http://microsoft-news.com/microsoft-announces-new-visual-studio-dev-essentials-program/