Skip to content

Very high power consumption on Nano 33 IoT #246

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

Open
baconcheese113 opened this issue Jul 13, 2022 · 1 comment
Open

Very high power consumption on Nano 33 IoT #246

baconcheese113 opened this issue Jul 13, 2022 · 1 comment
Labels
type: imperfection Perceived defect in any part of project

Comments

@baconcheese113
Copy link

Using a blank sketch with just the following on my Nano 33 IoT:

void setup() {
  BLE.begin();
}
void loop() {
  // no-op
}

Is drawing 90mA. Without BLE.begin() it's 21mA, so the NINA chip requires 69mA to just be active (no scanning or advertising, although there wasn't a significant change in power consumption doing either). That means using ArduinoBLE will give the following life expectancies:

  • Large cr2032 coin battery: 2 hours
  • Standard 4.8v battery pack: 22 hours
  • Battery of flagship Samsung s22: 1.7 days
  • Battery of 2021 16-in Macbook pro: 4 days

With this in mind, many users of this library are seeking a way to just power down the NINA module for a set period of time without changing anything about the currently configured GATT.

  1. I have tried calling BLE.end(), however this resets the GATT and the program crashes when trying to add the services back with BLE.addService(myService) after a subsequent BLE.begin(). The event handlers fail to register with BLE.setEventHandler(BLEConnected, onBLEConnected) as well
  2. I have tried calling digitalWrite(NINA_RESETN, LOW) and HIGH directly and this actually works nearly perfect, except the scan is unable to find anything after turning the module back on. But it can advertise and call event handlers without problems, and the GATT is populated how it was before shutting down.

I'm having a hard time finding a work around, since the ArduinoLowPower sleep function only shaves off 13mA. Do you have any insight how to turn on/off the module without breaking things?

@baconcheese113
Copy link
Author

baconcheese113 commented Jul 15, 2022

An update:

I pursued my second method above and I think I've found a way to power down the NINA module and get the scan functionality when it's powered back up. This is great because the GATT is retained as well.

You can shut down the module (after having called BLE.begin()) with:

digitalWrite(NINA_RESETN, LOW);

and power it back up with:

digitalWrite(NINA_RESETN, HIGH);
delay(750); // this is what the existing implementation uses after starting

and to restore scan ability, I've found that this is the only line I need to call:

// #include "utility/HCI.h" if you need the import

HCI.setEventMask(0x3FFFFFFFFFFFFFFF);

Calling the BLE.begin() method triggers an HCI.begin() and HCI.reset() as well as a GATT.begin() which resets the GATT back to just defaults. I'm still investigating the side effects of not calling the other HCI methods from the BLE.begin() method.
However it's working so far to both preserve my GATT and scan correctly. It's also important to note that there might be other differences for other boards.

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants