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.py
script within thebuild_all
folder, E.x.:python3 make_sdk.py -o <your-output-folder>
- Note: this is also currently the ONLY way to build the
AzureIoTSocket_WiFi
library for using the esp32.
- Install the following libraries through the Arduino IDE Library Manager:
AzureIoTHub
,AzureIoTUtility
,AzureIoTProtocol_MQTT
,AzureIoTProtocol_HTTP
- Generate the Libraries by executing the
-
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
-
Configure board library using the automation script and
python3
. If you choose this method you can skip step 6.- Clone or download this repo:
git clone https://github.com/Azure/azure-iot-pal-arduino.git
, navigate to the downloaded sub-folder:cd azure-iot-pal-arduino/build_all/base-libraries/AzureIoTHub/src/scripts
, and check that the scriptautomate_board_config.py
exists in this location. If this folder or script cannot be located, download the script directly. - Run the script E.x.:
python3 automate_board_config.py
and select appropriate options. - Note: if you update or reinstall your board library in Arduino you will need to run this script again.
- Clone or download this repo:
-
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. -
Two folders up from the
Arduino.h
step above, in the same folder as the board'splatform.txt
, paste theplatform.local.txt
file from theesp8266
folder in the sample into it.-
Note1: It is necessary to add
-DDONT_USE_UPLOADTOBLOB
and-DUSE_BALTIMORE_CERT
tobuild.extra_flags=
in aplatform.txt
in order to run the sample, however, you can define them in your ownplatform.txt
or aplatform.local.txt
of your own creation. -
Note2: If your device is not intended to connect to the global portal.azure.com, please change the CERT define to the appropriate cert define as laid out in
certs.c
-
Note3: Due to RAM limits, you must select just one CERT define.
-
-
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
-
Configure board library using the automation script and
python3
. If you choose this method you can skip step 6.- Clone or download this repo:
git clone https://github.com/Azure/azure-iot-pal-arduino.git
, navigate to the downloaded sub-folder:cd azure-iot-pal-arduino/build_all/base-libraries/AzureIoTHub/src/scripts
, and check that the scriptautomate_board_config.py
exists in this location. If this folder or script cannot be located, download the script directly. - Run the script E.x.:
python3 automate_board_config.py
and select appropriate options. - Note: if you update or reinstall your board library in Arduino you will need to run this script again.
- Clone or download this repo:
-
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-
Navigate deeper in to
hardware/esp8266/<board package version>/
where theplatform.txt
file lives. -
Copy the
platform.local.txt
file from theesp32
folder in the sample into the same folder as theplatform.txt
. -
Alternatively, or for later versions of the Board Package, add the define
-DDONT_USE_UPLOADTOBLOB
tobuild.extra_flags=
inplatform.txt
or aplatform.local.txt
that you create.
-
-
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 Arduino Nano33 IoT board support into your Arduino IDE.
-
Open Boards Manager from Tools > Board menu and install arduino nano 33 iot platform 1.8.11 or later
-
Select your Arduino Nano 33 IoT 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
-
Configure board library using the automation script and
python3
. If you choose this method you can skip step 6.- Clone or download this repo:
git clone https://github.com/Azure/azure-iot-pal-arduino.git
, navigate to the downloaded sub-folder:cd azure-iot-pal-arduino/build_all/base-libraries/AzureIoTHub/src/scripts
, and check that the scriptautomate_board_config.py
exists in this location. If this folder or script cannot be located, download the script directly. - Run the script E.x.:
python3 automate_board_config.py
and select appropriate options. - Note: if you update or reinstall your board library in Arduino you will need to run this script again.
- Clone or download this repo:
-
Navigate to where your arduino nano 33 iot board package is located, typically in
C:\Users\<your username>\AppData\Local\Arduino15\packages
on Windows and~/.arduino15/packages/
on Linux-
Navigate deeper in to
hardware/samd/<board package version>/
where theplatform.txt
file lives. -
Copy the
platform.local.txt
file from theArduinoNano33iot
folder in the sample into the same folder as theplatform.txt
. -
Alternatively, or for later versions of the Board Package, add the define
-DDONT_USE_UPLOADTOBLOB
tobuild.extra_flags=
inplatform.txt
or aplatform.local.txt
that you create.
-
-
Run the sample.
See LICENSE file.
Complete information for contributing to the Azure IoT Arduino libraries
can be found here.