Power management

  • Besides setting the display brightness to 0 and setPowerFence(true), are there any other ways of saving power on Mono? I tinkering with a sensor app. Ideally in cases whenever the user isn't using the display, I would just want Mono to sleep and then wake up every 5 minutes to do some sensing, and then go back to sleep. That way I could make the battery last for a really long time.

  • Hi @allan

    Just to recap: When you activate the power fence (setPowerFence(true)), the 3V3 power is shut down - meaning these components loose power:

    • Display
    • Wireless module
    • SD Card
    • Temperature sensor
    • Accelerometer

    Only remaining power consumers are the CPU and power control IC. To limit power consumption further you could:

    Slow down the CPUs clock frequency

    Our Cypress MCU supports changing the main clock frequency - by routing different signals to the clock line. You can configure dividers to achieve the frequency of your needs. We predefine the frequency of 66 Mhz.

    The lowest (most power saving) clock frequency is the ILO or XTAL clock lines - allowing clock frequencies ranging from 1 - 100 kHz

    That said, I think the power saving effect would be limited - compared to the next approach.

    Sleep the CPU and wake on a hardware timer

    Mono framework defines sleep mode as a state where the CPU stops execution - but memory is preserved. The execution continues when either a internal hardware timer triggers (either a time wheel or the external crystal: XTAL) or when a input pin interrupt fires.

    Currently the framework does not setup any timer based wake up - Mono can only wake on pin interrupts. But you can certainly wake Mono on a timer, if you dig into the Cypress API's. Unfortunately their APIs are quite parse, so you need to manipulate registers directly. Include the header file:

    #ifdef __cplusplus
    extern "C" {
    #include <project.h> // this is the Cypress API defines
    #ifdef __cplusplus

    This gives you access to all PSOC5's register definitions and the get / set register functions. (See the Cypress system API docs)

    You need to configure a central time wheel or the fast time wheel. (See Cypress TRM)

    This time wheel will interrupt on timeout - and the CPU will wake up.

    Hope this helps you.

  • Hi @stoffera

    Thanks for the quick and very detailed answer! Lots for me to play with :)

    Do you have a guess at what the battery duration would be with the three different strategies (power fence, clock speed, and sleep mode)?


  • Hi @allan, here is a delayed reply with some rough estimates:

    • Power fenced (only 3V3 off): The MCU uses approx. 40 mA ( that is 8 h. battery at best)
    • Power fenced + slowed clock speed: MCU uses approx. 6mA (that is 60 h. battery at best)
    • Power fenced + sleep mode: Mono uses 40 µA in sleep (that is approx. 12 months of battery)

    I would recommend you use the sleep mode, and that wake on a timer at do the work with the default 66 Mhz clock speed. That should be the most effective - work hard, sleep hard :-)

Log in to reply