Sleep modes

Posted on
  • Is there already guidance on how to put the puck.js in deep sleep and wake up on intervals? Is it as simple as using the NRF.sleep()?

  • You don't have to do anything at all. Unlike the other Espruino boards it's always sleeping as much as it can.

    NRF.sleep() totally turns off bluetooth, which you probably don't want :)

    Only real guidance is make sure you don't keep pins set to use the hardware UART or PWM, as they use the full speed clock and so force it to stay on when active.

  • Sweeeeet!!

  • Hi Gordon,

    NRF.sleep() totally turns off bluetooth, which you probably don't want :)

    This is exactly what i've tried to do to save some battery capacity.
    Unfortunately the Puck doesn't show up again after NFR.wake()
    Do I have to do anything else after enabling bluetooth again?
    Do I have to setup advertisements using NRF.setServices / NRF.setAdvertising?

    Greets pk910

    Edit:

    NRF.setServices({},{uart:true});
    

    just after NRF.wake() fixed it :)

  • That's a strange one - do you have any other code in there that could have been causing problems?

    NRF.wake() should really be enough to get it advertising again after sleep turned it off

    edit: You'll need to be using a recent firmware though - 1v88 could cause you problems

  • Hi Gordon,

    For my part I don' t manage to get under 290uA...
    For example, if I reset the Puck and take the measurements (so with no code flashed in the puck and no computer connected), it stays at 292uA with some oscillations at 418uA.

    My measurements are taken with a small amperemeter. It connects the negative pole of the battery to the ground of the circuit. (A piece of plastic separates them, so the ciruit is off if my amperemeter is off).

    Any idea ?


    1 Attachment

    • Puckmesurment.jpg
  • After a hard reset I get ±32uA. I don't know why current intensity was so high the first time.

    I manage to get ±25 uA with stopping BLE. I flashed the puck with this simple code :

    setTimeout(function(){
      NRF.sleep();
    },20000);
    

    It's far better but I still don't understand how I can get less than 5uA.
    I have a Reed Switch on a pin. Can it be leaking ?

  • Do you have up to date firmware?

    Do you have any pullup/pulldown on the reed switch pin? If the reed switch is normally closed that'd obviously cause power draw, but if it's normally open and there's no pullup then any electrical noise on the pin (or any other pins set as inputs) could cause activity inside the nRF52 which draws more power.

    ... but also if you look at http://www.espruino.com/Puck.js#power-co­nsumption unfortunately just adding a watch to a pin to check its state can add around 10uA of power consumption.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Sleep modes

Posted by Avatar for gnz @gnz

Actions