Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ubuntu-14.04-ONS #540

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Create ubuntu-14.04-ONS
  • Loading branch information
suvivi779 authored Oct 16, 2019
commit 04c38c6231ba56f1c03a925fce3a583c66312e52
160 changes: 160 additions & 0 deletions get_started/ubuntu-14.04-ONS
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
---
platform: {ubuntu-14.04}
device: {ONS}
language: python
---

Run a simple PYTHON sample on {enter your device name here} device running {enter the OS name running on device}
===
---

# Table of Contents

- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
- [Next Steps](#NextSteps)

# Instructions for using this template

- Replace the text in {placeholders} with correct values.
- Delete the lines {{enclosed}} after following the instructions enclosed between them.
- It is advisable to use external links, wherever possible.
- Remove this section from final document.

<a name="Introduction"></a>
# Introduction

**About this document**

This document describes how to connect {enter your device name here} device running {enter the OS name running on device} with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device

<a name="Prerequisites"></a>
# Step 1: Prerequisites

You should have the following items ready before beginning the process:

- [Prepare your development environment][setup-devbox-python]
- [Setup your IoT hub][lnk-setup-iot-hub]
- [Provision your device and get its credentials][lnk-manage-iot-hub]
- {enter your device name here} device.
- {{Please specify if any other software(s) or hardware(s) are required.}}

<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
- {{Write down the instructions required to setup, configure and connect your device. Please use external links when possible pointing to your own page with device preparation steps.}}

<a name="Build"></a>
# Step 3: Build and Run the sample

<a name="Load"></a>
## 3.1 Build SDK and sample

- Open a PuTTY session and connect to the device.

- Install the prerequisite packages for the Microsoft Azure IoT Device SDK for Python by issuing the following commands from the command line on your board:
{{***Keep the command set based on your OS and remove the rest.***}}

**Debian or Ubuntu**

sudo apt-get update

sudo apt-get install -y curl libcurl4-openssl-dev build-essential cmake git python2.7-dev libboost-python-dev

**Fedora**

sudo dnf check-update -y

sudo dnf install libcurl-devel openssl-devel gcc-c++ make cmake git python2.7-dev libboost-python-dev

**Any Other Linux OS**

Use equivalent commands on the target OS

{{***If any other software is required, please specify here the command(s) for installing same.***}}

- Download the Microsoft Azure IoT Device SDK to the board by issuing the following command on the board::

git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git

- Run following commands to build the SDK:

cd python/build_all/linux
sudo ./build.sh

- After a successful build, the `iothub_client.so` Python extension module is copied to the **python/device/samples** folder.

- Navigate to samples folder by executing following command:

cd azure-iot-sdk-python/device/samples/

- Edit the following file using any text editor of your choice:
{{***Keep the file based on your protocol(s) and remove the rest.***}}

**For AMQP protocol:**

nano iothub_client_sample_amqp.py

**For HTTP protocol:**

nano iothub_client_sample_http.py

**For MQTT protocol:**

nano iothub_client_sample_mqtt.py

- Find the following place holder for device connection string:

connectionString = "[device connection string]"

- Replace the above placeholder with device connection string you obtained in [Step 1](#Prerequisites) and save the changes.

## 3.2 Send Device Events to IoT Hub:

- Run the sample application using the following command:
{{***Keep the command set based on your protocol(s) and remove the rest.***}}

**For AMQP protocol:**

python iothub_client_sample_amqp.py

**For HTTP protocol:**

python iothub_client_sample_http.py

**For MQTT protocol:**

python iothub_client_sample_mqtt.py

- See [Manage IoT Hub][lnk-manage-iot-hub] to learn how to observe the messages IoT Hub receives from the application.

## 3.3 Receive messages from IoT Hub

- See [Manage IoT Hub][lnk-manage-iot-hub] to learn how to send cloud-to-device messages to the application.

<a name="NextSteps"></a>
# Next Steps

You have now learned how to run a sample application that collects sensor data and sends it to your IoT hub. To explore how to store, analyze and visualize the data from this application in Azure using a variety of different services, please click on the following lessons:

- [Manage cloud device messaging with iothub-explorer]
- [Save IoT Hub messages to Azure data storage]
- [Use Power BI to visualize real-time sensor data from Azure IoT Hub]
- [Use Azure Web Apps to visualize real-time sensor data from Azure IoT Hub]
- [Weather forecast using the sensor data from your IoT hub in Azure Machine Learning]
- [Remote monitoring and notifications with Logic Apps]

[Manage cloud device messaging with iothub-explorer]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-explorer-cloud-device-messaging
[Save IoT Hub messages to Azure data storage]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-store-data-in-azure-table-storage
[Use Power BI to visualize real-time sensor data from Azure IoT Hub]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-live-data-visualization-in-power-bi
[Use Azure Web Apps to visualize real-time sensor data from Azure IoT Hub]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-live-data-visualization-in-web-apps
[Weather forecast using the sensor data from your IoT hub in Azure Machine Learning]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-weather-forecast-machine-learning
[Remote monitoring and notifications with Logic Apps]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-monitoring-notifications-with-azure-logic-apps
[setup-devbox-python]: https://github.com/Azure/azure-iot-device-ecosystem/blob/master/get_started/python-devbox-setup.md
[lnk-setup-iot-hub]: ../../setup_iothub.md
[lnk-manage-iot-hub]: ../../manage_iot_hub.md