You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pins below can be used with `attachInterrupt()` on Nano 33 IoT.
26
26
27
-
| Board PIN | Internal PIN |
27
+
| Board PIN | Internal PIN |
28
28
|----|----|
29
-
| A1 | 15 |
30
-
| A5 | 19 |
31
-
| A7 | 21 |
32
-
| D2 | 2 |
33
-
| D3 | 3 |
34
-
| D9 | 9 |
35
-
| D10 | 10 |
29
+
| A1 | 15 |
30
+
| A5 | 19 |
31
+
| A7 | 21 |
32
+
| D2 | 2 |
33
+
| D3 | 3 |
34
+
| D9 | 9 |
35
+
| D10 | 10 |
36
36
| D11 | 11 |
37
37
38
38
That information was extracted from [github.com/arduino/ArduinoCore-samd/blob/master/variants/nano_33_iot/variant.cpp](https://github.com/arduino/ArduinoCore-samd/blob/master/variants/nano_33_iot/variant.cpp).
@@ -44,7 +44,7 @@ According to the box, the Arduino Nano 33 IoT can be powered by the USB connecto
44
44
45
45
See the results of the experiments below regarding the power supply and the peak current consumption per voltage.
The programs below have been used to test the power consumption of the embedded modules:
50
50
***Sleep**: Using the watchdog to set the board to idle (see section *How to save power?* below)
@@ -59,53 +59,22 @@ The Arduino Nano 33 IoT has a 5V pin which is not wired by default. If you need
59
59
60
60
To to that, you just have to solder the VUSB jumper on the board.
61
61
62
-

62
+

63
63
64
64
Notice that you cannot supply power to the board through this pin, it is only to have a handy 5V for your external components powered by the USB. If you don't power the board through the USB jack, you will stay with 0V on this pin.
65
65
66
66
## How to save power with the Arduino Nano 33 IoT?
67
-
The common way to save power with microcontroller is to go to sleep and use the watchdog to wakeup. Indeed, most of the power are drain while the microcontroller is doing nothing (i.e. waiting between two sample).
67
+
There are the recommended approaches to save power with the Arduino Nano 33 IoT:
68
68
69
-
The very popular [Low-Power library](https://github.com/rocketscream/Low-Power) is supporting the SAMD21G but only after making some patching. A good alternative is to use the [Adafruit SleepyDog Library](https://github.com/adafruit/Adafruit_SleepyDog).
70
-
71
-
To install the library in the Arduino IDE, go in the menu *Tools -> Manage Libraries...* In the library manager, search for `Sleepy` and install the `Adafruit SleepyDog Library` by `Adafruit`.
72
-
73
-

74
-
75
-
The usage is quite simple:
76
-
77
-
```
78
-
#include <Adafruit_SleepyDog.h>
79
-
80
-
void setup() {
81
-
pinMode(LED_BUILTIN, OUTPUT);
82
-
digitalWrite(LED_BUILTIN, HIGH);
83
-
}
84
-
85
-
void loop() {
86
-
digitalWrite(LED_BUILTIN, LOW); // Show we're sleeping
87
-
88
-
// Sleep
89
-
Watchdog.sleep();
90
-
91
-
digitalWrite(LED_BUILTIN, HIGH); // Show we're awake again
92
-
delay(5000);
93
-
}
94
-
```
95
-
96
-
When you're calling the function `Watchdog.sleep()`, the board will be idle for **16 seconds** and the consumption is going as low as **6mA when powered at 3.3V** (which is quite better than 18mA with the BareMinimum program).
97
-
98
-
The only trick is when you want to upload a new program on your board... When the board is idle, you cannot upload a new program on it because it is not listening to the USB serial. So, never upload a program without some activities (real activities or fake activities like the `delay(5000)` above) to have the time slot to upload successfully.
- Shutdown all useless components (Wifi, IMU...) and put the microcontroller (SAMD21G) in sleep mode. This will allow you to go down to 6mA while sleeping (if powered in 3.3V). [See how to put the Arduino Nano 33 IoT on sleep](SavePowerSleeping.md).
70
+
- Shutdown the power and wake-up based on a RTC clock. This will allow you to go down to 0mA while the power is off and wake up at a specific interval of time (every minutes, every hours...). [See how to shutdown the power of the Arduino Nano 33 IoT and wake up on specific time with the RTC](SavePowerRTC.md).
102
71
103
72
## How to use the Wifi with the Arduino Nano 33 IoT?
104
73
The Wifi module embedded on the Arduino Nano 33 IoT is the popular [NINA W102](https://www.u-blox.com/sites/default/files/NINA-W10_DataSheet_%28UBX-17065507%29.pdf) ESP32 based module. It provides support of Wifi 802.11 b/g/n in the 2.4 GHz band and Bluetooth v4.2 (Bluetooth BR/EDR and Bluetooth Low Energy BLE). The module is fully compatible with the [official WiFiNINA library](https://www.arduino.cc/en/Reference/WiFiNINA).
105
74
106
75
To install the official library in the Arduino IDE, go in the menu *Tools -> Manage Libraries...* In the library manager, search for `WifiNINA` and install the `WiFiNINA` by `Arduino`.
107
76
108
-

77
+

109
78
110
79
Useful ressources:
111
80
*[Official documentation of the WiFiNINA library](https://www.arduino.cc/en/Reference/WiFiNINA)
@@ -124,7 +93,7 @@ Useful ressources:
124
93
### The official Arduino LSM6DS3 library (basic usage)
125
94
To install the official library in the Arduino IDE, go in the menu *Tools -> Manage Libraries...* In the library manager, search for `LSM6DS3` and install the `Arduino_LSM6DS3` by `Arduino`.
126
95
127
-

96
+

128
97
129
98
The usage is described on the [official Arduino website](https://www.arduino.cc/en/Reference/ArduinoLSM6DS3).
130
99
@@ -135,7 +104,7 @@ Simple programs are available with the library:
135
104
### The Sparkfun LSM6DS3 library (advanced usage)
136
105
To install the official library in the Arduino IDE, go in the menu *Tools -> Manage Libraries...* In the library manager, search for `LSM6DS3` and install the `SparkFun LSM6DS3 Breakout` by `SparkFun Electronics`.
137
106
138
-

107
+

139
108
140
109
The usage is described on the [GitHub page of the library](https://github.com/sparkfun/SparkFun_LSM6DS3_Arduino_Library). You will notice that this library is offering advanced features like:
141
110
* Usage through multiples instances on I2C channels and SPI.
@@ -180,12 +149,12 @@ A SERCOM can be *classic* or *alternate*. In the data sheet, the *classic* is in
180
149
181
150
For reference, see below the table I used to select the SERCOM to assign:
182
151
183
-

152
+

184
153
185
154
Enough of theory, go for the solution...
186
155
187
156
Add a **hardware serial on pins 5 (RX) and 6 (TX)** of the Arduino Nano 33 IoT:
188
-
```
157
+
```c++
189
158
#include<Arduino.h>
190
159
#include"wiring_private.h"
191
160
@@ -213,7 +182,7 @@ void loop() {
213
182
214
183
Another example, add a **hardware serial on pins 13 (RX) and 8 (TX)** of the Arduino Nano 33 IoT:
# How to save power with the Arduino Nano 33 IoT by shutting down the power and wake up on RTC alarm?
2
+
3
+
## How to shutdown the power of the Arduino Nano 33 IoT and wake up on specific time with the RTC clock?
4
+
5
+
In most data capture projects, the microcontroller is spending a tremendous amount of time doing nothing (waiting or sleeping). During this sleeping time, the power is consumed and the batteries are going down. In order to keep your project alive on months/years on battery, the best is to minimize the power consumption while the sleeping cycle.
6
+
7
+
The approach described here allows to:
8
+
9
+
- Shutdown the all power of the circuit during the sleep cycle.
10
+
- Wake up at pre-defined interval (every minute, every hour, every day or at a specific moment).
11
+
- Consume only the power required for the RTC clock.
12
+
13
+
What do you need?
14
+
15
+
- RTC DS3231 module (I use the ChronoDot 2.1 by Macetech but any DS3231 module with the INT pin wired in OK)
16
+
- The [library DS3231 by NothernWidget](https://github.com/NorthernWidget/DS3231)
17
+
- 2x capacitors 0.1mF
18
+
- 2x resistors 100KOhms
19
+
- 1x NPN transistor (I use the BC547B)
20
+
- 1x MOSFET N-channel (I use the STP16NF06)
21
+
22
+
The schematics is quite simple:
23
+
24
+

25
+
26
+
If you want to reproduce this circuit on a breadboard:
27
+
28
+

29
+
30
+
The bevaviour is easy to understand:
31
+
32
+
- The Arduino Nano 33 IoT is piloting the RTC clock via I2C bus to set the alarm and clear the alarm.
33
+
- The alarm of RTC clock is piloting the NPN transistor to open the power on the MOSFET.
34
+
- The Arduino Nano 33 IoT is powered through the MOSFET.
35
+
- The program is running only once and go everytime through the `setup()` and `loop()` functions.
36
+
37
+
The program below is doing:
38
+
39
+
- Blink the buildin LED 3 times fast at the startup.
40
+
- Set the alarm on the RTC to wake up every minute.
41
+
- Blink the building LED 5 seconds.
42
+
- Clear the alarm to shutdown the power.
43
+
44
+
```c++
45
+
// Libraries required
46
+
#include<Wire.h>
47
+
#include<DS3231.h>
48
+
49
+
// Global variables
50
+
DS3231 Clock;
51
+
52
+
voidsetup() {
53
+
// Wait 1 second (sometime, the wake-up is hard...)
54
+
delay(1000);
55
+
56
+
// Initialize LED
57
+
pinMode(PIN_LED, OUTPUT);
58
+
59
+
// On startup, blink 3 times fast...
60
+
for(uint8_t i = 0; i < 3; i++) {
61
+
digitalWrite(PIN_LED, HIGH);
62
+
delay(100);
63
+
digitalWrite(PIN_LED, LOW);
64
+
delay(100);
65
+
}
66
+
67
+
// Start the I2C interface
68
+
Wire.begin();
69
+
70
+
// Alarm is not enabled! Should set alarm
71
+
if(!Clock.checkAlarmEnabled(1))
72
+
{
73
+
Clock.setClockMode(false);
74
+
// 0b1111 // each second
75
+
// 0b1110 // Once per minute (when second matches)
76
+
// 0b1100 // Once per hour (when minute and second matches)
77
+
// 0b1000 // Once per day (when hour, minute and second matches)
78
+
// 0b0000 // Once per month when date, hour, minute and second matches. Once per week if day of the week and A1Dy=true
79
+
// Set alarm to happen every minute (change to your wanted interval)
# How to save power with the Arduino Nano 33 IoT by sleeping?
2
+
3
+
## How to put the Arduino Nano 33 IoT on sleep?
4
+
5
+
The common way to save power with microcontroller is to go to sleep and use the watchdog to wakeup. Indeed, most of the power are drain while the microcontroller is doing nothing (i.e. waiting between two sample). This will allow you to go down to 6mA at the microcontroller level while sleeping (if powered in 3.3V).
6
+
7
+
The very popular [Low-Power library](https://github.com/rocketscream/Low-Power) is supporting the SAMD21G but only after making some patching. A good alternative is to use the [Adafruit SleepyDog Library](https://github.com/adafruit/Adafruit_SleepyDog).
8
+
9
+
To install the library in the Arduino IDE, go in the menu *Tools -> Manage Libraries...* In the library manager, search for `Sleepy` and install the `Adafruit SleepyDog Library` by `Adafruit`.
10
+
11
+

12
+
13
+
The usage is quite simple:
14
+
15
+
```c++
16
+
#include<Adafruit_SleepyDog.h>
17
+
18
+
voidsetup() {
19
+
pinMode(LED_BUILTIN, OUTPUT);
20
+
digitalWrite(LED_BUILTIN, HIGH);
21
+
}
22
+
23
+
voidloop() {
24
+
digitalWrite(LED_BUILTIN, LOW); // Show we're sleeping
25
+
26
+
// Sleep
27
+
Watchdog.sleep();
28
+
29
+
digitalWrite(LED_BUILTIN, HIGH); // Show we're awake again
30
+
delay(5000);
31
+
}
32
+
```
33
+
34
+
When you're calling the function `Watchdog.sleep()`, the board will be idle for **16 seconds** and the consumption is going as low as **6mA when powered at 3.3V** (which is quite better than 18mA with the BareMinimum program).
35
+
36
+
The only trick is when you want to upload a new program on your board... When the board is idle, you cannot upload a new program on it because it is not listening to the USB serial. So, never upload a program without some activities (real activities or fake activities like the `delay(5000)` above) to have the time slot to upload successfully.
0 commit comments