Go Down

Topic: Nano33 ble - how should I go about reducing current draw (Read 469 times) previous topic - next topic

Steen_Petersen

Hi all,

I am new to the forum and I have a question that I am really struggling with, I hope that someone can shine some light on this topic.

As the title states I am trying to reduce to the current draw of my nano33 ble. I am using a Ruideng to check how much power the nano33 is consuming and I can see that even with an empty sketch it draws about 0.018a or 18 mah.

That seems like a lot to me considering its an empty sketch doing nothing. From tutorials I have found that you can decrease the current draw by removing LEDs. But I am wondering if there is any way to, through the arduino IDE, make the nano33 go into some sort of sleep mode.

Apparently the board should go into sleep modes by itself when it has nothing to do, but the empty sketch kinda shows me that that is not the case. Others have had this problem but an update of the ArduinoBLE library (which I have) should have fixed this issue. It does however state in that thread that powering it via the solder jumper on the underside of the board should cut power consumption down further. But im unsure how to go about doing this. Or if its even wise to do so.

This thread talks a little bit about it but im confused as it is 4 years old and although it talks about nordic boards it is not the nRF52840. I have tried to follow the guidance there already to no avail.

This thread at Adafruit starts to guide me to overwrite the main.cpp in order to resolve this, which seems wrong but wanted to ask here.

This all to say that I have tried to take a look around on these forums as well as elsewhere to see if I can find a way of going about dealing with this issue but im a bit lost. and would be greatful for a point in the right direction.

TL:DR

Is there an example sketch for putting the nano33 ble into a sleep mode? and if not is this because we are expected to overwrite .cpp code or similar?

pert

#1
Feb 18, 2020, 07:12 am Last Edit: Feb 19, 2020, 11:55 am by pert Reason: Code tags!
you can decrease the current draw by removing LEDs.
There were more IO pins on the nRF52840 than needed for the Nano form factor, so the Nano 33 BLE designers put the "ON" LED on a dedicated IO pin (LED_PWR). So if you want to save the power that the "ON" LED uses, no need to remove it, just do this in the setup() function of your sketch:
Code: [Select]
digitalWrite(LED_PWR, LOW);

The "L" LED is on pin 13. If you don't use pin 13, then that LED will do no harm. However, it might be that you need all the IO pins or are using the SPI bus (the led is on the SCK pin). In that case, you might want to remove the "L" LED.

Apparently the board should go into sleep modes by itself when it has nothing to do, but the empty sketch kinda shows me that that is not the case.
I think the way it works is it sleeps while delay() is running. See the "reference sketch" at https://github.com/arduino-libraries/ArduinoBLE/pull/15#issuecomment-529570392

Others have had this problem but an update of the ArduinoBLE library (which I have) should have fixed this issue.
That is about power consumption while using BLE. That information doesn't apply when you're running an empty sketch.

Note this statement on the linked pull request:
https://github.com/arduino-libraries/ArduinoBLE/pull/15#issuecomment-552600601
Quote
Quote
I discovered the device all the time in the smartphone apps like the device doesn't go to sleep at all. Am I missing anything?
This is the intended behaviour there is no sleep, the power consumption is just lower between radio events.
It does however state in that thread that powering it via the solder jumper on the underside of the board should cut power consumption down further.
The DC/DC converter that converts the 5 V from the USB to the 3.3 V the nRF52840 runs at is using a lot of current. If you cut the jumper, then you can cut the DC/DC converter out of the circuit and power the nRF52840 from a 3.3 V supply directly via the 3.3V pin.

But im unsure how to go about doing this.
There is a small trace connecting the two larger solder jumper pads on the bottom of the board that are marked "3.3V". With a utility knife, repeatedly cut through that small trace until you are certain you have broken the connection. After doing this, the USB cable will no longer power the Nano 33 BLE, so you will need to provide a 3.3 V power supply to the board via the 3.3 V pin.

Or if its even wise to do so.
You do need to be careful when powering the nRF52840 directly. When powering via the USB cable, there's not much you can do wrong. But when powering from the 3.3 V pin, you could kill the chip by using too high a voltage or reversing the polarity. If you later decide you want to go back to powering the board via the USB cable, you can use a blob of solder to replace the connection between the solder jumper pads.

Is there an example sketch for putting the nano33 ble into a sleep mode?
Sure, it's here:
Code: [Select]
void setup() {
}

void loop() {
  // Sleep for one minute
  delay(60 * 1000);
}



Here are my findings:

BareMinimum sketch:
Code: [Select]
void setup() {}
void loop() {}

with USB power: 17.4 mA

BareMinimum sketch with 3.3 V jumper cut, powered via the 3.3 V pin: 9.49 mA

