Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. NodeManager
  4. NodeManager: plugin for a rapid development of battery-powered sensors

NodeManager: plugin for a rapid development of battery-powered sensors

Scheduled Pinned Locked Moved NodeManager
223 Posts 23 Posters 72.9k Views 26 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #27

    what's the point of querying node for battery status? Just put in the code to report it when battery level changes.

    1 Reply Last reply
    0
    • mar.conteM mar.conte

      @user2684
      a really interesting project, however I would use NodeManager to query each time the battery status of my pir sensor; I would like to know how I can send from domoticz commands to query my node !! thank you

      U Offline
      U Offline
      user2684
      Contest Winner
      wrote on last edited by
      #28

      @mar.conte if you want to query the battery level on-demand, you can by sending to NodeManager's service child id (by default 200) a REQ V_CUSTOM message with BATTERY as a payload.Of course the node must be awake to respond or the controller must support smart sleep. Or as @gohan says, just have the node reporting the battery level

      mar.conteM 1 Reply Last reply
      0
      • U user2684

        @mar.conte if you want to query the battery level on-demand, you can by sending to NodeManager's service child id (by default 200) a REQ V_CUSTOM message with BATTERY as a payload.Of course the node must be awake to respond or the controller must support smart sleep. Or as @gohan says, just have the node reporting the battery level

        mar.conteM Offline
        mar.conteM Offline
        mar.conte
        wrote on last edited by
        #29

        @user2684
        Tanks i try and report you
        By

        M.C.

        1 Reply Last reply
        0
        • rhaymoR Offline
          rhaymoR Offline
          rhaymo
          wrote on last edited by
          #30

          Hi,
          first of all, thanks to user2684 for his great job.
          I wonder if it would possible adding a feature in nodeManager, where after a wake up from interrupt, only the onLoop method of the sensor attached to that pin is executed. onLoop of sensors not attached to interrupt are executed only after a full sleep cycle. (of course, this requires that after a wakeup from interrupt, the node come to sleep only for (sleepTime - elapsedTimeBeforeWakeup) )

          In my case, I have a sketch for a node with a temperature and door sensor. Temperature is sent each 60 minutes, while door status only on interrupt.

          U 1 Reply Last reply
          0
          • rhaymoR rhaymo

            Hi,
            first of all, thanks to user2684 for his great job.
            I wonder if it would possible adding a feature in nodeManager, where after a wake up from interrupt, only the onLoop method of the sensor attached to that pin is executed. onLoop of sensors not attached to interrupt are executed only after a full sleep cycle. (of course, this requires that after a wakeup from interrupt, the node come to sleep only for (sleepTime - elapsedTimeBeforeWakeup) )

            In my case, I have a sketch for a node with a temperature and door sensor. Temperature is sent each 60 minutes, while door status only on interrupt.

            U Offline
            U Offline
            user2684
            Contest Winner
            wrote on last edited by
            #31

            @rhaymo you're right, combining sensors waking up from an interrupt and sensors reporting periodically does not work properly with NodeManager right now. I've opened this enhancement request: https://github.com/mysensors/NodeManager/issues/41.
            It may be not trivial to implement so it will not be part of the next release which is almost ready but I'll work on it just after since looks like a key requirement for many projects.
            Thanks!

            1 Reply Last reply
            0
            • U user2684

              Hi, being a newbie in this wonderful MySensors world, I found myself excited about the flexibility of the overall platform but also somehow implementing the same common functionalities across my sensors over and over again. I decided then to spend some reasonable amount of time to expand the idea behind MyExtention (https://forum.mysensors.org/topic/6062/myextension) into something I have called NodeManager (I know, I'm bad with names!).

              NodeManager is intended to take care on your behalf of all those common tasks a MySensors node has to accomplish, speeding up the development cycle of your projects. It should help who is new to MySensors to get up to speed quicker and for those already into the matter to delegate to NodeManager common and boring tasks so to focus on more interesting scenarios.

              NodeManager main features are:

              • Manage all the aspects of a sleeping cycle by leveraging smart sleep
              • Allow configuring the sleep mode and the sleep duration remotely
              • Allow waking up a sleeping node remotely at the end of a sleeping cycle
              • Allow powering on each connected sensor only while the node is awake to save battery
              • Report battery level periodically and automatically
              • Calculate battery level without requiring an additional pin and the resistors
              • Report battery voltage through a built-in sensor
              • Can report battery level on demand
              • Allow rebooting the board remotely
              • Provide out-of-the-box sensors personalities and automatically execute their main task at each cycle

              Specifically on this last point, the idea behind providing built-in the functionalities of most common sensors is to simplify the development especially for somebody new to it.
              E.g. if I connect a thermistor to one of the pin, I just need a single line to have it working, as it was leveraging some sort of embedded firmware:

              nodeManager.registerSensor(SENSOR_THERMISTOR,A2);
              

              The following built-in sensors are available:

              • SENSOR_ANALOG_INPUT Generic analog sensor, return a pin's analog value or its percentage
              • SENSOR_LDR LDR sensor, return the light level of an attached light resistor in percentage
              • SENSOR_THERMISTOR Thermistor sensor, return the temperature based on the attached thermistor
              • SENSOR_DIGITAL_INPUT Generic digital sensor, return a pin's digital value
              • SENSOR_DIGITAL_OUTPUT Generic digital output sensor, allows setting the digital output of a pin to the requested value
              • SENSOR_RELAY Relay sensor, allows activating the relay
              • SENSOR_LATCHING_RELAY Latching Relay sensor, allows activating the relay with a pulse
              • SENSOR_DHT11 DHT11 sensor, return temperature/humidity based on the attached DHT sensor
              • SENSOR_DHT22 DHT22 sensor, return temperature/humidity based on the attached DHT sensor
              • SENSOR_SHT21 SHT21 sensor, return temperature/humidity based on the attached SHT21 sensor
              • SENSOR_SWITCH Generic switch, wake up the board when a pin changes status
              • SENSOR_DOOR Door sensor, wake up the board and report when an attached magnetic sensor has been opened/closed
              • SENSOR_MOTION Motion sensor, wake up the board and report when an attached PIR has triggered
              • SENSOR_DS18B20 DS18B20 sensor, return the temperature based on the attached sensor

              I put the package on Sourceforce so to avoid leaving here piece of code which may become obsolete in a short time.

              The project is here: https://sourceforge.net/projects/mynodemanager
              I've also tried to document everything the best as I could on https://sourceforge.net/p/mynodemanager/wiki

              Thanks

              B Offline
              B Offline
              bilbolodz
              wrote on last edited by
              #32

              @user2684 Great plugin, thanks. Please: consider adding support for a more than one DS18B20 devices and fixed mapping sensor_id <-> DS18B20 id.

              U 1 Reply Last reply
              0
              • R Offline
                R Offline
                Robbie_
                wrote on last edited by Robbie_
                #33

                Hi User2684,

                As promised i took NodeManager for a spin. It functions well but i have an issue with powering a DHT22 from the digital pins. It just does not show any temp/hum. If i use the power from the battery it functions well.

                Any clue what this could be?

                I used setPowerPins6,7,10000 to be sure the DHT22 has enough time to start up. If i use my multimeter between pins 6,7 i see the voltage going to 3.something volts and to 0 when the 10000 miliseconds are gone.

                My config is as following;

                // before
                void before() {
                  // setup the serial port baud rate
                  Serial.begin(MY_BAUD_RATE);  
                  /*
                   * Register below your sensors
                  */
                  nodeManager.setSleep(SLEEP,1,MINUTES); 
                nodeManager.registerSensor(SENSOR_DHT22,3);
                nodeManager.setPowerPins(6,7,10000);
                  /*
                   * Register above your sensors
                  */
                  nodeManager.before();
                }
                B 1 Reply Last reply
                0
                • R Robbie_

                  Hi User2684,

                  As promised i took NodeManager for a spin. It functions well but i have an issue with powering a DHT22 from the digital pins. It just does not show any temp/hum. If i use the power from the battery it functions well.

                  Any clue what this could be?

                  I used setPowerPins6,7,10000 to be sure the DHT22 has enough time to start up. If i use my multimeter between pins 6,7 i see the voltage going to 3.something volts and to 0 when the 10000 miliseconds are gone.

                  My config is as following;

                  // before
                  void before() {
                    // setup the serial port baud rate
                    Serial.begin(MY_BAUD_RATE);  
                    /*
                     * Register below your sensors
                    */
                    nodeManager.setSleep(SLEEP,1,MINUTES); 
                  nodeManager.registerSensor(SENSOR_DHT22,3);
                  nodeManager.setPowerPins(6,7,10000);
                    /*
                     * Register above your sensors
                    */
                    nodeManager.before();
                  }
                  B Offline
                  B Offline
                  bilbolodz
                  wrote on last edited by
                  #34

                  @Robbie_ I've NOT checked anything but I think that probably better:

                  1. power up DHT
                  2. wait a little to "dht startup"
                  3. register sensor
                  R 1 Reply Last reply
                  0
                  • B bilbolodz

                    @Robbie_ I've NOT checked anything but I think that probably better:

                    1. power up DHT
                    2. wait a little to "dht startup"
                    3. register sensor
                    R Offline
                    R Offline
                    Robbie_
                    wrote on last edited by
                    #35

                    @bilbolodz
                    So like this?

                    nodeManager.setPowerPins(6,7,10000);
                    nodeManager.registerSensor(SENSOR_DHT22,3);
                    nodeManager.setSleep(SLEEP,1,MINUTES);

                    B 1 Reply Last reply
                    0
                    • R Robbie_

                      @bilbolodz
                      So like this?

                      nodeManager.setPowerPins(6,7,10000);
                      nodeManager.registerSensor(SENSOR_DHT22,3);
                      nodeManager.setSleep(SLEEP,1,MINUTES);

                      B Offline
                      B Offline
                      bilbolodz
                      wrote on last edited by
                      #36

                      @Robbie_ said in NodeManager: plugin for a rapid development of battery-powered sensors:
                      Try this:

                      nodeManager.setPowerPins(6,7,10000);
                      wait(10000);
                      nodeManager.registerSensor(SENSOR_DHT22,3);```
                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Robbie_
                        wrote on last edited by Robbie_
                        #37

                        @bilbolodz said in NodeManager: plugin for a rapid development of battery-powered sensors:

                        wait(10000);

                        Thanks for the fast reply! Still the same issue;

                        SEND D=0 I=200 C=0 T=48 S=STARTED I=0 F=0.00
                        14258 TSF:MSG:SEND,100-100-0-0,s=200,c=1,t=48,pt=0,l=7,sg=0,ft=0,st=OK:STARTED
                        14395 MCO:BGN:INIT OK,TSP=1
                        ON P=7
                        14426 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
                        14493 MCO:SLP:TPD
                        14512 MCO:SLP:WUP=-1
                        DHT I=1 T=nan
                        OFF P=7
                        SLEEP 60s
                        SEND D=0 I=200 C=1 T=48 S=SLEEPING I=0 F=0.00
                        
                        U 1 Reply Last reply
                        0
                        • B bilbolodz

                          @user2684 Great plugin, thanks. Please: consider adding support for a more than one DS18B20 devices and fixed mapping sensor_id <-> DS18B20 id.

                          U Offline
                          U Offline
                          user2684
                          Contest Winner
                          wrote on last edited by
                          #38

                          @bilbolodz multiple DS18B20 are supported indeed, when you register a DS18B20 sensor and provide the pin where multiple devices are attached, NodeManager will go through all of them (by calling getDeviceCount() of DallasTemperature) and will register each of them with a different child id. Is this what you were looking for?

                          B 1 Reply Last reply
                          0
                          • R Robbie_

                            @bilbolodz said in NodeManager: plugin for a rapid development of battery-powered sensors:

                            wait(10000);

                            Thanks for the fast reply! Still the same issue;

                            SEND D=0 I=200 C=0 T=48 S=STARTED I=0 F=0.00
                            14258 TSF:MSG:SEND,100-100-0-0,s=200,c=1,t=48,pt=0,l=7,sg=0,ft=0,st=OK:STARTED
                            14395 MCO:BGN:INIT OK,TSP=1
                            ON P=7
                            14426 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
                            14493 MCO:SLP:TPD
                            14512 MCO:SLP:WUP=-1
                            DHT I=1 T=nan
                            OFF P=7
                            SLEEP 60s
                            SEND D=0 I=200 C=1 T=48 S=SLEEPING I=0 F=0.00
                            
                            U Offline
                            U Offline
                            user2684
                            Contest Winner
                            wrote on last edited by
                            #39

                            Hi, @Robbie_ the order doesn't matter since all of this is happening inside before(), NodeManager just keeps track of all your settings without doing anything at that stage.

                            Your configuration looks correct to me, the DHT sensor attached to pin 3, pin 6 playing the role of ground, pin 7 the role of vcc and waiting for 10 seconds after powering on, before actually reading the value from the sensor. The log also tells the same story, pin 7 is turned on, then 10s of sleep and then the "nan" read which I cannot really understand (the code is very simple, just executes a digitalWrite(_vcc_pin, HIGH) at that stage).
                            Would you please ensure pin 7 is HIGH during the 10s sleep?

                            Not sure if it matters (and those more expert than me with a DHT sensor can confirm) but I've noticed that I call dht.begin() only once (during before()) and during loop() I just call readTemperature(). Does powering off the sensor have an impact on this? e.g. should I call begin() before every read?
                            Thanks

                            R 1 Reply Last reply
                            0
                            • gohanG Offline
                              gohanG Offline
                              gohan
                              Mod
                              wrote on last edited by
                              #40

                              I think you need to call the begin if you power off the sensor

                              U 1 Reply Last reply
                              0
                              • U user2684

                                @bilbolodz multiple DS18B20 are supported indeed, when you register a DS18B20 sensor and provide the pin where multiple devices are attached, NodeManager will go through all of them (by calling getDeviceCount() of DallasTemperature) and will register each of them with a different child id. Is this what you were looking for?

                                B Offline
                                B Offline
                                bilbolodz
                                wrote on last edited by
                                #41

                                @user2684 said in NodeManager: plugin for a rapid development of battery-powered sensors:

                                @bilbolodz multiple DS18B20 are supported indeed, when you register a DS18B20 sensor and provide the pin where multiple devices are attached, NodeManager will go through all of them (by calling getDeviceCount() of DallasTemperature) and will register each of them with a different child id. Is this what you were looking for?

                                Multiple sensors: great but for me important thing is "fixed" matching exact DS18B20 to particular child id. I'm going to monitor may two function water boiler and check input/output temperature. In case when one of the DS disappear (because of many reasons) after next nodemanager device startup assigning sensors to child id will change and it will be a great problem. That's why I'm asking for exact assigning DS id - child id. Is it clear now?

                                U 1 Reply Last reply
                                0
                                • gohanG gohan

                                  I think you need to call the begin if you power off the sensor

                                  U Offline
                                  U Offline
                                  user2684
                                  Contest Winner
                                  wrote on last edited by
                                  #42

                                  Thanks @gohan. @Robbie_ if you can then try copying that "_dht->begin();" you have in line 576 of NodeManager.cpp also at the beginning of "SensorDHT::onLoop()" which is just below we can see if this can help (unfortunately I don't have anymore a DHT sensor to test by myself).

                                  Another try would be to disable both MySensors and NodeManager debug: I've seen strange behaviors happening when approaching the dynamic memory limit (including this) and since objects are allocated dynamically, it could be the case (this issue is partially mitigated in the dev branch)

                                  1 Reply Last reply
                                  0
                                  • B bilbolodz

                                    @user2684 said in NodeManager: plugin for a rapid development of battery-powered sensors:

                                    @bilbolodz multiple DS18B20 are supported indeed, when you register a DS18B20 sensor and provide the pin where multiple devices are attached, NodeManager will go through all of them (by calling getDeviceCount() of DallasTemperature) and will register each of them with a different child id. Is this what you were looking for?

                                    Multiple sensors: great but for me important thing is "fixed" matching exact DS18B20 to particular child id. I'm going to monitor may two function water boiler and check input/output temperature. In case when one of the DS disappear (because of many reasons) after next nodemanager device startup assigning sensors to child id will change and it will be a great problem. That's why I'm asking for exact assigning DS id - child id. Is it clear now?

                                    U Offline
                                    U Offline
                                    user2684
                                    Contest Winner
                                    wrote on last edited by
                                    #43

                                    @bilbolodz I understand what you are saying. I've opened this: https://github.com/mysensors/NodeManager/issues/42. I did not consider this use case before because according to DallasTemperature documentation the attached sensors are always returned in the same order but you're right, if one of the sensor for any reason is not detected, it will mess up your logic. Thanks for reporting it.

                                    B V 2 Replies Last reply
                                    0
                                    • U user2684

                                      @bilbolodz I understand what you are saying. I've opened this: https://github.com/mysensors/NodeManager/issues/42. I did not consider this use case before because according to DallasTemperature documentation the attached sensors are always returned in the same order but you're right, if one of the sensor for any reason is not detected, it will mess up your logic. Thanks for reporting it.

                                      B Offline
                                      B Offline
                                      bilbolodz
                                      wrote on last edited by
                                      #44

                                      @user2684 Great, so I'm waiting for version 1.4. Any ideas about timeline?

                                      U 1 Reply Last reply
                                      0
                                      • U user2684

                                        @bilbolodz I understand what you are saying. I've opened this: https://github.com/mysensors/NodeManager/issues/42. I did not consider this use case before because according to DallasTemperature documentation the attached sensors are always returned in the same order but you're right, if one of the sensor for any reason is not detected, it will mess up your logic. Thanks for reporting it.

                                        V Offline
                                        V Offline
                                        vikasjee
                                        wrote on last edited by
                                        #45

                                        @user2684 This is exactly i had mentioned in my requirement for IOExpanded pins attached to any sensor or virtual buttons... getting the same child_id everytime. Hope its clear now...

                                        1 Reply Last reply
                                        0
                                        • U user2684

                                          Hi, @Robbie_ the order doesn't matter since all of this is happening inside before(), NodeManager just keeps track of all your settings without doing anything at that stage.

                                          Your configuration looks correct to me, the DHT sensor attached to pin 3, pin 6 playing the role of ground, pin 7 the role of vcc and waiting for 10 seconds after powering on, before actually reading the value from the sensor. The log also tells the same story, pin 7 is turned on, then 10s of sleep and then the "nan" read which I cannot really understand (the code is very simple, just executes a digitalWrite(_vcc_pin, HIGH) at that stage).
                                          Would you please ensure pin 7 is HIGH during the 10s sleep?

                                          Not sure if it matters (and those more expert than me with a DHT sensor can confirm) but I've noticed that I call dht.begin() only once (during before()) and during loop() I just call readTemperature(). Does powering off the sensor have an impact on this? e.g. should I call begin() before every read?
                                          Thanks

                                          R Offline
                                          R Offline
                                          Robbie_
                                          wrote on last edited by Robbie_
                                          #46

                                          @user2684 Thanks for your reply. Ive tested the following;

                                          i editted the NodeManager.cpp and added _dht->begin(); to the beginning of "SensorDHT::onLoop()"

                                          I also disabled both debug, still the same issue.

                                          In your other post you mentioned "Would you please ensure pin 7 is HIGH during the 10s sleep?"

                                          My log looks as following;

                                          PWR G=6 V=7
                                          REG I=1 P=3 P=6 T=0
                                          REG I=2 P=3 P=7 T=1
                                          NodeManager v1.30
                                          INT1 M=255
                                          INT2 M=255
                                          RADIO OK
                                          PRES I=200, T=23
                                          PRES I=201, T=30
                                          BATT V=3.26 P=94
                                          SEND D=0 I=201 C=0 T=38 S= I=0 F=3.26
                                          PRES I=1 T=6
                                          PRES I=2 T=7
                                          READY
                                          
                                          MY I=100 M=1
                                          SEND D=0 I=200 C=0 T=48 S=STARTED I=0 F=0.00
                                          ON P=7
                                          DHT I=1 T=nan
                                          OFF P=7
                                          SLEEP 60s
                                          SEND D=0 I=200 C=1 T=48 S=SLEEPING I=0 F=0.00
                                          
                                          AWAKE
                                          SEND D=0 I=200 C=1 T=48 S=AWAKE I=0 F=0.00
                                          ON P=7
                                          DHT I=1 T=nan
                                          OFF P=7
                                          SLEEP 60s
                                          SEND D=0 I=200 C=1 T=48 S=SLEEPING I=0 F=0.00
                                          

                                          Where do you want me to messure if the pin is on?

                                          AWAKE
                                          SEND D=0 I=200 C=1 T=48 S=AWAKE I=0 F=0.00
                                          ON P=7
                                          DHT I=1 T=nan
                                          <------------------------ I messured here and the voltage is 3.something volts
                                          OFF P=7
                                          SLEEP 60s
                                          <--------------------------- HERE?
                                          SEND D=0 I=200 C=1 T=48 S=SLEEPING I=0 F=0.00
                                          
                                          U 1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular