Skip to content
This repository was archived by the owner on Jul 22, 2022. It is now read-only.

Arduino nano 33 iot example support #126

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3caec29
add Arduino Nano 33 ioT example code
Khawaja-Usman-Riaz-Sehgal May 6, 2021
47371d8
Added support for Arduino Nano 33 Iot
Khawaja-Usman-Riaz-Sehgal May 6, 2021
eac403d
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 18, 2021
e45fb59
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 18, 2021
17d170d
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 18, 2021
883a153
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 18, 2021
bcc9123
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 18, 2021
d0ee637
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 19, 2021
2e799dd
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 19, 2021
ce5f2f4
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 19, 2021
2538ca1
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 19, 2021
6483a38
modified platform.local.txt file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 20, 2021
6e27d31
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 21, 2021
d57a0e5
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 21, 2021
b365b6e
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 24, 2021
8464d0e
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 24, 2021
4c25c3b
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 24, 2021
7d91c01
add platformio.ini
Khawaja-Usman-Riaz-Sehgal May 25, 2021
e8cda10
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
d1432e4
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
0a266aa
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
a8d2ac9
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
bfc85c0
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
eb91d63
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
b66c637
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
869e6b4
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
4f7f4bc
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
ba34ff6
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
2e7fa22
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 25, 2021
9c2f069
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 26, 2021
3a47aaa
add flags in platformio.ini file
Khawaja-Usman-Riaz-Sehgal May 26, 2021
952bfcb
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 26, 2021
35105ff
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 26, 2021
d9d8f92
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 26, 2021
4673429
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
11c4b39
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
52f0507
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
742d431
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
63e9227
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
2a9613b
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
e7f0a26
modified iot_config file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
50fba2c
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
dc78b57
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
6affc5f
modified .travis.yml file for nano33iot board
Khawaja-Usman-Riaz-Sehgal May 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
1 change: 1 addition & 0 deletions .pio/build/project.checksum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c6791a4fbf98852daca2023ec98649d785fdba3c
34 changes: 21 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
language: generic
env:
global:
- IDE_VERSION=1.8.10
- IDE_VERSION=1.6.11
matrix:
- BOARD="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80"
- BOARD="esp8266:esp8266:thing"
- BOARD="esp32:esp32:huzzah"
- BOARD="arduino:samd:nano_33_iot"
before_install:
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
- sleep 3
Expand All @@ -17,28 +15,38 @@ before_install:
- tar xf arduino-$IDE_VERSION-linux64.tar.xz
- mv arduino-$IDE_VERSION $HOME/arduino-ide
- export PATH=$PATH:$HOME/arduino-ide
- if [[ "$BOARD" =~ "arduino:samd:" ]]; then
arduino --install-boards arduino:samd;
arduino --install-library WiFiNINA;
arduino --install-library WiFi101;
arduino --install-library RTCZero;
arduino --install-library NTPClient;
fi
- if [[ "$BOARD" =~ "esp8266:esp8266:" ]]; then
arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --install-boards esp8266:esp8266;
arduino --pref "boardsmanager.additional.urls=" --save-prefs;
arduino --install-library NTPClient;
fi
- if [[ "$BOARD" =~ "esp32:esp32:" ]]; then
arduino --pref "boardsmanager.additional.urls=https://dl.espressif.com/dl/package_esp32_index.json" --install-boards esp32:esp32;
arduino --pref "boardsmanager.additional.urls=" --save-prefs;
arduino --install-library NTPClient;
fi

- findAndReplace() { sed -i'' -e"s|$1|$2|g" "$3"; }
- buildExampleSketch() {
EXAMPLE_SKETCH=$PWD/examples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.ino;
EXAMPLE_SKETCH=$PWD/examples/ArduinoNano33iot/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.ino;

if [[ "$BOARD" =~ "esp8266:esp8266:" ]]; then
findAndReplace WiFi101 ESP8266WiFi $EXAMPLE_SKETCH;
findAndReplace WiFiSSLClient WiFiClientSecure $EXAMPLE_SKETCH;
findAndReplace WiFiUdp WiFiUdp $EXAMPLE_SKETCH;
fi

cat $EXAMPLE_SKETCH;

arduino --verbose-build --verify --board $BOARD $EXAMPLE_SKETCH;
}
install:
- arduino --install-library "AzureIoTHub"
- arduino --install-library "AzureIoTUtility"
- arduino --install-library "AzureIoTSocket_WiFi"
- arduino --install-library "AzureIoTProtocol_MQTT"
- arduino --install-library "AzureIoTProtocol_HTTP"
- arduino --install-library "AzureIoTProtocol_MQTT"
- ln -s $PWD $HOME/Arduino/libraries/.
script:
- buildExampleSketch telemetry_sample.c
- buildExampleSketch iothub_ll_telemetry_sample
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"cSpell.words": [
"ddont",
"iothub",
"ll",
"samd",
"sample",
"telemetry",
"uploadtoblob",
"use"
]
}
26 changes: 26 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "msbuild",
"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true",
"/t:build",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "silent"
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
}
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,40 @@ You should have the following ready before beginning with any board:

9. Access the [Huzzah Get Started](https://azure.microsoft.com/en-us/documentation/samples/iot-hub-c-huzzah-getstartedkit/) tutorial to learn more about Microsoft Huzzah Dev Kit.


## ARDUINO NANO 33 IOT

##### ARDUINO NANO 33 IOT board

1. 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

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. 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 script `automate_board_config.py` exists in this location. If this folder or script cannot be located, download the script [directly](https://raw.githubusercontent.com/Azure/azure-iot-pal-arduino/master/build_all/base-libraries/AzureIoTHub/src/scripts/automate_board_config.py).
- 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.

6. 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 the `platform.txt` file lives.

- Copy the [`platform.local.txt`](https://github.com/Azure/azure-iot-arduino/blob/master/examples/iothub_ll_telemetry_sample/ArduinoNano33iot/platform.local.txt) file from the `ArduinoNano33iot` folder in the sample into the same folder as the `platform.txt`.

- Alternatively, or for later versions of the Board Package, add the define `-DDONT_USE_UPLOADTOBLOB` to `build.extra_flags=` in `platform.txt` or a `platform.local.txt` that you create.

7. Run the sample.

## License

See [LICENSE](LICENSE) file.
Expand Down
26 changes: 26 additions & 0 deletions examples/ArduinoNano33iot/iothub_ll_telemetry_sample/iot_configs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#ifndef IOT_CONFIGS_H
#define IOT_CONFIGS_H

/**
* WiFi setup
*/
#define IOT_CONFIG_WIFI_SSID "InfoNet-BB"
#define IOT_CONFIG_WIFI_PASSWORD "pakistan313"

/**
* IoT Hub Device Connection String setup
* Find your Device Connection String by going to your Azure portal, creating (or navigating to) an IoT Hub,
* navigating to IoT Devices tab on the left, and creating (or selecting an existing) IoT Device.
* Then click on the named Device ID, and you will have able to copy the Primary or Secondary Device Connection String to this sample.
*/
#define DEVICE_CONNECTION_STRING "HostName=ArduinoNano33IoT.azure-devices.net;DeviceId=ArduinoNano33IoTDevice;SharedAccessKey=0XrwEGjbnYkbIglMadXZ/+SOIXHrn5eVxn7EoCIBqPM="

// The protocol you wish to use should be uncommented
//
#define SAMPLE_MQTT
//#define SAMPLE_HTTP

#endif /* IOT_CONFIGS_H */
Loading