Support for wake up by Timer2 instead of WD



  • Hi all,

    Before coming to MySensors I've been experimenting with waking up my sketches from the atmega328p Timer2, clocked from a 32KHz crystal, instead of waking up from the watchdog timer. This reduces the MCU power consumption from about 4uA to about 1uA while "sleeping". As a result battery life of (coin cell powered) sensor nodes is substantially increased. For example the battery life for a Sensebender Micro, powered from a CR2032, reporting temperture and humidity every minute would (theoretically) be more than doubled.

    Now I'm thinking of implementing support for this in MySensors. Regarding this I have some questions:

    • Are other people interested in this?
    • What would be the preferred way to implement this? I'm thinking of creating a new hardware type derived from the current MyHwATMega328.
    • Is there any chance of this being included in MySensors if implemented properly?

    Regards,

    Ewald


  • Hardware Contributor

    Even if this didn't get 'officially implimented' into the MySensors library, i'm very interested in this as i'm currently designing coincell powered light switch nodes.


  • Mod

    @ewasscher said:

    Are other people interested in this?

    Apparently yes

    What would be the preferred way to implement this? I'm thinking of creating a new hardware type derived from the current MyHwATMega328.

    Better not implement it this way, as your implementation is still just ATMega328 hardware based.
    How about e.g. passing an extra parameter to the sleep() method, which defaults to watchdog?

    Is there any chance of this being included in MySensors if implemented properly?

    Ofcourse. MySensors is a community effort, and any useful addition/bugfix can make it into the library.


 

300
Online

9.0k
Users

9.7k
Topics

101.4k
Posts