Git Product home page Git Product logo

wio-terminal-azure-sample's Introduction

Wio Terminal Azure IoT sample

This repo shows sample code for connecting the Wio Terminal to Azure IoT Hub. This uses the Azure Arduino SDK.

This code connects to IoT Hub, then sends telemetry in the loop function. It also listens to direct method requests.

The IoT Hub code runs single-threaded, so you need to call IoTHubDeviceClient_LL_DoWork(_device_ll_handle) to process messages from IoT Hub. Instead of a long delay in the loop function, this code shows how to implement a long delay as lots of short delays with calls to IoTHubDeviceClient_LL_DoWork.

When your device connects, part of the internal connection logic uses the current time to build a key. This means the device time has to be correct, and this is implemented in the ntp.h file, with code to get the current time from an NTP server and set it on the Wio Terminals RTC.

Instructions

  1. Create an Azure IoT Hub
  2. Create a device and get the connection string
  3. Open this folder in VS Code using the PlatformIO extension
  4. Set the CONNECTION_STRING constant in config.h in the src folder to the device connection string
  5. Set the SSID and PASSWORD constants in config.h in the src folder to the relevant values for your WiFi
  6. Build and deploy to your Wio Terminal using PlatformIO

If you are using the Arduino IDE, you can copy the main.cpp code into your sketch file, and add the other files in the src folder into your sketch folder. You will need to choose the Wio Terminal in the board manager and add the following libraries using the library manager:

  • bblanchon/ArduinoJson
  • seeed-studio/Seeed Arduino rpcWiFi
  • seeed-studio/Seeed Arduino FS
  • seeed-studio/Seeed Arduino SFUD
  • seeed-studio/Seeed Arduino rpcUnified
  • seeed-studio/Seeed_Arduino_mbedtls
  • seeed-studio/Seeed Arduino RTC
  • arduino-libraries/AzureIoTHub
  • azure/AzureIoTUtility
  • azure/AzureIoTProtocol_MQTT
  • azure/AzureIoTProtocol_HTTP
  • azure/AzureIoTSocket_WiFi

wio-terminal-azure-sample's People

Stargazers

 avatar

Watchers

 avatar  avatar

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.