Source code and documentation for the Microsoft IOT Hackathon GR 2016
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
App1
Docs/Images
SampleNode2
SkyWriterNode
Yodiwo.Paas.Azure
Yodiwo.Paas.AzureProxyNode
.gitignore
README.md
Yodiwo.MicrosoftHackathon.sln

README.md

microsoft-iothackgr-2016

Source code and documentation for the Microsoft IOT Hackathon GR 2016

Cloud2Cloud Intercommunication- Microsoft Azure IOT Hub with Yodiwo Cloud Platform


Table of Contents

Step 1: Set up a Raspberry Pi 2 device, equipped with Grove Sensors, to the Microsoft Azure IOT hub

  1. Create an Azure IOT hub following these instructions: https://azure.microsoft.com/en-us/documentation/articles/iot-hub-csharp-csharp-getstarted/ Make a note of the AzureIOTHub HostName and iot hub connection string.

  2. Create a Device Identity using the Microsoft Device Explorer Application: https://github.com/Azure/azure-iot-sdks/releases (Scroll down for SetupDeviceExplorer.msi) For more information, have a look at: https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md (Section Create Devices). Click “SAS Token...” to generate a device specific connection string with SAS token and Get device connection string. Make a note of the device id and device connection string.

  3. Use a Raspberry PI 2, running Windows IOT Core. Connect the Grove extension board on the Raspberry device and attach the Grove sensors to the following slots: - Rotary Angle Sensor: A2

    • Button: D3
    • Light: D4
    • Led: D5
    • LCD: any I2C slot
  4. From Visual Studio, open the Yodiwo.MicrosoftHackathon.sln and go to the Project App1. Open MainPage.xaml.cs. Change RaspName (Line36) and Connection String (Line 44) with the device id and the device connection string respectively, acquired previously in substep 2.

  5. Build the Universal Project and Deploy it on the Raspberry PI.

Step 2: Interconnect Microsoft Azure IOT hub with Yodiwo Cloud Platform

  1. Login to the Yodiwo Cloud Platform https://tcyan.yodiwo.com using any of the available OAuth2 methods

  2. After Login you will only see the wssample node in your Dashboard

  1. Go to Visual studio and in Yodiwo.MicrosoftHackathon.sln, find the project Yodiwo.PaaS.AzureProxyNode. Open the config.xml. Replace the AzureDeviceName with the device id from the Device Explorer (Step 1.2) and the AzureIOTApplicationConnectionString with the the iot hub connection string (Step 1.1).

  2. Use the Yodiwo.Tools.NodeCreator.exe application to generate a node key and a node secret for the Yodiwo cloud and put them in the YodiwoNodeKey and YodiwoNodeSecret entities in config.xml. The things Description section describes the Grove Sensors that are attached in Raspberry PI 2.

  1. Build this project and run it locally to your own Windows PC.

If everything is correct then refresh the https://tcyan.yodiwo.com page and you should see a second node RaspberyIOT node and the status is online. Actually the Yodiwo.PaaS.AzureProxyNode serves as an intermediate node between the Microsoft Azure IOT Hub and the Yodiwo Cloud Platform. Its role is to listen to all the incoming messages at the Azure IOT Hub from the Raspberry PI node and forward them to the Yodiwo Cloud. It is also used for transmitting messages from the Yodiwo Cloud to the Azure IOT hub. Thus, the Raspberry Pi Node, which also listens to the Azure IOT Hub, receives the messages generated by the Yodiwo Cloud.

Step 3: Set up a Raspberry PI 2 device equipped with SkyWriter Hat,to the Yodiwo Cloud

  1. Setup another Raspberry device running Raspbian. Install mono framework using the following instructions: http://www.mono-project.com/docs/getting-started/install/linux/. Please use the mono version 4.0.5.1. Replace the following line:
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

with this:

echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.0.5.1 main"| sudo tee    /etc/apt/sources.list.d/mono-xamarin.list
  1. Install python-smbus and python-skywriter library:
sudo apt-get install python-smbus 
sudo apt-get install python-pip 
sudo pip install skywriter 
  1. Place the SkyWriter Hat on Raspberry PI 2

  2. Build the Yodiwo.Projects.SkyWriter Node and copy the Release Directory to the Raspberry home folder. Run the executable using “mono Yodiwo.Projects.SkyWriter.exe”. In the log files you will see that a local server is running on port 4050. This is configurable via the conf.json file. Make a note of Raspberry Pi’s IP and in your pc's browser enter the url: http://{RapsberryIP}:4050/pairing. Follow the steps and when you are prompt to complete the UUID, enter the phrase 1337SkyWriter, which is also defined in the conf_file.json.

After successful pairing, you will be able to see the SkyWriter node in https://tcyan.yodiwo.com

Step 4: Set up a Windows Phone to the Yodiwo Cloud Platform

  1. Use a Windows Phone, running Windows 10 and deploy the project SampleNode2.csproj.

  2. Once the application has started, follow the pairing procedure as Described in Step 3. UUID is not required

  3. After these steps, you will be able to see Universal Node in your Dashboard.

Step 5: Check the devices in your Dashboard

After executing the aforementioned steps (1-4), you will be able to see 3 nodes in your Dashboard:

Then you will be able to create scenarios using the things that you just created and the logic blocks that are available in the Designer (https://tcyan.yodiwo.com/Designer)

Demos: Create use case scenarios to the Yodiwo Cloud Platform

Here we are going to present some demo scenarios, so as to show the intercommunication between Azure IOT Hub and the Yodiwo Cloud. In addition, it is worth mentioning that the devices that are used in this demo run different OSs, indicating the flexibility of communicating between heterogeneous devices. Finally, it is of important to note that devices compliant with the API of other cloud providers, such as Nest Home, Internet of Things Foundation (IBM), Amazon-Web-Service IOT can also be integrated into the Yodiwo Cloud Platform, so as to allow bridging and intercommunication between devices subscribed to different cloud platforms. This is exactly what we call Cloud2Cloud Integration

The demo cases presented in the Microsoft Hackathon are described in detail. In order to run the following demos, the graphs presented in the following Figures have to be designed in Yodiwo’s Designer tab (https://tcyan.yodiwo.com/Designer). After a graph has been created and saved, it should be deployed (the big play button); then case scenarios are ready for use.

Demo 1.

Description: Varying the Rotary Angle Sensor, the brightness of the Led changes and the sensor’s value is displayed in the LCD.

Demo 2.

Description: Tap the SkyWriter Hat, which is attached in the Raspberry PI 2. The position is displayed in the LCD, and if the position is north the light turns on. The text matcher is configured, using the word north in the Comparison Text array. In addition, the level scaler block is configured, using as Output min the 0 value and as Output max the value of 255.

Demo 3.

Description: Make a free fall on the windows phone. Windows phone recognizes the fall detection (true/false). If it is true the phrase “Fall Detected”, set in the constant string block, triggers the Text2Speech block in the Windows Phone. Thus the above voice message can be heard by the Windows Phone. In addition, if a fall is detected the light of the Grove platform is turned on for 3 seconds. The pulse block is configured using as pulse duration 3sec (00:00:03) and the level scaler block is configured, using as Output min range the 0 value and as Output max range the value of 255. We envision this functionality embedded in a wearable device, while on the other side it can generate alerts, by being connected to an email block or real-time communication platform blocks. Such blocks are already available in Yodiwo’s cloud

Tips