7 years, 7 months ago.

kl25z low power

Hello,

I'm building a data logger that has to log Temperature and something with induction for at least one full week. It stores a few samples every 15 min. I have a custom PCB with the tiny 32-pin KL25Z, and (as the system has to be small) I'm using a small battery. After taking the samples I'm shutting down all periphery and use deepsleep() in combination with the WakeUp library to reach a 0.101 mA. This gives me a battery life of 6 days. I'm almost there!

#include "mbed.h"
#include "WakeUp.h"
  
int main() {
    WakeUp::calibrate();
   
    while(1) {
        // 1) wakeup all periphery

        // 2a) measure Temperature and Induction
        // 2b) write to SD card

        // 3) shutdown all periphery
        
        // Set wakeup time for 15 minutes
        WakeUp::set_ms( 15 * 60 * 1000 );
        deepsleep();
      }
}

Is this the lowest I can get or can it sleep even 'deeper', like in_a_coma()? It should be able to wake up from its coma every 15 min or when I push a button though. How can I reach all those magical settings to reach 2uA like this guy: https://mcuoneclipse.com/2013/10/20/tutorial-using-the-frdm-kl25z-as-low-power-board/ ?

Thank you very much,

Bob

Something seems not right here... Is this the full code that you're running on the board? deepsleep() should be able to get the KL25 to around 2-3 uA. It looks like there is something that prevents your board from going into proper deep sleep mode.

Related question here.

posted by Jan Jongboom 15 Sep 2016

Your comment made me wonder if I had properly turned off all periphery, and man I had it all wrong! First of all, I didn’t notice that the pc connection (SWD/UARTO) was powering the board too: when I disconnected that I had something way over 2 mA. So apparently I'm doing it wrong. I'm using the following function to power down every pin:

void shutdown_pin( PinName pin ) {
    DigitalOut *_pin = new Digitalout( pin ) ;
    _pin.write( 0 );
    delete _pin;
    _pin = null;
}

I do this for all SPI, I2C and SWD / UARTO pins and now got it down to 0.588 mA. I think I am doing something wrong with the pins having an external pull up resistor attached to it. Should it be _pin.write( 1 ) for those pins? How should I adjust my function? Thank you for your help!

posted by Bob Giesberts 16 Sep 2016

Ok, I'm back with about 99% certainty that everything on my board is shutdown. That is, all pins are either low or high and there is no voltage drop anywhere on my board. So now I now for sure that nothing is consuming energy and I got the current down to 0.350 mA. I've read that the normal consumption rate of the KL25Z in deepsleep mode would be around 2 uA. Is there anyway to check whether or not I actually got my KL25Z properly in deepsleep mode or if it's indeed prevented by something else? Thanks for your help!

posted by Bob Giesberts 21 Sep 2016

Anyone who can tell me how I can check in which power mode my chip is? Any advice is appreciated!

posted by Bob Giesberts 29 Sep 2016
Be the first to answer this question.