Code Monkey home page Code Monkey logo

azure-iot-arduino's Introduction

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.

Azure IoT Hub Library source files

AzureIoTHub - Azure IoT Hub library for Arduino

This is the location of the Arduino-specific source files for the

AzureIoTHub Arduino published library.

This library is a port of the Microsoft Azure IoT device SDK for C to Arduino. It allows you to use several Arduino compatible boards with Azure IoT Hub. Please submit any contribution directly to azure-iot-sdks.

Currently supported hardware:

Prerequisites

You should have the following ready before beginning with any board:

  • Setup your IoT hub

  • Provision your device and get its credentials

  • Arduino IDE

  • Install the Azure IoT C SDK libraries by one of two options:

    1. Generate the Libraries by executing the make_sdk.cmd script within the build_all folder, with args as follows:

      • The folder you want to copy the libraries into as arg 1, and the board you are using (esp8266 or esp32) as arg 2
    2. Install the following libraries through the Arduino IDE Library Manager:

    • AzureIoTHub, AzureIoTUtility, AzureIoTProtocol_MQTT, AzureIoTSocket_WiFi, and, optionally, AzureIoTSocket_Ethernet2 if you are using the esp32 with an ethernet shield/daughterboard.

Simple Sample Instructions

ESP8266

Sparkfun Thing, Adafruit Feather Huzzah, or generic ESP8266 board
  1. Install esp8266 board support into your Arduino IDE.

    • Start Arduino and open Preferences window.

    • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.

    • Open Boards Manager from Tools > Board menu and install esp8266 platform 2.5.2 or later

    • Select your ESP8266 board from Tools > Board menu after installation

  2. Open the iothub_ll_telemetry_sample example from the Arduino IDE File->Examples->AzureIoTHub menu.

  3. Update Wifi SSID/Password in iot_configs.h

    • Ensure you are using a wifi network that does not require additional manual steps after connection, such as opening a web browser.
  4. Update IoT Hub Connection string in iot_configs.h

  5. Navigate to where your esp8266 board package is located, typically in C:\Users\<your username>\AppData\Local\Arduino15\packages on Windows and ~/.arduino15/packages/ on Linux

  • Locate the board's Arduino.h (hardware/esp8266/<board package version>/cores/esp8266/ and comment out the line containing #define round(x), around line 137.

  • Locate the board's platform.txt and add the defines -DDONT_USE_UPLOADTOBLOB -DUSE_BALTIMORE_CERT on line 73 (build.extra_flags=)

    • Note1: Please change the CERT define to the appropriate cert define if not using the global portal.azure.com server, defines for which are laid out in certs.c

    • Note2: Due to RAM limits, you must select just one CERT define.

  1. Navigate to the AzureIoTUtility library location, typically C:\Users\<your username>\Documents\Arduino\libraries\AzureIoTUtility\src on Windows, and ~/Arduino/libraries/AzureIoTUtility/src on Linux.
  • Once there, ensure that tlsio_mbedtls.c either is NOT in the adapters folder or IS defined/commented out, as this file will produce compile errors when building for esp8266.
  1. Run the sample.

  2. Access the SparkFun Get Started tutorial to learn more about Microsoft Sparkfun Dev Kit.

  3. Access the Huzzah Get Started tutorial to learn more about Microsoft Huzzah Dev Kit.

ESP32

Sparkfun ESP32 Thing, Adafruit ESP32 Feather, or generic ESP32 board
  1. Install esp32 board support into your Arduino IDE.

    • Start Arduino and open Preferences window.

    • Enter https://dl.espressif.com/dl/package_esp32_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.

    • Open Boards Manager from Tools > Board menu and install esp32 platform 1.0.2 or later

    • Select your ESP32 board from Tools > Board menu after installation

  2. Open the iothub_ll_telemetry_sample example from the Arduino IDE File->Examples->AzureIoTHub menu.

  3. Update Wifi SSID/Password in iot_configs.h

    • Ensure you are using a wifi network that does not require additional manual steps after connection, such as opening a web browser.
  4. Update IoT Hub Connection string in iot_configs.h

  5. Navigate to where your esp32 board package is located, typically in C:\Users\<your username>\AppData\Local\Arduino15\packages on Windows and ~/.arduino15/packages/ on Linux

  • Locate the board's platform.txt and add the define -DDONT_USE_UPLOADTOBLOB on line 53 (build.extra_flags=)
  1. Navigate to the AzureIoTUtility library location, typically C:\Users\<your username>\Documents\Arduino\libraries\AzureIoTUtility\src on Windows, and ~/Arduino/libraries/AzureIoTUtility/src on Linux
  • Once there, ensure that tlsio_mbedtls.c is in the adapters folder.
  1. Run the sample.

  2. Access the SparkFun Get Started tutorial to learn more about Microsoft Sparkfun Dev Kit.

  3. Access the Huzzah Get Started tutorial to learn more about Microsoft Huzzah Dev Kit.

License

See LICENSE file.

Complete information for contributing to the Azure IoT Arduino libraries

can be found here.

azure-iot-arduino's People

Contributors

az-iot-builder-01 avatar davidbradburyattunix avatar gregman-msft avatar jbobotek avatar mamokarz avatar obsoleted avatar rafilho avatar sandeepmistry avatar stefangordon avatar tameraw avatar yaohaizh avatar yaweiw avatar yodama avatar

Watchers

 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.