On/off?

Posted on
  • Hi @Gordon -- I'd like to be able to turn the puck off programmatically and have the BTN wake up espruino. The sleep functions seem to stay at about 400-500 uA, and I'd like to have more shelf life and shipping time, so it would be great to put it into a zero power state.

    Any thoughts? Enhancement request?

    Thanks!
    Bill

  • Hi Bill,

    Where are you getting your power consumption figures from? On http://www.espruino.com/Puck.js#power-co­nsumption the figure I measured for advertising off and watching the button for a press was 12uA - so that's around 2 years of battery life (and that figure should have improved with newer firmwares).

    ... or if you're not actively watching the button input with setWatch (eg, just checking it every 30 seconds), it's 3uA, which is realistically the shelf life of the battery.

    I don't think the power off state you're after is actually possible - since even if the CPU were off, the GPIO for responding to button presses stuff draws some power. Also, the box isn't sturdy enough to stop the button being pressed in transit, so you'd need some way of making sure that it only powered up when the button was pressed intentionally.

  • Just to add that if you're shipping, leaving the tag in the battery would be ideal - you could program the device using Pogo pins from the top, and not even have to remove it from the packaging - which would obviously save you a bunch of time.

  • Hi Gordon,
    The numbers came from the Nordic Power Profiler. I’m running the 52830 dev board and v1.94 with a .js application. I suppose it could be some leakage from switches/LEDs, but I think they're designed correctly on that board for the inactive state to be zero current.

    I was wondering about the sd_power_system_off() function, while the device is not OFF when you put it in system off mode, it is put in a low power/deep sleep state, where it can only be awaken by reset, GPIO, NFC field or LPCOMP module (for example, the BTN switch).

    Is this do-able, or is this what you’re already doing with the nrf.sleep function?

    Thanks!
    Bill

  • @Gordon -- just realized it may be that it is still advertising. What is the best way to disable advertising?

    Bill

  • I think you'll find that the LPCOMP module itself draws more power than the CPU does when in sleep mode. 400uA is definitely on the high side, but it's probably because the nRF52DK keeps the serial port on all the time - which draws loads of power. Puck.js doesn't do that unless it's started while connected to a serial port (or serial is manually initialised).

    However it sounds suspiciously like you're developing a custom device, and are trying to get me to offer free help by pretending that you're using a Puck.js device? If that's the case, I can offer consultancy work to help you out - but it's not reasonable to expect me to help you to design your product for free, if you have no intention of buying Espruino boards.

    What is the best way to disable advertising?

    NRF.sleep()

  • Hi @Gordon,
    The app runs on puck-js and/or ruuvitag. I'm using the nRF52DK (loaded with the espruino 1v94 build) because Nordic's profiling provides good/accurate measures. I hope to eventually turn the application into embedded code, but am using espruino as a proof of concept. So far, it is working well enough that it can take us a long way (thank you!).
    The DK itself doesn't keep the serial port on unless that build of espruino is different, but you've definitely given me another area to look at. If I add

    Serial1.setConsole(false)
    

    to my code, will that turn off the oscillator? I'll also take another look at how that port is wired up.
    I've also discovered that I may not have configured a jumper correctly and may have an additional diode of leakage from the boards.

    Tricky stuff, measuring current in these small amounts.

    I totally understand and respect the consulting issue; I consult as well. Definitely push back if I cross that boundary. Right now I'm just trying to figure out how to get a better feel for power consumption than I could by wiring up a puck-js device. The better I can get the power consumption numbers, the more devices we will buy before we need to go to embedded code.

    We've purchased quite a few devices and I personally/professionally recommend all of the espruino devices quite often. I'm a big fan & supporter.

  • Ahh, ok. As I remember, it works like Puck.js - but since the UART pins are always powered it always initialises the UART.

    Serial1.setConsole(false) won't do what you expect, but you should be able to disable the UART by just using digitalRead(..) on the 2 UART pins to swap them away from being UART pins to normal GPIO.

    Measuring the power usage is always a pain. I tend to use an oscilloscope to measure the voltage drop across a known resistance (some can even average readings to give you a good idea of average consumption) - but there must be a better tool for the job - I'll have to try the Nordic Profiler out.

    Great news about the development - I just saw the puckyActive post mentioned you as well :) I'm actually totally happy for anyone to use Espruino on their own devices in production too - it is Open Source after all. It's just making sure I spend my time helping users of Espruino boards, or doing stuff that will lead to more people buying them :)

  • Use an Espruino instead of an oscilloscope! I run the Web IDE on my computer and the application what @AkosLukacs made on my tablet. It helped me a lot!
    The Espruino INA226 project: https://www.hackster.io/akos-lukacs/blen­ergygraphs-7e7b9c

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

On/off?

Posted by Avatar for billsalt @billsalt

Actions