GithubHelp home page GithubHelp logo

cloudiothack's Introduction

Cloud City IoT Hack


Overview

This repo contains content for the Cloud City IoT Hack, an event that provides developers with a hands-on introduction to some of the very best features Microsoft Azure has to offer, including IoT Hubs, Event Hubs, Azure Functions, Stream Analytics, and Cognitive Services. Four hands-on labs are located in folders named HOL 1, HOL 2, HOL 3, and HOL 4. Here's a synopsis of those labs:

  • HOL 1 - Attendees create an Azure IoT Hub and program an MXCHIP to send accelerometer data to it.
  • HOL 2 - Attendees create an Azure Event Hub and deploy an Azure Function that transforms accelerometer data input to the IoT Hub into "flight data" denoting the disposition on an airplane and transmits it to the Event Hub. Then they connect a UWP client app to the Event Hub and use their MXChip to fly a simulated airplane.
  • HOL 3 - The instructor creates a pair of Event Hubs and deploys a Stream Analytics job that analyzes all the air traffic in the room for aircraft that are within two miles of each another. He or she also deploys a UWP app that shows all the air traffic. THIS HOL IS INSTRUCTOR-LED.
  • HOL 4 - Attendees modify the Azure Function they deployed in HOL 2 to transmit flight data to the input hub used by Stream Analytics. They also connect the client app to the Stream Analytics output and modify the app to transmit warning messages back to the MXChip when their aircraft are within two miles of another.

The repo also has five source-code folders:

  • FlySim - A Visual Studio 2017 solution containing the client app that attendees use to fly simulated airplanes.
  • FlySimEmbedded - The code attendees upload to the MXChip to program it to send accelerometer data to an Azure IoT Hub.
  • FlySimFunctions - The source code of Azure Functions to process and send accelerometer data from the created Azure IoT Hub into Azure Event Hub.
  • AirTrafficSim - A Visual Studio 2017 solution containing the air-traffic control (ATC) app that shows all the airplanes in flight and highlights those that are within two miles of each other.
  • FlySimTest - A Visual Studio 2017 solution containing a command-line app for injecting simulated aircraft into AirTrafficSim. It's great for testing, and also for adding airplanes to the ATC sector if there aren't enough attendees at the event to make things interesting. To prepare it for use, replace SHARED_EVENT_HUB_ENDPOINT on line 54 with the endpoint connection string for the Event Hub that provides input to Stream Analytics. By default, it injects 20 airplanes. You can inject more (or less) by specifying the desired number as a command-line parameter.

For an overview of the end-to-end solution featured in the event, see the introduction to HOL 1.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

cloudiothack's People

Contributors

activenick avatar darenm avatar hellotechie avatar jeffprosise avatar jwendl avatar lirenhe avatar microsoftopensource avatar msftgits avatar shanselman avatar williamberryiii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudiothack's Issues

LRS to GRS Correction

Lab 2>Exercise 2>Step 2:

The image shows Replication to LRS, I think you meant GRS.

Labs don't work with node version 9.3

Can't install required node packages with Node 9.3.
Install.cmd just hangs - you have to first update NPM to 5.6, but still hangs.
VS Code tasks yield can't find bindings file for the serialport node module, thus you can't run the deploy tasks in VS Code.

exec: "/bin/arm-none-eabi-g++": file does not exist

Lab 1: Exercise 4: Step 12

The device_upload task fails due to following missing file. Here is the execution log:

Executing task: node 'C:\Users\aaa\azure-board-cli\out\cli.js' build .bin <

  • Checking pre-conditions of task: check Node.js version
    V check Node.js version: v8.9.3
  • Checking pre-conditions of task: Generate platform.local.txt
    V Generate platform.local.txt: platform.local.txt already exists
  • Checking pre-conditions of task: Config azure connection string
    Opening COM3.
    Please hold down button A and then push and release the reset button to enter configuration mode.
    SerialOutput can: Scan Wi-Fi AP.
    SerialOutput - set_w
    V Config azure connection string: done
  • Checking pre-conditions of task: Check Arduino IDE Version and Location
    V Check Arduino IDE Version and Location: 1.8.1 @ C:\Program Files (x86)\Arduino
  • Checking pre-conditions of task: Check Arduino Board
    V Check Arduino Board: MXCHIP_AZ3166 as MXCHIP AZ3166
  • Checking pre-conditions of task: Build & Upload Sketch
    C:\Program Files (x86)\Arduino\arduino_debug.exe --upload --board AZ3166:stm32f4:MXCHIP_AZ3166 --preferences-file C:\Users\aaa\Documents\Microsoft\Code\CloudIoTHack-master\FlySimEmbedded.build/pref.txt --pref compiler.warning_level=none --pref build.path=C:\Users\aaa\Documents\Microsoft\Code\CloudIoTHack-master\FlySimEmbedded.build C:\Users\aaa\Documents\Microsoft\Code\CloudIoTHack-master\FlySimEmbedded\FlySim.ino
    Loading configuration...
    Initializing packages...
    Preparing boards...
    Verifying...
    exec: "/bin/arm-none-eabi-g++": file does not exist
    arduino_debug.exe exited with error code 1.
    X build_upload: Upload failure with error code 1

