Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ArduinoIoTCloudNotecard #494

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 35 additions & 1 deletion .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ jobs:
- name: arduino:samd
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: RTCZero
- name: WiFi101
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# MKR WiFi 1010, Nano 33 IoT, Nano RP2040 Connect
- board:
Expand All @@ -117,12 +119,14 @@ jobs:
- name: arduino:mbed_nano
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: RTCZero
- name: WiFiNINA
- name: Arduino_JSON
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
- examples/utility/SelfProvisioning
- board:
Expand All @@ -132,10 +136,12 @@ jobs:
- name: arduino:samd
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: RTCZero
- name: MKRWAN
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
sketch-paths:
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
# GSM boards
- board:
type: gsm
Expand All @@ -144,10 +150,12 @@ jobs:
- name: arduino:samd
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: RTCZero
- name: MKRGSM
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# NB boards
- board:
Expand All @@ -157,10 +165,12 @@ jobs:
- name: arduino:samd
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: RTCZero
- name: MKRNB
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# Portenta
- board:
Expand All @@ -171,8 +181,10 @@ jobs:
libraries: |
- name: ArduinoECCX08
- name: Arduino_Cellular
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# Nicla Vision
- board:
Expand All @@ -181,8 +193,10 @@ jobs:
# Install mbed_nicla platform via Boards Manager
- name: arduino:mbed_nicla
libraries: |
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# Opta
- board:
Expand All @@ -192,8 +206,10 @@ jobs:
- name: arduino:mbed_opta
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# GIGA
- board:
Expand All @@ -203,8 +219,10 @@ jobs:
- name: arduino:mbed_giga
libraries: |
- name: ArduinoECCX08
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# Portenta C33
- board:
Expand All @@ -214,28 +232,41 @@ jobs:
- name: arduino:renesas_portenta
libraries: |
- name: Arduino_Cellular
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
- examples/utility/Provisioning
# UNO R4 WiFi
- board:
type: renesas_uno
platforms: |
# Install renesas_uno platform via Boards Manager
- name: arduino:renesas_uno
libraries: |
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
# Nano ESP32
- board:
type: arduino_esp32
platforms: |
# Install arduino_esp32 platform via Boards Manager
- name: arduino:esp32
libraries: |
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
# Edge Control
- board:
type: mbed_edge
platforms: |
# Install mbed_edge platform via Boards Manager
- name: arduino:mbed_edge
libraries: |
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-Notecard
# ESP8266 boards
- board:
type: esp8266
Expand All @@ -254,8 +285,11 @@ jobs:
# Install ESP32 platform via Boards Manager
- name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
libraries: |
- name: Blues Wireless Notecard
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard

