Skip to content

Commit 0383d65

Browse files
authored
Merge pull request #494 from zfields/notecard
feat: ArduinoIoTCloudNotecard
2 parents a4b00a8 + 2903300 commit 0383d65

27 files changed

+1021
-56
lines changed

.github/workflows/compile-examples.yml

+35-1
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ jobs:
103103
- name: arduino:samd
104104
libraries: |
105105
- name: ArduinoECCX08
106+
- name: Blues Wireless Notecard
106107
- name: RTCZero
107108
- name: WiFi101
108109
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
109110
sketch-paths: |
111+
- examples/ArduinoIoTCloud-Notecard
110112
- examples/utility/Provisioning
111113
# MKR WiFi 1010, Nano 33 IoT, Nano RP2040 Connect
112114
- board:
@@ -117,12 +119,14 @@ jobs:
117119
- name: arduino:mbed_nano
118120
libraries: |
119121
- name: ArduinoECCX08
122+
- name: Blues Wireless Notecard
120123
- name: RTCZero
121124
- name: WiFiNINA
122125
- name: Arduino_JSON
123126
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
124127
sketch-paths: |
125128
- examples/ArduinoIoTCloud-DeferredOTA
129+
- examples/ArduinoIoTCloud-Notecard
126130
- examples/utility/Provisioning
127131
- examples/utility/SelfProvisioning
128132
- board:
@@ -132,10 +136,12 @@ jobs:
132136
- name: arduino:samd
133137
libraries: |
134138
- name: ArduinoECCX08
139+
- name: Blues Wireless Notecard
135140
- name: RTCZero
136141
- name: MKRWAN
137142
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
138-
sketch-paths:
143+
sketch-paths: |
144+
- examples/ArduinoIoTCloud-Notecard
139145
# GSM boards
140146
- board:
141147
type: gsm
@@ -144,10 +150,12 @@ jobs:
144150
- name: arduino:samd
145151
libraries: |
146152
- name: ArduinoECCX08
153+
- name: Blues Wireless Notecard
147154
- name: RTCZero
148155
- name: MKRGSM
149156
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
150157
sketch-paths: |
158+
- examples/ArduinoIoTCloud-Notecard
151159
- examples/utility/Provisioning
152160
# NB boards
153161
- board:
@@ -157,10 +165,12 @@ jobs:
157165
- name: arduino:samd
158166
libraries: |
159167
- name: ArduinoECCX08
168+
- name: Blues Wireless Notecard
160169
- name: RTCZero
161170
- name: MKRNB
162171
- source-url: https://github.com/adafruit/Adafruit_SleepyDog.git
163172
sketch-paths: |
173+
- examples/ArduinoIoTCloud-Notecard
164174
- examples/utility/Provisioning
165175
# Portenta
166176
- board:
@@ -171,8 +181,10 @@ jobs:
171181
libraries: |
172182
- name: ArduinoECCX08
173183
- name: Arduino_Cellular
184+
- name: Blues Wireless Notecard
174185
sketch-paths: |
175186
- examples/ArduinoIoTCloud-DeferredOTA
187+
- examples/ArduinoIoTCloud-Notecard
176188
- examples/utility/Provisioning
177189
# Nicla Vision
178190
- board:
@@ -181,8 +193,10 @@ jobs:
181193
# Install mbed_nicla platform via Boards Manager
182194
- name: arduino:mbed_nicla
183195
libraries: |
196+
- name: Blues Wireless Notecard
184197
sketch-paths: |
185198
- examples/ArduinoIoTCloud-DeferredOTA
199+
- examples/ArduinoIoTCloud-Notecard
186200
- examples/utility/Provisioning
187201
# Opta
188202
- board:
@@ -192,8 +206,10 @@ jobs:
192206
- name: arduino:mbed_opta
193207
libraries: |
194208
- name: ArduinoECCX08
209+
- name: Blues Wireless Notecard
195210
sketch-paths: |
196211
- examples/ArduinoIoTCloud-DeferredOTA
212+
- examples/ArduinoIoTCloud-Notecard
197213
- examples/utility/Provisioning
198214
# GIGA
199215
- board:
@@ -203,8 +219,10 @@ jobs:
203219
- name: arduino:mbed_giga
204220
libraries: |
205221
- name: ArduinoECCX08
222+
- name: Blues Wireless Notecard
206223
sketch-paths: |
207224
- examples/ArduinoIoTCloud-DeferredOTA
225+
- examples/ArduinoIoTCloud-Notecard
208226
- examples/utility/Provisioning
209227
# Portenta C33
210228
- board:
@@ -214,28 +232,41 @@ jobs:
214232
- name: arduino:renesas_portenta
215233
libraries: |
216234
- name: Arduino_Cellular
235+
- name: Blues Wireless Notecard
217236
sketch-paths: |
237+
- examples/ArduinoIoTCloud-Notecard
218238
- examples/utility/Provisioning
219239
# UNO R4 WiFi
220240
- board:
221241
type: renesas_uno
222242
platforms: |
223243
# Install renesas_uno platform via Boards Manager
224244
- name: arduino:renesas_uno
245+
libraries: |
246+
- name: Blues Wireless Notecard
247+
sketch-paths: |
248+
- examples/ArduinoIoTCloud-Notecard
225249
# Nano ESP32
226250
- board:
227251
type: arduino_esp32
228252
platforms: |
229253
# Install arduino_esp32 platform via Boards Manager
230254
- name: arduino:esp32
255+
libraries: |
256+
- name: Blues Wireless Notecard
231257
sketch-paths: |
232258
- examples/ArduinoIoTCloud-DeferredOTA
259+
- examples/ArduinoIoTCloud-Notecard
233260
# Edge Control
234261
- board:
235262
type: mbed_edge
236263
platforms: |
237264
# Install mbed_edge platform via Boards Manager
238265
- name: arduino:mbed_edge
266+
libraries: |
267+
- name: Blues Wireless Notecard
268+
sketch-paths: |
269+
- examples/ArduinoIoTCloud-Notecard
239270
# ESP8266 boards
240271
- board:
241272
type: esp8266
@@ -254,8 +285,11 @@ jobs:
254285
# Install ESP32 platform via Boards Manager
255286
- name: esp32:esp32
256287
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
288+
libraries: |
289+
- name: Blues Wireless Notecard
257290
sketch-paths: |
258291
- examples/ArduinoIoTCloud-DeferredOTA
292+
- examples/ArduinoIoTCloud-Notecard
259293
260294
steps:
261295
- name: Checkout

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The `ArduinoIoTCloud` library is the central element of the firmware enabling ce
1515
* **5G**: [`MKR NB 1500`](https://store.arduino.cc/arduino-mkr-nb-1500-1413)
1616
* **LoRa**: [`MKR WAN 1300/1310`](https://store.arduino.cc/mkr-wan-1310)
1717
* **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)
18+
* **Notecard**: [Provides Cellular/LoRa/Satellite/Wi-Fi to any modern board/architecture](examples/ArduinoIoTCloud-Notecard/README.md)
1819

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

7172
### FAQ
7273
#### Watchdog
73-
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`:
74+
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`:
7475
```C++
7576
ArduinoCloud.begin(ArduinoIoTPreferredConnection, false).
7677
```
@@ -95,5 +96,3 @@ Boards can authenticate to the ArduinoIoTCloud servers using 3 methods:
9596
* `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)
9697

9798
* `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)
98-
99-