UWP Projects target 15063

Both UWP projects target 15063 (Creators Update) which is an SDK unlikely to be installed on a participants machine. Suggest updating to 17134 (1803).

Correction from IoT Hub to Event Hub

Lab 2>Exercise 1>Step 5:
Correct below IoT Hub to Event Hub
Wait until "Deploying" changes to "Succeeded," indicating that the IoT Hub has been provisioned.

UnresolvableTypeReference Unresolvable type reference 'System.Threading.Tasks.Task' in 'Assembly(Name=System.Runtime,....

HOL 2>Exercise 5>Step 10
Unable to successful build the UWP App with below error.

C:\Users<username>.nuget\packages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : MCG0024: MCG0024:UnresolvableTypeReference Unresolvable type reference 'System.Threading.Tasks.Task' in 'Assembly(Name=System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)' found. Please check the references in your build system. A reference is either missing or an assembly is missing an expected type.

Inconsistent eventhub naming in instructions, does not match expectations in source code

In HOL4 - Exercise 1 : Connect the Azure Function to the shared input hub, the user is instructed to add the following to the function Run method:
[EventHub("sharedouteventhub", Connection = "SharedEventHubConnection")] IAsyncCollector<string> sharedOutputMessage,

However, the AirTraffic Sim Source does not expect an EventHub with name "sharedouteventhub" to exist, it rather expects one by name of "flysim-shared-input-hub" as directed in HOL3 - Exercise 1: Create Event Hubs for input and output - Step 7 and as also indicated in the Air Traffic Sim source code.

As a result, the proper modification to the function Run method should look like:
[EventHub("flysim-shared-input-hub", Connection = "SharedEventHubConnection")] IAsyncCollector<string> sharedOutputMessage

It is very important to note that with this change to the function annotation, the function will use an entity path of "flysim-shared-input-hub" provided that an entity path is not specified in the connection string supplied to AppSettings.

This occurs because HOL3 -
Exercise 1: Create Event Hubs for input and output
in step 11 implies that the proctor should copy the connectionstring for the Event Hub namespace without an appended entity path of "flysim-shared-input-hub".

i.e. this step will generate a connection string for the eventhub namespace and will not contain an entity path =>
image

If the proctor supplies attendees with a connectionstring that contains an entity path="flysim-shared-input-hub", the function code will work without modification and will also work when supplied to the Flysim app, but... it is important to note that the only reason this works is because the entity path in the connection string gets overwritten when the attendee follows HOL4 - Exercise 2: Connect the client app to the shared output hub to create the AirTrafficListener.

This specific line contains a side-effect which overwrites any pre-existing entity path in the connection string:
this.client = EventHubClient.CreateFromConnectionString(Common.CoreConstants.SharedAirTrafficEventHubEndpoint, Common.CoreConstants.SharedAirTrafficHubName);

This is a bit confusing, because the function code will only work without modification if a connectionstring with an entitypath="flysim-shared-input-hub" is supplied, which is not clear in the HOL3 instructions. While this fixes the function code without any modification, it only works in the Flysim app because the entitypath gets overwritten.

It is suggested to either change the function code to use the eventhub namespace connection without an entity path as the HOL3 instructions imply by using the modification to function annotation proposed earlier AND if it is decided to go this route it wouldn't be a bad idea to modify HOL2 -
Exercise 2: Deploy the Azure Function to transform data
to also use a connectionstring without an entity path specified (i.e. the connectionstring to the namespace itself) by modifying the function annotation of "outeventhub" to "flysim". This will make the evenhub connection strings consistent (no more need for explicit entity path in connection strings)and works without the aid of a side-effect.

OR

Update the HOL3 instructions to very clearly indicate that the proctor should copy a connectionstring which contains an entity path of "flysim-shared-input-hub" and be aware that the only reason HOL4 -
Exercise 2: Connect the client app to the shared output hub
works in the Flysim app is because "flysim-shared-input-hub" gets overwritten to "flysim-shared-output-hub" which just doesn't smell right.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.