Hi everyone! I’m here looking for some advice because my Seeed XIAO nRF52840 are using 1.8 mA in deep sleep. I want to power them using coin cells so that’s a problem because I’d be using one up in a matter of days instead of several months.
I used the code by @PJ_Glasso to toggle between awake and deep sleep using two buttons and I tested it on all three devices. They are using 4.3 mA awake and 1.8 mA asleep. Before trying the button solution, I ran the code from this thread Sleep Current of XIAO nRF52840, Deep Sleep vs. Light Sleep and got the same result, except the first time I did it on the second device it only needed 8µA. I tested the third, which also needed 1.8 mA (actually 1.9 mA that day but that could just be the multimeter). When I went back to the second device it then also consumed 1.8 mA and does so ever since. I am not sure what’s going on there. What can I do to investigate the root cause? I am a decent programmer and have some knowledge of electric circuits, but when it gets down to electronics know-how that I read here by people that squeezed out the last microamps I am lost. I’ll do my best to follow but please dumb it down if possible.
My device information is the same as already given above:
UF2 Bootloader 0.6.1 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-293-gaf8e5a90) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
Model: Seeed XIAO nRF52840
Board-ID: Seeed_XIAO_nRF52840_Sense
SoftDevice: S140 version 7.3.0
Date: Nov 12 2021
I use the Arduino IDE and it shows up with the suffix Sense there for whatever reason.
Hi dt10,
The sketch in the link below should be able to reproduce the uA sleep current. Is your multimeter good enough to measure uA? Tell us about your experiment in detail. When did you say the current was 1.8mA, @PJ_Glasso’s sketch? Or @msfujino’s sketch?
Pay attention to the BSP (board support package) and weather your using the non-mbed or mbed versions on the BSP’s. We use the power profiler to collect the power Info you see.
The Power Ninja @msfujino is the most experienced with this topic hands down.
So I can only add ," what he said"
take your time and read EVERYTHING you will get up to speed no problem. come here and post any questions,and code using the code tags above(</>) paste it in there, pictures hepl to, lots of very helpful smart people are present most days & nights
I have used coin cells on Xiao no problem. I like these cr-2450’s
FYI, there are things like shutting down or sleeping the external Flash also will lower the sleep number. It’s great hardware and sometimes the software dev lags but the user base holds it down and parallel devs like adafruit and nordic add to the knowledge base.
What is your end vision with this?
Thank you both for getting involved! I get the same result from both @msfujino deep sleep and @PJ_Glasso post #59 sketches.
Here is my current setup. The board with the red LED that connects to the USB Li ion battery is a boost converter where I removed to outgoing USB port and put pins in its place. Sorry if this butchering of the board hurts your eyes, I suppose it does. I know I could directly go from the USB port of the battery, but due to the pins the boost converter was the easiest way for me to enable the current measurement without cutting up another USB cable*. To measure the current, for lack of better equipment, I used those two clips to connect the multimeter on the high side. I have to push buttons connecting to ground on D2 and D3 and ground and 5V on the respective pins, nothing else
…oh no, it says I can’t embed media!.. let me try dropbox links to the pictures… you’ll have to click them because it only shows those broken image icons, sorry about that!
Board support package, BSP, thanks for spelling it out for me! This is what I got. I hadn’t noticed that it picks the “Sense” by default, but I just repeated the measurement after selecting non-sense and it did not make a difference.
Daniel
*in case you are wondering what is going on there: I am using two of the XIAOs that communicate using BLE. After developing both sides of the code I used this boost converter with a CR2032 to test things. I made a rookie mistake in the BLE code and I think that drained the coin cell quickly. To prevent that for further testing, I put the USB C cable in place so that I can use that Li battery and keep using the pin strips. If you are thinking why on earth did he keep the boost converter, it’s because I also wanted to measure how much current it can provide because the data sheet said “500 to 600 mA” and I wanted to know.
Nah’ Looks like a WIP to me
You do what you can do, with what you got, No Shame in that game! (post limit will lift and you can post pics after a few posts, btw) I see the Dropbox files.
SO what I see is your NOT using the battery connections on the bottom of the Xiao? Why NOT?
All bets are off if you choose to not power it that way, the other methods require a diode and
other considerations and will NOT get the LOW numbers NO-WAY!
Yada, yada , Boooster , Buck converter it’s all been done before not a big deal.
(honestly I LOL because all the first attempts are like yours , me included and look this way…WRONG…LOL!)
the smaller CR2032 coin cells will get you 350-450 ma. run time current total then it’s down hill and done from there. I like the 2450 has more juice longer and supports more total power draw.
During the advertising phase of the BLE the Xiao uses the most current. so the Idea is do the (setup) heavy lifting for the connection right away and then go Sleep. “rinse and repeat”
mind you many optimisations can be made to the BLE connection parameters and settings to squeeze the max out of battery life.
In your code if you are using the Serial port or “while Serial” the port will wait until a USB cable is connected and the rs232 driver/rec 1488/89 are in MARK state and using 1.x ma. of current.
Have a look at the schematic for the Xiao and READ the Links to @msfujino
research on “System on SLeep”
BSP… Board Support Package there are two Mbed versions (2.9.1) & NON-mbed versions(1.1.1) to start with.
Seeed Studio XIAO nRF52840 assembles many functions in one tiny board and sometimes may not perform the best of them. Hence, Seeed has published two Arduino libraries to let it maximum the power of each function. Therefore:
It is recommanded to use the Seeed nRF52 Boards library if you want to apply Bluetooth function and “Low Energy Cost Function”.
It is recommanded to use the Seeed nRF52 mbed-enabled Boards library if you want to use it in embedded Machine Learning Applications or apply “IMU & PDM advanced function”.
Both libraries support very well when it comes to the basic usage, such as LED, Digital, Analog, Serial, I2C, SPI.
The Pin definition supported by these two libraries might be a little different and Seeed will keep update the wiki until it is clear.
Stop and take the time to RTFM is the best advice your close but your missing the basic understandings it will clear it up or generate the right questions to help you.
then you can get these:
Yes, of course I read the getting started, down to the battery charging which is not something I plan to do. I would not have known how to get it running in the first place without it.
Why not the battery pins? I, as I now know mistakenly, thought I can just as well use the pins for that purpose and since I already did the pin strips I went with that. I just soldered wires to the battery pins and now it’s working. When it wakes up I briefly see 100-something µA on the multimeter before it settles to 18 µA. In sleep mode I get 3.5 µA, so both readings agree well with your detailed measurements. Thanks PJ!
I am looking forward to merging this with the BLE code and the ADXL345 (to wake up the device due to being used) and see how low I can go. I am sure there will be some more surprises along the way but the individual parts are working. If I had realized there’s a version with motion sensors I would have bought that one. My ADXL345 board requires about 60µA, which isn’t great but if I manage the interrupt wake up working with the 1Hz or 8Hz sleep mode I hope this will go down. The BLE part is only notifying values at the push of buttons. Measurements will tell, but I think I did a reasonable job there.
Thinking about it, maybe I won’t even need the motion wake-up on this side of the BLE communication. If I can make it wake up on pushing the button and then notify it would be sufficient. I already see myself programming half the weekend
Ok, now that wasn’t the most productive weekend, or Monday. I still tried the motion sensors to determine when it is time to go to sleep and when to wake up together with BLE communication because I have other uses for it. It took some time, but it worked nicely. Nevertheless, for such a coin cell powered application where all I want to do is (briefly) send which button has been pushed when one is pushed and then go back to sleep, I wanted to do wake up → advertise (specifically a beacon where I placed the button number) → return to sleep after a prescribed time has passed. But I had not considered an important aspect of deep sleep, which is that on waking up it starts all over. It’s probably plain that I am relatively new to all this, but what I learned about using interrupts was that they are supposed to communicate to the main code using volatile variables. That doesn’t work in the waking up scenario when it starts from a reset. So my question is, is there a way to determine that the device woke up due to an external interrupt and where it came from? I searched but I didn’t find an answer (or did but failed to realize it). Because if there isn’t, I will have to try my luck with system ON sleep. I already read the thread today and found that my battery pins mistake was actually discussed there.
Hi there,
So i think take a look at the Technical reference guide for the Nrf52 part. I’m sure it is addressed in there, the other is using the Flash memory to tell the boot count and if it is awake, Also there is a wakeup Stub that runs a certain setup stub when waking up, AFAIR
also, You wouldn’t know if the advertisement is seen or not too that way I would look for another method with a Notify or some feedback, that way you can maximize your sleep counter and not wake premature to being required to (sensor update or x?). if that makes sense
I read a couple of things at Nordic but I concluded that this is too advanced for me right now. I only started with an Arduino starter kit a bit more than a month ago and still lack the level of knowledge about what is going on “behind the scenes” to make sense of what I read there. Until I feel confident that there is a good chance of success making this work, I will use the system ON sleep! This gives me 22 µA while waiting and about 130µA for a second when advertising at the push of a button. That gives me about a year from a CR2032. Crazy! I may even add deep sleep after an inactivity period and use an initial button press as an on-switch and it will last years.
On the scanning end, I have deep sleep with ADXL345 wakeup (and a 18650 battery so power is not really a huge concern). This has become obselete because my ADXL345 board needs 60µA, so I would be better off with system ON sleep. At least I learned something while developing it!
About the BLE, the beacon worked in testing. I can revisit more elaborate communication if I turns out to be unreliable in practice. I already have done it before using notify in code that I derived from the custom_hrm example. I will revisit that if I am not satisfied with the performance regarding a quick succession of button events. But first, onto the next problem. I have two buttons working, but I might like to have three and there’s only two straightforward interrupt pins. After this I draw a line!