Idea: an "upkeep" sensor type



  • For simple window sensors I'd like to use MySensors devices that are normally powered off, and only come to life when the window is in it's open state. Using a magnet switch that toggles the power.

    It would be nice if the gateway could support this use case as follows:

    The node, when powered on, sends the gateway a periodic message that contains after which time it will send a new message. For example, every 3 minutes or every hour, or even a day. It could be flexible: start with a new message every minute, and after an hour switch to a message every half hour, etc.

    Here's the fun part. The gateway represents the device to its controller as a normal binary switch.

    If the node doesn't report back after the time it indicated it would, then the gateway understands the sensor has lost power, and toggles the switch back to off.

    The advantage of this is:

    • Very low power sensors, since they are essentially completely turned off most off the time.
    • Controllers don't need to implement a new MySensors type. To them it just looks like a normal binary switch.

  • Mod

    This post is deleted!

  • Mod

    @alowhum the disadvantage would be that the gateway would become a controller. There are currently no state-keeping tasks in a gateway. A MySensors gateway is 100% event-driven: when it receives a message, it responds appropriately. After the response the gateway waits for the next message. There is no state and no timers.

    In the current MySensors architecture, keeping track of state is the controller’s task.



  • @mfalkvidd Ah, I see. Thanks.

    Would it be something that I could "hack on"? For example, when a node sends an info message "KEEPUP 20000", then some user code running on the gateway Arduino could pick up on that and create a timer separate of the MySensors gateway code?


  • Mod

    @alowhum yes you could build a controller into the gateway. But most controllers already have similar features, with the benefit of a high level language and better debugging tools.



  • Wouldn't it be easier to connect the window switch to INT1 and use sleeping?

    int8_t sleep(int interrupt, int mode, unsigned long ms=0);
    int8_t smartSleep(int interrupt, int mode, unsigned long ms=0);
    

    I'd say the advantage of this is:

    Very low power sensors, since they are essentially completely turned off most off the time.
    Controllers don't need to implement a new MySensors type. To them it just looks like a normal binary switch 😉



  • @mfalkvidd But if I build it into the gateway, then it will work with all existing controllers. Otherwise I would have to get new code into all the different controllers.

    @frits, unfortunately not, as the project I'm working on is designed for beginners.

    For these sensors I will use the BBC Micro:bit, which has all kinds of sensors on board. So I suspect I can't really do what you ask. Or better put: I myself am not good enough at programming to create this.

    I could also use Arduino Nano's embedded in Nano Wireless Expansion Boards, which are great for beginners. But this means their base current is always 5Ma while powered, which would cost a lot of battery. The people I'm giving the workshops to might just be able to handle wiring those boards to a 9v battery.


  • Mod

    @alowhum yes, if the gateway could do everything controllers do, there would be no need for controllers.



  • @alowhum You say You are giving workshops to people and You don't have an idea on the topic ? Sorry for the language but this sounds ridiculous ... Handling of the interrupts is the most basic concept of the microcontrollers. Do not teach people doing stuff in the wrong way please. You want to change gateway controller and in the same time You say that You are "not good enough at programming". It sounds contradictory. To use sleeping node is much easier to do in comparison to changing the gateway code. I would even argue that doing what @frits suggested is easier than Your idea. Your idea is wrong in every possible way. For example, the power consumption in Your case will depend on the time the window is opened, so if someone prefer to have opened windows, then in his case the node will drain the battery pretty fast.
    I hope that You will not feel like I'm attacking You 🙂 I just want You push to the right direction.



  • @rozpruwacz Please don't make assumptions. All will be revealed in due time 🙂

    And for the hardware I'm using

    being turned off + sipping power when window is open

    uses less power than

    sipping power all the time



  • @alowhum yes, probably i just don't understand what you trying to do. What is "sipping"?



  • Sipping means "using very little". Like sipping water form a cup means taking a long time to finish the drink.

    And of course what you are saying is very true if you are trying to teach people real programming. The project I'm working on is not getting close to that though.


 

475
Online

7.9k
Users

8.7k
Topics

93.6k
Posts