steps:
- name: Checkout
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The `ArduinoIoTCloud` library is the central element of the firmware enabling ce
* **5G**: [`MKR NB 1500`](https://store.arduino.cc/arduino-mkr-nb-1500-1413)
* **LoRa**: [`MKR WAN 1300/1310`](https://store.arduino.cc/mkr-wan-1310)
* **Ethernet**: [`Portenta H7`](https://store.arduino.cc/products/portenta-h7) + [`Vision Shield Ethernet`](https://store.arduino.cc/products/arduino-portenta-vision-shield-ethernet), [`Max Carrier`](https://store.arduino.cc/products/portenta-max-carrier), [`Breakout`](https://store.arduino.cc/products/arduino-portenta-breakout), [`Portenta Machine Control`](https://store.arduino.cc/products/arduino-portenta-machine-control), [`OPTA WiFi`](https://store.arduino.cc/products/opta-wifi), [`OPTA RS485`](https://store.arduino.cc/products/opta-rs485), [`OPTA Lite`](https://store.arduino.cc/products/opta-lite), [`Portenta C33`](https://store.arduino.cc/products/portenta-c33) + [`Vision Shield Ethernet`](https://store.arduino.cc/products/arduino-portenta-vision-shield-ethernet)
* **Notecard**: [Provides Cellular/LoRa/Satellite/Wi-Fi to any modern board/architecture](examples/ArduinoIoTCloud-Notecard/README.md)

### How?
1) Register your Arduino IoT Cloud capable board via [Arduino IoT Cloud](https://create.arduino.cc/iot) (Devices Section).
Expand Down Expand Up @@ -70,7 +71,7 @@ void onLedChange() {

### FAQ
#### Watchdog
The [1.0.0](https://github.com/arduino-libraries/ArduinoIoTCloud/releases/tag/1.0.0) release of this library adds watchdog functionality to all ATSAMD21G18 based cloud connected boards. A watchdog is simply an electronic timer counting down from a preset start value which, upon reaching zero, triggers a reset of the microcontroller. It can be used to automatically recover from temporary hardware faults or unrecoverable software errors. In order to avoid the watchdog from reaching zero the countdown timer needs to be regularly re-set to its start value. This is happening within `ArduinoCloud.update()` which is periodically called at the start of the `loop()` function. Although the watchdog is automatically enabled it can be disabled by setting the second parameter of `ArduinoCloud.begin(...)` to `false`:
The [1.0.0](https://github.com/arduino-libraries/ArduinoIoTCloud/releases/tag/1.0.0) release of this library adds watchdog functionality to all ATSAMD21G18 based cloud connected boards. A watchdog is simply an electronic timer counting down from a preset start value which, upon reaching zero, triggers a reset of the microcontroller. It can be used to automatically recover from temporary hardware faults or unrecoverable software errors. In order to avoid the watchdog from reaching zero the countdown timer needs to be regularly re-set to its start value. This is happening within `ArduinoCloud.update()` which is periodically called at the start of the `loop()` function. Although the watchdog is automatically enabled it can be disabled by setting the second parameter of `ArduinoCloud.begin(...)` to `false`:
pennam marked this conversation as resolved.
Show resolved Hide resolved
```C++
ArduinoCloud.begin(ArduinoIoTPreferredConnection, false).
```
Expand All @@ -95,5 +96,3 @@ Boards can authenticate to the ArduinoIoTCloud servers using 3 methods:
* `DEVICE_CERTIFICATE` and `PRIVATE_KEY`. This values are stored inside the board secure element during the device provisioning phase. Boards that are using this method are: [`MKR 1000`](https://store.arduino.cc/arduino-mkr1000-wifi), [`MKR WiFi 1010`](https://store.arduino.cc/arduino-mkr-wifi-1010), [`MKR GSM 1400`](https://store.arduino.cc/arduino-mkr-gsm-1400-1415), [`MKR NB 1500`](https://store.arduino.cc/arduino-mkr-nb-1500-1413), [`Nano 33 IoT`](https://store.arduino.cc/arduino-nano-33-iot), [`Portenta H7`](https://store.arduino.cc/portenta-h7), [`Nano RP2040 Connect`](https://store.arduino.cc/products/arduino-nano-rp2040-connect), [`Nicla Vision`](https://store.arduino.cc/products/nicla-vision), [`OPTA WiFi`](https://store.arduino.cc/products/opta-wifi), [`OPTA RS485`](https://store.arduino.cc/products/opta-rs485), [`OPTA Lite`](https://store.arduino.cc/products/opta-lite), [`GIGA R1 WiFi`](https://store.arduino.cc/products/giga-r1-wifi), [`Portenta C33`](https://store.arduino.cc/products/portenta-c33)

* `APP_EUI` and `APP_KEY`. This values are defined in the `thingProperties.h` file and included in the Sketch. Boards that are using this method are: [`MKR WAN 1300/1310`](https://store.arduino.cc/mkr-wan-1310)


10 changes: 9 additions & 1 deletion examples/ArduinoIoTCloud-Advanced/ArduinoIoTCloud-Advanced.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
initProperties();

/* Initialize Arduino IoT Cloud library */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
6 changes: 6 additions & 0 deletions examples/ArduinoIoTCloud-Advanced/thingProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif

#if defined(HAS_LORA)
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif

void onSwitchButtonChange();
void onColorChange();

Expand All @@ -30,6 +34,8 @@ void initProperties() {
ArduinoCloud.addProperty(switchButton, 1, Permission::Write).onUpdate(onSwitchButtonChange);
ArduinoCloud.addProperty(location, 2, Permission::Read).publishOnChange(0.0f);
ArduinoCloud.addProperty(color, 3, Permission::ReadWrite).onUpdate(onColorChange);

ArduinoCloud.setThingId(THING_ID);
#endif
}

Expand Down
10 changes: 9 additions & 1 deletion examples/ArduinoIoTCloud-Basic/ArduinoIoTCloud-Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* Configure LED pin as an output */
pinMode(LED_BUILTIN, OUTPUT);

Expand All @@ -34,7 +43,6 @@ void setup() {
/* Initialize Arduino IoT Cloud library */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
6 changes: 6 additions & 0 deletions examples/ArduinoIoTCloud-Basic/thingProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif

#if defined(HAS_LORA)
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif

void onLedChange();

bool led;
Expand All @@ -29,6 +33,8 @@ void initProperties() {
ArduinoCloud.addProperty(led, 1, Permission::ReadWrite).onUpdate(onLedChange);
ArduinoCloud.addProperty(potentiometer, 2, Permission::Read).publishOnChange(10);
ArduinoCloud.addProperty(seconds, 3, Permission::Read).publishEvery(5 * MINUTES);

ArduinoCloud.setThingId(THING_ID);
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
initProperties();

Expand All @@ -51,7 +60,6 @@ void setup() {
ArduinoCloud.addCallback(ArduinoIoTCloudEvent::SYNC, doThisOnSync);
ArduinoCloud.addCallback(ArduinoIoTCloudEvent::DISCONNECT, doThisOnDisconnect);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
7 changes: 7 additions & 0 deletions examples/ArduinoIoTCloud-Callbacks/thingProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif

#if defined(BOARD_HAS_LORA)
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
#endif

void initProperties() {
#if defined(BOARD_HAS_SECRET_KEY)
ArduinoCloud.setBoardId(BOARD_ID);
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
#endif
#if defined(BOARD_HAS_LORA)
ArduinoCloud.setThingId(THING_ID);
#endif
}

#if defined(BOARD_HAS_WIFI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ void setup() {
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* Configure LED pin as an output */
pinMode(LED_BUILTIN, OUTPUT);

Expand All @@ -70,7 +79,6 @@ void setup() {
/* Setup OTA callback */
ArduinoCloud.onOTARequestCb(onOTARequestCallback);

setDebugMessageLevel(DBG_INFO);
ArduinoCloud.printDebugInfo();
}

Expand Down
Loading
Loading