examples/ArduinoIoTCloud-Advanced/ArduinoIoTCloud-Advanced.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ void setup() {
1717
Serial.begin(9600);
1818
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
1919

20+
/* Set the debug message level:
21+
* - DBG_ERROR: Only show error messages
22+
* - DBG_WARNING: Show warning and error messages
23+
* - DBG_INFO: Show info, warning, and error messages
24+
* - DBG_DEBUG: Show debug, info, warning, and error messages
25+
* - DBG_VERBOSE: Show all messages
26+
*/
27+
setDebugMessageLevel(DBG_INFO);
28+
2029
/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
2130
initProperties();
2231

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

26-
setDebugMessageLevel(DBG_INFO);
2735
ArduinoCloud.printDebugInfo();
2836
}
2937

examples/ArduinoIoTCloud-Advanced/thingProperties.h

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1111
#endif
1212

13+
#if defined(HAS_LORA)
14+
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
15+
#endif
16+
1317
void onSwitchButtonChange();
1418
void onColorChange();
1519

@@ -30,6 +34,8 @@ void initProperties() {
3034
ArduinoCloud.addProperty(switchButton, 1, Permission::Write).onUpdate(onSwitchButtonChange);
3135
ArduinoCloud.addProperty(location, 2, Permission::Read).publishOnChange(0.0f);
3236
ArduinoCloud.addProperty(color, 3, Permission::ReadWrite).onUpdate(onColorChange);
37+
38+
ArduinoCloud.setThingId(THING_ID);
3339
#endif
3440
}
3541

