Idea: an "upkeep" sensor type


  • Plugin Developer

    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.


  • Plugin Developer

    @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 😉


  • Plugin Developer

    @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.


  • Plugin Developer

    @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"?


  • Plugin Developer

    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.



  • ok, so I understant that You wan't to use sleep functionality after all. You just wan't additionally to be able to cut off the power totally. So I see couple of problems with that:

    1. You will not be able to precisely keep track of the window state, unless you will send KEEPUP messages every couple of seconds which will make your node more power hungry.
    2. Be aware of battery self discharge. According to wikipedia the 9v alkaline battery will self discharge after 5 years. And it is very easy to make a window sensor that will last 5 years. So I do not see any benefit here.

    If you realy want to add power cutoff to your design I would suggest to add some large capacitors that will hold the charge long enough after power cutoff to send an "off" message to the controller.



  • This can be achievable by using a TLP5110, this device is only consuming (sipping) 35nA. and then the comment from rozpruwacz is very valid, that you need to be careful of battery self discharging

    The you can use a switch to wakup the MCU when window is opened, and provide a resister value to TPL5110 to startup MCU once per day, to give a heartbeat signal that sensor is alive
    http://www.ti.com/lit/ds/symlink/tpl5110.pdf

    0_1542391196201_tpl5110.png


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts