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.
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:
-
ESP8266 based boards with esp8266/arduino
-
SparkFun Thing
-
Adafruit Feather Huzzah
-
-
ESP32 based boards with espressif/arduino-esp32
- Adafruit HUZZAH32
You should have the following ready before beginning with any board:
-
Install the Azure IoT C SDK libraries by one of two options:
-
Generate the Libraries by executing the
make_sdk.cmd
script within thebuild_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
oresp32
) as arg 2
- The folder you want to copy the libraries into as arg 1, and the board you are using (
-
Install the following libraries through the Arduino IDE Library Manager:
AzureIoTHub
,AzureIoTUtility
,AzureIoTProtocol_MQTT
,AzureIoTSocket_WiFi
, and, optionally,AzureIoTSocket_Ethernet2
if you are using theesp32
with an ethernet shield/daughterboard.
-
-
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
-
-
Open the
iothub_ll_telemetry_sample
example from the Arduino IDE File->Examples->AzureIoTHub menu. -
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.
-
Update IoT Hub Connection string in
iot_configs.h
-
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.
-
- 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 theadapters
folder or IS defined/commented out, as this file will produce compile errors when building for esp8266.
-
Run the sample.
-
Access the SparkFun Get Started tutorial to learn more about Microsoft Sparkfun Dev Kit.
-
Access the Huzzah Get Started tutorial to learn more about Microsoft Huzzah Dev Kit.
-
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
-
-
Open the
iothub_ll_telemetry_sample
example from the Arduino IDE File->Examples->AzureIoTHub menu. -
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.
-
Update IoT Hub Connection string in
iot_configs.h
-
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=
)
- 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 theadapters
folder.
-
Run the sample.
-
Access the SparkFun Get Started tutorial to learn more about Microsoft Sparkfun Dev Kit.
-
Access the Huzzah Get Started tutorial to learn more about Microsoft Huzzah Dev Kit.
See LICENSE file.
Complete information for contributing to the Azure IoT Arduino libraries
can be found here.