"ON" LED turned off:
Code: [Select]
void setup() {
  digitalWrite(LED_PWR, LOW);
}
void loop() {}

7.6 mA

1 minute sleep per loop:
Code: [Select]
void setup() {
  digitalWrite(LED_PWR, LOW);
}
void loop() {
  delay(60 * 1000);
}

1.747 mA

PIN_ENABLE_SENSORS_3V3 set to LOW:
Code: [Select]
void setup() {
  digitalWrite(LED_PWR, LOW);
  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);
}
void loop() {
  delay(60 * 1000);
}

1.741 mA

PIN_ENABLE_I2C_PULLUP set to LOW:
Code: [Select]
void setup() {
 digitalWrite(LED_PWR, LOW);
 digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);
 digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW);
}

void loop() {
 delay(60 * 1000);
}

1.738 mA

Unplug USB cable: 1.240 mA

Power cycle the board with USB cable unplugged: 0.906 mA

Steen_Petersen

#2
Feb 19, 2020, 09:46 am Last Edit: Feb 19, 2020, 10:23 am by Steen_Petersen
Hi Pert,

Thank you so much for a thorough post, I am currently trying to follow your advice. I have cut the trace and can see that the USB cable no longer powers the device.

pert

Just to be clear, I said "3.3 V" above, but the NINA B-306 module is rated for a 1.7-3.6 V supply range. You should be fine supplying it with any voltage in that range via the 3.3 V pin.

Steen_Petersen

#4
Feb 28, 2020, 07:21 pm Last Edit: Feb 28, 2020, 07:31 pm by Steen_Petersen
Pert - thank you so much for your time at looking at my question. Although it has been some time since you answered this I have been playing around trying to get my 'Arduino Nano 33 ble' to consume as little power as possible when it is not moving. And then to wake up when it starts to move around.

There is something I am fundamentally not understanding here.

I have been able to reproduce your results almost exactly but 0.9 ma is still way too much for the project so I needed to bring it even further down. I have done this by putting the board into

Code: [Select]
NRF_POWER->SYSTEMOFF = 1;
While in this state I have been able to see the board get as low as +-30 µa which is way more in line with what I would expect when the system is off.



So here comes the hard part - When I now want to have my nano come back to life when it is moved I have come to realize that I somehow have to let it know where to expect, and to expect, an interrupt call.

I have found that should look something like this:

Code: [Select]
nrf_gpio_cfg_sense_input(accPin, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH); // accPin = Accelerometer pin
But I'm not quite sure how to tell it to listen to 1) the sensor moving, 2) the sensor moving over a certain amount, etc. Really having a hard time finding any information on this.

I'm rather confused about the setup of all of this. I'm starting to understand that I need to tell the NRF to sleep and that there are certain pins that it can be told to listen to while in SYSTEMOFF. From the documentation:

Quote
5.3.3 System OFF mode
System OFF is the deepest power saving mode the system can enter. In this mode, the system's core functionality is powered down and all ongoing tasks are terminated. The device can be put into System OFF mode using the register SYSTEMOFF on page 76. When in System OFF mode, the device can be woken up through one of the following signals:
1. The DETECT signal, optionally generated by the GPIO peripheral.
2. The ANADETECT signal, optionally generated by the LPCOMP module.
3. The SENSE signal, optionally generated by the NFC module to wake-on-field.
4. Detecting a valid USB voltage on the VBUS pin (VBUS, DETECT).
5.A reset.
The system is reset when it wakes up from the System OFF mode.
I understand that as being able to use GPIO (general purpose input/output) as an interrupt. Can I not use the accelerometer as a GPIO? and if so? how? Due to me being an amateur, I tried to figure out which pin corresponded to the accelerometer, then set that to be the accPin variable. That doesn't seem to work. No matter what I try to put there as a pin, it wakes up the nano from sleep immediately, I am therefore having a hard time testing my way through this.

If you have some sage advice or a point in the right direction, I would greatly appreciate it.

Here is the relevant part of my code:

Code: [Select]

accPin = ? // My understanding is that I could just find the accelerometer Pin
void Sleep()
{
  digitalWrite(LED_PWR, LOW); // turn off power LED
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW); // turn off I²C pullup
  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW); // turn sensor OFF

  pinMode(PIN_A6, OUTPUT);
  digitalWrite(PIN_A6, LOW);

  //nrf_gpio_cfg_sense_input(accPin, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);

  NRF_POWER->SYSTEMOFF = 1;
}

void setup() {
  delay(5000); // For easier testing with the multimeter 
  Sleep();
}

void loop()
{
}

Go Up