Skip to content

Latest commit

 

History

History
94 lines (60 loc) · 2.79 KB

raspbian-quix-sensor-gateway-python.md

File metadata and controls

94 lines (60 loc) · 2.79 KB
platform device language
raspbian
quix sensor gateway
python

Run a simple Python sample on QuiX Sensor Gateway device running Raspbian


Table of Contents

Introduction

About this document

This document describes how to connect QuiX Sensor Gateway device running Raspbian 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

Step 1: Prerequisites

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

Step 2: Prepare your Device

  • Plug Ethernet Cable.

Step 3: Build and Run the sample

3.1 Build SDK and sample

  • Open a PuTTY session and connect to the device.

  • 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-sdks.git
    
  • Run following commands to build the SDK:

    cd azure-iot-sdks/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-sdks/python/device/samples/
    
  • Edit the following file using any text editor of your choice:

    For HTTP protocol:

    nano iothub_client_sample_http.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 and save the changes.

3.2 Send Device Events to IoT Hub:

  • Run the sample application using the following command:

    For HTTP protocol:

    python iothub_client_sample_http.py
    
  • See 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 to learn how to send cloud-to-device messages to the application.