This is a continuation of my experiments to reduce the current consumption of Peripheral by using SystemONSleep in a project designed as a data logger that periodically sends small amounts of data to Central.
Previously, in post #31, I reported that the current was reduced to 20uA by putting 8 bytes of data on the Advertising without a connection.
In a subsequent study,
The length of transfer data can be increased to 59 bytes by using Scan Response,
I found that the current can be reduced to 8.5uA (8 bytes data length, 1m distance, and -70dBm RSSI) by optimizing the transmit power, mode and interval of Advertising.
The experimental conditions were
BSP : Seeed nRF52 Boards 1.1.1
Board : Seeed nRF52 Boards / Seeed XIAO nRF52840 Sense
System ON Sleep : Using RTOS delay()
Task : Send 10 ~ 58 data every 10 seconds
Measurement : 3.00V applied from pppk2 to 3V3 pin of XIAO
Current reduction measure
Disable the blue LED used for BLE
Set on-chip regulator to DCDC mode
Set on-board Flash to OFF
Allow Scan only when necessary
Optimize for the application and environment
user data length 8 bytes
Tx Power 0 dBm(RSSI -70dBm)
Advertising Interval 200mS
Thanks MS again for a neat and concise sharing, much appreciated.
At the moment the central is spending a lot of time in scanning since it does not know when the data is coming. BLE 5 actually has a new feature: periodic advertising which allows central to sleep by synchronizing the peripheral and central. Unfortunately, the existing Softdevice used by Seeed or Adafruit does not support such feature.
Originally MS has applied RTC interrupt to the peripheral. Perhaps the same idea can be applied to the central to save power. The central can be set to scan continuously in the beginning. When the scan callback is invoked it stops scanning, starts the timer and goes to sleep. Central wakes up e.g. 9s later and resumes scanning.
hobbya,
I thought that RTC was more accurate and easier to use than delay() and started using it without thinking much about the current during sleep mode. Later experiments showed that RTCs have a monthly difference of more than 1 minute, and furthermore, using FreeRTOS delay() reduces the current, making the use of RTC meaningless.
In my application Central is always connected to the power supply as it writes data to the SD and displays information. I did not think much about the current in Central. Reducing Central current may be an interesting topic. I am now working on the following topic and will think about it in this topic.
‘XIAO_BLE wakes up from System_ON_Sleep and Writes weather data to on-board Flash’
fujino san,
You have spent a lot of time and shared a lot of working examples. It is a blessing to the community if you continue to explore new ideas and post your new findings. Thank you!
Here, Here,
You two guys are a Technical Blessing to SEEED studios FOR SURE. If I were the MAN at that company, Your gift basket’s would have already arrived.
Great examples of what a community of folks can focus on a common problem and sharing the solutions to it. This has helped me personally by shortening my development time $$ and increased my level of knowledge on the over-all subjects. I stand on the shoulders of Giants.
Thanks Guys
GL PJ
Update but leaving it in here for reference, if someone else is wondering:
I just realised while scrolling back trough the postings that you are directly supplying 3.3v to the pins instead of the vbat pads on the back.
I guess this is the reasons and we cannot get lower when using the vbat pads…
Hello msfujino,
i am trying to get my Seeed Xiao NRF52840 non-mbed to use as little power as possible for a battery operated project which will use bluefruit ble as a client.
I used your sketch from 07.07.2023 as the basis to create a bare minimum blink sketch to get some baseline data.
However with i can only get down to 0.14 mA in the delay (measured with a rough resolving 0.00mA multimeter) - 0.41 with blue led blinking.
Did you undertake measures to disable the small charging led on the Seeed Xiao nrf52840?
Hi 1melc,
I measured the current using your sketch. 3.6V is applied to the battery pad on the back. It is about 4.6uA when the LED is off and about 150uA when the LED is on.
WoW,
So who knew, The Interrupt method also effect the sleep, If you use an edge (RISING/FALLING)it uses more current during sleep to maintain the trigger gate, If you use a level (LOW) it uses less current in sleep?? mode.
Here is an Old video demo with a PPK as well worth the View.
It’s a motherboard with LoRa transciever with an XIAO BLE Sense soldered to it. Still waiting for the motherboard.
I use an Aneng AN870 multimeter, verifieg good uA measurement.
//----------------------------------------------------------------------------------------------
// BSP : Seeed nRF52 Borads 1.1.1
// Board : Seeed nRF52 Boards / Seeed XIAO nRF52840 Sense
// important : need for Serial.print() <Arduino.h> <Adafruit_TinyUSB.h>
// \Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\libraries\Bluefruit52Lib\src
//----------------------------------------------------------------------------------------------
// 2023/07/07
// Central sketch : nRF52_XIAO_LightSleepAdvScan_central.ino
// Need to be deleted /Documents/Arduino/libraries/SdFat
#include <Arduino.h>
#include <Adafruit_TinyUSB.h> // For Serial.print()
#include <bluefruit.h> // \Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\libraries\Bluefruit52Lib\src
#include <Adafruit_SPIFlash.h> // Need to be deleted /Documents/Arduino/libraries/SdFat
#define SLEEP_TIME 30 // Sleep time [sec]
Adafruit_FlashTransport_QSPI flashTransport;
uint8_t timeout = 5;
void setup() {
// Serial port initialization
Serial.begin(115200);
while ((!Serial) && (timeout)){
delay(1000);
timeout--;
}
// Enable DC-DC converter
NRF_POWER->DCDCEN = 1; // Enable DC/DC converter for REG1 stage
// Sleep QSPI flash
flashTransport.begin();
flashTransport.runCommand(0xB9); // enter deep power-down mode
flashTransport.end();
// Initialization of Bruefruit class
Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h:151 for supported values
Bluefruit.autoConnLed(false); // turn off LED to save power Sleep Current 4uA
// Bluefruit.setConnLedInterval(50); // Should not be used, Sleep current 300uA
Serial.println("End of initialization");
}
//*************************************************************************************************************
void loop() {
digitalWrite(LED_BLUE, LOW); // turn the LED on (HIGH is the voltage level)
delay(5000); // light for 5 seconds, but the rtc in the background keeps running. --> light off only for 25 seconds
digitalWrite(LED_BLUE, HIGH);
delay(SLEEP_TIME * 1000); // System ON Sleep by FreeRTOS
}
I use an Aneng AN870 multimeter, verifieg good uA measurement.
Do you run this sketch and the measured value is 4mA?
Where is the multimeter connected?
Are you aware that this multimeter can only measure average current?
Is there anything connected to the XIAO port that could be a load?
Yes. Isupply Vusb with 5V and it consumes 4mA. XIAO BLE Sense is the only thing I have right now. Nothing else besides it, so no load of any kind, no pins connected to anything.