BLE Low Power example

Hi everyone,

I just started with the Arduino Nano 33 BLE and flashed the the LED-Callback example.
I was a Little bit suprised about the current consumption. I changed the Advertising interval to 300ms.
But I got a current of 16-18mA.

I read, that the core should go into sleep, without a a function call if nothing is to do.
But it looks like that that the Loop with poll() is running all the time.
I tried to implement the MBED OS lib with the wait function to force the System to sleep, but it didn't helped.

For better understanding here the code with the ArduinoBLE Version 1.1.1

What can I Change to get a "Low Power BLE-System" and a current of xx µA?

Thx and best regards,

Knowless

/*
  Callback LED

  This example creates a BLE peripheral with service that contains a
  characteristic to control an LED. The callback features of the
  library are used.

  The circuit:
  - Arduino MKR WiFi 1010, Arduino Uno WiFi Rev2 board, Arduino Nano 33 IoT,
    Arduino Nano 33 BLE, or Arduino Nano 33 BLE Sense board.

  You can use a generic BLE central app, like LightBlue (iOS and Android) or
  nRF Connect (Android), to interact with the services and characteristics
  created in this sketch.

  This example code is in the public domain.
*/

#include <ArduinoBLE.h>

BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // create service

// create switch characteristic and allow remote device to read and write
BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);

const int ledPin = LED_BUILTIN; // pin to use for the LED

void setup() {
  Serial.begin(9600);
  while (!Serial);
  
  pinMode(ledPin, OUTPUT); // use the LED pin as an output

  // begin initialization
  if (!BLE.begin()) {
    Serial.println("starting BLE failed!");

    while (1);
  }

  // set the local name peripheral advertises
  BLE.setLocalName("LEDCallback");
  // set the UUID for the service this peripheral advertises
  BLE.setAdvertisedService(ledService);

  // add the characteristic to the service
  ledService.addCharacteristic(switchCharacteristic);

  // add service
  BLE.addService(ledService);

  // assign event handlers for connected, disconnected to peripheral
  BLE.setEventHandler(BLEConnected, blePeripheralConnectHandler);
  BLE.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);

  // assign event handlers for characteristic
  switchCharacteristic.setEventHandler(BLEWritten, switchCharacteristicWritten);
  // set an initial value for the characteristic
  switchCharacteristic.setValue(0);

  // start advertising
  BLE.advertise();

  Serial.println(("Bluetooth device active, waiting for connections..."));
}

void loop() {
  // poll for BLE events
  BLE.poll();
}

void blePeripheralConnectHandler(BLEDevice central) {
  // central connected event handler
  Serial.print("Connected event, central: ");
  Serial.println(central.address());
}

void blePeripheralDisconnectHandler(BLEDevice central) {
  // central disconnected event handler
  Serial.print("Disconnected event, central: ");
  Serial.println(central.address());
}

void switchCharacteristicWritten(BLEDevice central, BLECharacteristic characteristic) {
  // central wrote new value to characteristic, update LED
  Serial.print("Characteristic event, written: ");

  if (switchCharacteristic.value()) {
    Serial.println("LED on");
    digitalWrite(ledPin, HIGH);
  } else {
    Serial.println("LED off");
    digitalWrite(ledPin, LOW);
  }
}

Hello everyone,

I thought the information might be quite interesting for the others.
There is really a problem with the ArduinoBLE library (Or the library behind) right now, which doesn't let the Arduino get in sleep or deepsleep. But they are working on it at the moment and there will be an update next week.
If you can not wait, just use the git version.

Therefore an untested guide for others (just to see how it should work(read in other forum)):
Just delete the ArduinoBLE folder under :
...user\documents\arduino\libraries
Then copy the git version to the same location and the examples were found by the IDE.
Now your Arduino Nano 33 ___ should get in sleep mode automatic.

But this is only a construction site. The DCDC converter doesn't seem to be the best choice. Its quiescent current is extremely high.
There are however different variants to solve this.

  1. you separate the pad area of the 3.3V and feed in the 3.3V externally.
  2. desolder the DCDC converter and replace it with another one. Unfortunately I haven't found a pin to pin compatible one yet. Therefore I would suggest the DeadBug technique and use any LDO that fits the application.

Further reduction can be obtained by removing I2C sensors power and pullups using.

  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW);

The original source of this information comes from facchinm from the following link:

I hope this information will help some people.

Best regards,
Knowless