Skip to content

Commit 696fece

Browse files
committed
Add documentation
1 parent 83f2f3f commit 696fece

File tree

5 files changed

+64
-35
lines changed

5 files changed

+64
-35
lines changed

examples/Battery/Battery.ino

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
- Open the Serial Monitor in the Arduino IDE.
2626
- Set the baud rate to 115200.
2727
- You will see the sketch continuously printing battery information.
28+
29+
Initial author: Sebastian Romero ([email protected])
2830
*/
2931

3032
#include "Arduino_PowerManagement.h"

examples/Charger/Charger.ino

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
- Open the Serial Monitor in the Arduino IDE.
2424
- Set the baud rate to 115200.
2525
- You will see the sketch continuously printing charger state information.
26+
27+
Please note that the Portenta C33 will not charge batteries that do not have an NTC.
28+
29+
Initial authors:
30+
Cristian Dragomir ([email protected])
31+
Sebastian Romero ([email protected])
2632
*/
2733
#include "Arduino_PowerManagement.h"
2834

examples/Standby_WakeFromPin/Standby_WakeFromPin.ino

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
Standby Wake From Pin Demo
3+
This sketch demonstrates how you can use the Arduino_PowermManagement library to send a board to standby mode by using a GPIO pin and wake it up from another.
4+
This sketch is universal and worksn on both Portenta C33 and H7.
5+
On the the Portenta C33 you can select any of the supported pins (A0, A1, A2, A3, A4, A5, D4, D7) to wake up the board from standby mode,
6+
but on the Portenta H7 only GPIO0 can be used to wake up the board from standby mode. GPIO0 is available through the High Density Connectors and you need a breakout board to access it.
7+
8+
Requirements:
9+
- Arduino Portenta C33, Arduino Portenta H7
10+
- Arduino IDE / Arduino CLI
11+
- PowerManagement library (installable from the Arduino Library Manager)
12+
Usage:
13+
- Connect a button to GOTO_SLEEP_PIN and with a pull-up resistor to 3.3V
14+
- Connect a button to pin PORTENTA_C33_WAKEUP_PIN if you are using the Portenta C33 or GPIO0 if you are using a Portenta H7 and with a pull-up resistor to 3.3V
15+
(If you need information about how to wire the buttons check this link: https://docs.arduino.cc/built-in-examples/digital/Button/)
16+
- Upload the provided sketch to the board
17+
- Press the button connected to GOTO_SLEEP_PIN to put the board into standby mode
18+
- Press the button connected to PORTENTA_C33_WAKEUP_PIN or GPIO0 to wake up the board from standby mode
19+
- The LED will blink every second to show that the board is awake when not in standby mode
20+
21+
Initial author: Cristian Dragomir ([email protected])
22+
*/
123

224
#include "Arduino.h"
325
#include "Arduino_PowerManagement.h"
@@ -13,7 +35,7 @@ Board board;
1335
void setup() {
1436
board = Board();
1537
board.begin();
16-
board.setAllPeripheralsPower(true);
38+
board.setAllPeripheralsPower(true); // TODO: Check if this is necessary
1739

1840
// Allows to use a button to put the device into sleep mode
1941
attachInterrupt(digitalPinToInterrupt(GOTO_SLEEP_PIN), goToSleep, RISING);
@@ -26,8 +48,6 @@ void setup() {
2648
// On Portenta only pin GPIO0 can be used to wake up the device from sleep mode
2749
board.enableWakeupFromPin();
2850
#endif
29-
30-
3151

3252
pinMode(LEDB, OUTPUT);
3353
}

examples/Standby_WakeFromRTC_C33/Standby_WakeFromRTC_C33.ino

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Standby Wake from RTC Demo for Portenta C33
3+
This example demonstrates how to wake up the Portenta C33 from standby mode using the included RTC (Real Time Clock).
4+
The device will go to sleep for 1 second and then wake up. When the device is awake you will see the board's blue LED turned on.
5+
Effectively, you will get the same effect as with blink.
6+
7+
On the Portenta C33 with the peripherals turned off you can expect around 60uA of current consumption in standby mode.
8+
The example also turns off the peripherals before going to sleep and turns them back on after waking up.
9+
Usage:
10+
- Make sure you are running the latest version of the Renesas Core
11+
- Select the Portenta C33 board from the Tools menu
12+
- Select the Portenta C33 USB port from the Tools menu
13+
- Upload the code to your Portenta C33
14+
15+
Initial author: Cristian Dragomir ([email protected])
16+
*/
17+
118

219
#include "Arduino_PowerManagement.h"
320
#include "RTC.h"
@@ -41,7 +58,6 @@ void setup() {
4158
}
4259
}
4360

44-
// board.enableWakeupFromRTC(0, 0, 10, [](){}); // Sleep for 10 seconds
4561
board.enableWakeupFromRTC(0, 0, 10); // Sleep for 10 seconds
4662

4763
delay(1000); // Keep the board awake for 1 second, so we can se it working

examples/Standby_WakeFromRTC_H7/Standby_WakeFromRTC_H7.ino

+16-31
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
/*
2-
Charger Demo
3-
4-
This sketch demonstrates how to use the PowerManagement library enable low power modes on the Arduino Portenta H7.
5-
* In the setup() function, it enters standby mode and waits for a wakeup event from the RTC.
6-
* The loop() functionit is not used in this sketch.
7-
8-
IMPORTANT: Please note that this sketch has to be uploaded to the M4 core too in order to achieve the lowest power consumption.
9-
10-
Requirements:
11-
- Arduino Arduino Portenta H7
12-
- Arduino IDE
13-
- PowerManagement library (installable from the Arduino Library Manager)
14-
15-
Usage:
16-
17-
1. Connect a battery to the board.
18-
19-
2. Upload the Sketch to the M4 core:
20-
- Open the provided sketch in the Arduino IDE.
21-
- Select your board type and port from the "Tools" menu.
22-
- Select the M4 core from the "Tools" menu.
23-
- Click the "Upload" button to upload the sketch to your board.
24-
25-
3. Upload the Sketch to the M7 core:
26-
- Select the M7 core from the "Tools" menu.
27-
- Click the "Upload" button to upload the sketch to your board.
28-
29-
4. Observer LED behavior:
30-
- The blue LED will turn on when the board is awake.
31-
- The blue LED will turn off when the board goes to sleep.
32-
- The red LED will blink if the board fails to initialize.
2+
Standby Wake from RTC Demo for Portenta H7
3+
This example demonstrates how to wake up the Portenta H7 from standby mode using the included RTC (Real Time Clock).
4+
The device will go to sleep for 10 second and then stay awake for another 10. When the device is awake you will see the board's blue LED turned on.
5+
Effectively, you will get the same effect as with blink.
6+
7+
On the Portenta H7 with the peripherals turned off you can expect around 300uA of current consumption in standby mode.
8+
The example also turns off the peripherals before going to sleep and turns them back on after waking up.
9+
Usage:
10+
- Make sure you are running the latest version of the Renesas Core
11+
- Select the Portenta H7 board from the Tools men
12+
- Select the Portenta H7 USB port from the Tools menu
13+
- Upload the code to your Portenta H7
14+
15+
Initial authors:
16+
Cristian Dragomir ([email protected])
17+
Sebastian Romero ([email protected])
3318
*/
3419

3520
#include "Arduino_PowerManagement.h"

0 commit comments

Comments
 (0)