examples/ArduinoIoTCloud-Basic/ArduinoIoTCloud-Basic.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ void setup() {
2525
Serial.begin(9600);
2626
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
2727

28+
/* Set the debug message level:
29+
* - DBG_ERROR: Only show error messages
30+
* - DBG_WARNING: Show warning and error messages
31+
* - DBG_INFO: Show info, warning, and error messages
32+
* - DBG_DEBUG: Show debug, info, warning, and error messages
33+
* - DBG_VERBOSE: Show all messages
34+
*/
35+
setDebugMessageLevel(DBG_INFO);
36+
2837
/* Configure LED pin as an output */
2938
pinMode(LED_BUILTIN, OUTPUT);
3039

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

37-
setDebugMessageLevel(DBG_INFO);
3846
ArduinoCloud.printDebugInfo();
3947
}
4048

examples/ArduinoIoTCloud-Basic/thingProperties.h

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1111
#endif
1212

13+
#if defined(HAS_LORA)
14+
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
15+
#endif
16+
1317
void onLedChange();
1418

1519
bool led;
@@ -29,6 +33,8 @@ void initProperties() {
2933
ArduinoCloud.addProperty(led, 1, Permission::ReadWrite).onUpdate(onLedChange);
3034
ArduinoCloud.addProperty(potentiometer, 2, Permission::Read).publishOnChange(10);
3135
ArduinoCloud.addProperty(seconds, 3, Permission::Read).publishEvery(5 * MINUTES);
36+
37+
ArduinoCloud.setThingId(THING_ID);
3238
#endif
3339
}
3440

examples/ArduinoIoTCloud-Callbacks/ArduinoIoTCloud-Callbacks.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ void setup() {
3333
Serial.begin(9600);
3434
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
3535

36+
/* Set the debug message level:
37+
* - DBG_ERROR: Only show error messages
38+
* - DBG_WARNING: Show warning and error messages
39+
* - DBG_INFO: Show info, warning, and error messages
40+
* - DBG_DEBUG: Show debug, info, warning, and error messages
41+
* - DBG_VERBOSE: Show all messages
42+
*/
43+
setDebugMessageLevel(DBG_INFO);
44+
3645
/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
3746
initProperties();
3847

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

54-
setDebugMessageLevel(DBG_INFO);
5563
ArduinoCloud.printDebugInfo();
5664
}
5765

examples/ArduinoIoTCloud-Callbacks/thingProperties.h

+7
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@
1010
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1111
#endif
1212

13+
#if defined(BOARD_HAS_LORA)
14+
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
15+
#endif
16+
1317
void initProperties() {
1418
#if defined(BOARD_HAS_SECRET_KEY)
1519
ArduinoCloud.setBoardId(BOARD_ID);
1620
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
1721
#endif
22+
#if defined(BOARD_HAS_LORA)
23+
ArduinoCloud.setThingId(THING_ID);
24+
#endif
1825
}
1926

2027
#if defined(BOARD_HAS_WIFI)

examples/ArduinoIoTCloud-DeferredOTA/ArduinoIoTCloud-DeferredOTA.ino

+9-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ void setup() {
5858
Serial.begin(9600);
5959
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }
6060

61+
/* Set the debug message level:
62+
* - DBG_ERROR: Only show error messages
63+
* - DBG_WARNING: Show warning and error messages
64+
* - DBG_INFO: Show info, warning, and error messages
65+
* - DBG_DEBUG: Show debug, info, warning, and error messages
66+
* - DBG_VERBOSE: Show all messages
67+
*/
68+
setDebugMessageLevel(DBG_INFO);
69+
6170
/* Configure LED pin as an output */
6271
pinMode(LED_BUILTIN, OUTPUT);
6372

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

73-
setDebugMessageLevel(DBG_INFO);
7482
ArduinoCloud.printDebugInfo();
7583
}
7684

0 commit comments

Comments
 (0)