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


  • Contest Winner

    Hi, I've added a "How to contribute" section in the documentation of the dev release in case anybody is interested to contribute to this project: https://github.com/mysensors/NodeManager/tree/development#contributing.

    I'm not a git expert so I hope those instructions to have some sense 🙂


  • Contest Winner

    Pretty big enhancement in the development branch of NodeManager if anybody is interested. I spent quite a good amount of time working on the core code to introduce mainly two features opening up the door to a good list of enhancements.

    The first one is a sort of countdown utility. Can be based on the number of sleeping cycles or minutes. It detects automatically a sleeping node and instead of using millis sum up the sleep interval and reports when the time is over. This approach has been used to:

    • Allow different sensors reporting at different timeframes (e.g. by configuring a specific sensor to report every e.g. 5 minutes or 10 sleeping cycles instead of at the end of each cycle)
    • For output sensors optionally use the input value as an elapsed time (e.g. the output will be turned on and the input value will be used as a timer to turn it off automatically). For example by sending 3 to a relay, it will be turned on and after 3 minutes turned off automatically. Useful if you already know for how long the output should stay on.
    • For output sensors optionally set a safeguard (e.g. after a relay is set to on, turn it off automatically after 1 hour). Useful if e.g. you are controlling a boiler and you are afraid something could prevent the command to turn it off to reach the board.
    • Add timeframe option for reporting battery level (e.g. instead of reporting every 10 sleeping cycles, report every 1 hour regardless of how long is the sleeping cycles).

    The other big change is a an complete remote API. With the current version you could send to NodeManager's service child id a limited list of commands to change the behavior of the board remotely, mainly to alter the duration of the sleep cycle. In the development release instead, almost every function of both NodeManager AND of every sensor can be invoked remotely. This is done by sending a V_CUSTOM message with a function_id and optional value to pass along to the service child id or each sensor's child id. More details here: https://github.com/mysensors/NodeManager/tree/development#communicate-with-nodemanager-and-its-sensors

    This development branch is available here: https://github.com/mysensors/NodeManager/tree/development


  • Mod

    Do you think it may be possible to add the function to use a digital pin to power a PIR sensor to turn it on only when setting it armed? (to save a little power)



  • Why does the power manager use two pins to power the sensor? Could we just use one pin for Vcc, and assume that the GND is permanently connected?



  • But i'm trying to test a Pir of panasonic EKMB1201113 papirs series cost a bit but they have low power consumption
    1 to 100 microampers in sleep mode, just connect a 100 kohm resistance in pulldown and it is very precise up to 12 meters

    link text


  • Contest Winner

    @gohan interesting use case. I personally prefer to have the arm/disarm logic on the controller but I can understand there are also different situations. I've opened https://github.com/mysensors/NodeManager/issues/138 for this. Thanks for the suggestion!


  • Contest Winner

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

    Why does the power manager use two pins to power the sensor? Could we just use one pin for Vcc, and assume that the GND is permanently connected?

    I usually use the power pins when either I need to save power or I do not have vcc/gnd pins available on the arduino board. But yes, you're right, there are other scenarios to consider. I've opened https://github.com/mysensors/NodeManager/issues/139 for this. Thanks


  • Mod

    saving pins is always good 😄



  • Hello how can i enter the commands type 254; 200; 2; 0; 48; BATTERY in a lua script of domoticz?


  • Contest Winner

    @mar.conte said in NodeManager: plugin for a rapid development of battery-powered sensors:

    Hello how can i enter the commands type 254; 200; 2; 0; 48; BATTERY in a lua script of domoticz?

    Sorry, I don't use domoticz so I cannot help with that. I hope somebody else here will have an answer for you 🙂


  • Contest Winner

    Guys, @hek has been so kind to offer a dedicated section within the forum for NodeManager so feel free to open new topics directly under https://forum.mysensors.org/category/43/nodemanager. I hope this can facilitate new users to better find the answers they are looking for and you guys to follow the discussions in a smoother way without the need to jump here and there along the same long thread.


  • Contest Winner

    Hello All,
    I've just released on GitHub (https://github.com/mysensors/NodeManager) a hotfix (v1.5.1) for NodeManager in order to include the memory optimization improvements already part of the development version.
    This is to allow saving up to 20% of memory on a pro mini and prevent the board to crash or become unpredictable when approaching the memory limit. No new features or enhancements have been added to this hotfix.
    If instead interested in testing out the development version or contribute please refer to https://github.com/mysensors/NodeManager/tree/development and https://github.com/mysensors/NodeManager/milestone/7.
    Thanks


  • Contest Winner

    Hello, NodeManager's version 1.6 is almost ready. Plenty of new things and fixes are about to be available but I'd need some diverse testing before officially releasing it.

    The first step would be to ensure that what was working with the current version is still working with this new release 🙂

    All the new things are instead detailed here https://github.com/mysensors/NodeManager/issues?utf8=✓&q=milestone%3Av1.6 is%3Aclosed label%3Afixed and in the associated PRs.

    The code is available at https://github.com/mysensors/NodeManager/tree/development.

    Whoever is willing to give it a try, please report any issue directly on github whenever there is already an issue open or on https://forum.mysensors.org/topic/7266/nodemanager-v1-6-dev-comments-and-issues otherwise.

    Ideally I'm targeting mid August for releasing a stable v1.6.

    Many thanks!



  • @user2684
    Hello,
    I'm using NM for all my projects and I really like it!
    Will NodeManager support APDS-9960 RGB and Gesture Sensor in the future?

    Thanks


  • Contest Winner

    @Getz99 thanks for your feedback! I've created https://github.com/mysensors/NodeManager/issues/201 to track this request. Keep in mind no new features will be part of v1.6 which should be released soon so I've added this to the v1.7 backlog. Thanks



  • @user2684 Thanks! I understand it will not be in v1.6, I'm waiting for that release!


  • Contest Winner

    Hi, kind of the the last chance to share any feedback regarding NodeManager v1.6-dev which is almost ready and should be out in a week or two.

    Instructions on how to test the pre-release and report issues here: https://forum.mysensors.org/topic/6183/nodemanager-plugin-for-a-rapid-development-of-battery-powered-sensors/184

    Thanks!


  • Contest Winner

    Hello All,

    NodeManager v1.6 is finally available! Download and upgrade instructions can be found as always on https://github.com/mysensors/NodeManager

    First of all I want to thank everybody contributing to the project, especially those who have submitted pull requests to the repository.

    In v1.6 we have 36 out-of-the-box sensors as well as a good number fixes and enhancements. The most notable are for sure the capability to customize any sensor remotely through a brand new remote API and a more flexible and effective way to configure reporting intervals and sleep cycles:

    • Introduced new remote API to allow calling almost ALL NodeManager's and its sensors' functions remotely
    • Reporting interval configuration is now indipendent from the sleep cycle
    • Reporting interval can be customized per-sensor
    • All intervals (measure/battery reports) are now time-based
    • Added support for BMP280 temperature and pressure sensor
    • Added support for RS485 serial transport
    • Added support for TSL2561 light sensor
    • Added support for DHT21 temperature/humidity sensor
    • Added support for AM2320 temperature/humidity sensor
    • Added support for PT100 high temperature sensor
    • Added support for MH-Z19 CO2 sensor
    • Added support for analog rain and soil moisture sensors
    • Added support for generic dimmer sensor (PWM output)
    • Added support for power and water meter pulse sensors
    • Radio signal level (RSSI) is now reported automatically like the battery level
    • SensorRainGauge now supports sleep mode
    • SensorSwitch now supports awake mode
    • SensorLatchingRealy now handles automatically both on and off commands
    • SensorMQ now depends on its own module
    • Added safeguard (automatic off) to SensorDigitalOutput
    • Any sensor can now access all NodeManager's functions
    • DHT sensor now using MySensors' DHT library

    For those who have previously forked the repository, please ensure to merge the updated development branch first before submitting any new PR.

    Thanks!



  • @user2684

    Hi,

    thanks again for your great work!

    As I said, I will try to include my Chirp module into 1.7 via a github branch/fork. You wrote in your explanation of "contributing to the code", that it is not allowed, to change config.h. But how should I include the lines for the chirp sensor?
    And in wich way can the documentation be modified? (chirp sensor paramaters)

    Best regards

    Betonmoewe


  • Contest Winner

    @betonmoewe if I wrote that config.h cannot be changed, I wrote something wrong 🙂 You can change whatever of course, just keep changes to config.h and the main sketch to the minimum since those can only be upgraded manually and not just by replacing the files. To add a new sensor, have a look at one of the existing sensors. Documentation can be updated as well by changing the README file. Should you have any doubt or issue feel free to open a new thread on https://forum.mysensors.org/category/43/nodemanager. Thanks!



  • When do you plan to release V1.7 ?


  • Contest Winner

    @vikasjee realistically it will take a while unfortunately 😞 I'm now spending most of my little spare time on https://github.com/mysensors/NodeManager/pull/229 which is kind of difficult to fix. Only after I will go through the (long) list of fixes/requests queued for v1.7 🙂


  • Contest Winner

    @vikasjee FYI the blocking issue which was slowing down v1.7 development has been solved now (https://forum.mysensors.org/topic/6534/nodemanager/133). Still a long way to get there but at least a bit closer now 🙂
    Thanks



  • Hi @user2684
    Is it possible to add sensor MG996R Servo in V1.7? I know the list is long for fixes but it would be nice if you could squeeze it in.

    Thanks!


  • Contest Winner

    @getz99 I've added this feature request for this: https://github.com/mysensors/NodeManager/issues/253

    Thanks!



  • @user2684 Thanks, Very much appreciated!


  • Plugin Developer

    I grabbed the latest development branch tonight to try this out. I saved the NodeManager.ino as a new name and copied the NodeManagerLibrary.h and NodeManagerLibrary.ino files into the new folder. I enabled USE_DIGITAL_OUTPUT and added a SensorDigitalOutput and SensorRelay child in my sketch and tried to compile. Unfortunately I got these errors:

    In file included from ino:244:0:
    sketch/NodeManagerLibrary.h:549:27: error: 'SR_RX_RSSI' was not declared in this scope
         int _signal_command = SR_RX_RSSI;
                               ^
    /NodeManagerLibrary.ino: In member function 'virtual void SensorSignal::onLoop(Child*)':
    /NodeManagerLibrary.ino:741:45: error: 'signalReport_t' was not declared in this scope
       int16_t value = transportGetSignalReport((signalReport_t)_signal_command);
                                                 ^
    /NodeManagerLibrary.ino:741:75: error: 'transportGetSignalReport' was not declared in this scope
       int16_t value = transportGetSignalReport((signalReport_t)_signal_command);
                                                                               ^
    exit status 1
    Error compiling for board Arduino Nano.
    

    All seems to be related to signal reports but even if I disable signal reporting the errors still occur. Guessing I did something wrong so any ideas would be appreciated.

    Thanks!


  • Contest Winner

    @jsiddall thanks for this hit, the issue seems to be related to SR_RX_RSSI which is only available with 2.2.0-beta version of the MySensors library, not 2.1.1 which I guess you are using. Something which needs to be fixed on the NodeManager's side, I've opened https://github.com/mysensors/NodeManager/issues/256 for this. Thanks


  • Plugin Developer

    @user2684 Great, thanks for the quick response.

    UPDATE: Confirmed, all is good with MyS 2.2.0-rc2. Not sure what resolution you had in mind for issue #256 but a note in the installation section of this page:

    https://www.mysensors.org/download/node-manager

    ...stating the required version of MyS for both the stable and dev versions of NodeManager would probably have been enough to keep me out of trouble!

    Thanks again for NodeManager. It does everything I had been doing manually before, using pages of sketch, and shrinks it down to a few simple lines.


  • Contest Winner

    @jsiddall thanks, fixed in the development branch right now. Adding a compatibility table between NodeManager and the MySensors library version sounds like a good idea, I've added https://github.com/mysensors/NodeManager/issues/261 for this. Thanks again



  • GHi, the rfm95 is compatible with nodemanager?
    And the esp32 also?


  • Contest Winner

    @mar-conte everything supported by the core MySensors library is supported by NodeManager since using the same code behind the scene but I'll add some default defines in the main sketch to make this configuration easier (https://github.com/mysensors/NodeManager/issues/262). Thanks



  • @user2684
    Ok Tanks



  • I need help!!!
    I have e mcp23017 Matrix espander i/o in esp nodemecu board, the mcp receive state sensor from my system wired alarm(pir, sismic etc) ; this signal received i want send to my domoticz controller, is the sensor custom the solution? Can i present 16 input sensors from my node to my controller?
    Tanks


  • Contest Winner

    @mar-conte if using NodeManager, this is still not possible since mcp23017 is not supported by NodeManager yet. Thanks!



  • @user2684
    For example using text send if i receive state?


  • Contest Winner

    Hi, for anybody interested in giving the upcoming NodeManager v1.7 a try or share a feedback, please have a look at https://forum.mysensors.org/topic/9085/nodemanager-v1-7-beta-feedback-needed. Thanks!


  • Contest Winner

    Hi, the new version of NodeManager (v1.7) is now available! For those interested in having a look at the new features, supported sensors and capabilities, I've opened a dedicated thread on the forum here https://forum.mysensors.org/topic/9165/nodemanager-v1-7-now-available
    Thanks



  • @user2684 this project is awesome! Thank you for your work and efforts. Just one question: what exactly is needed for "built-in battery reporting" hardware-wise? is it really "built-in" or do i need additional wiring and resistors for battery reporting? (I'll want to power up my 3.3V Arduino Pro mini with 2 AA cells)


  • Mod

    since you are using 2AA batteries it can report voltage directly, in case you had any voltage regulator or booster it would require external resistors



  • Thank you very much. BTW: Is it possible to use Nodemanager with two, three or even four door sensors on a single ESP8266 (as Gateway without NRF radio)? Any help very appreciated!


  • Contest Winner

    @grau the current door sensor implementation (SensorDoor class) leverages attachInterrupt(); not sure how many interrupt pins are there on a ESP8266 but if there are enough it should work



  • @user2684 Hello all of You,
    this topic is quite old, but hopefully someone is reading this.
    I could not figure out, what to do if the NRF24 is wired to different pins.
    I have a board with nrf24 on board, but this are connected like:
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    #define MY_RF24_CE_PIN 7
    #define MY_RF24_CS_PIN 10
    #define MY_SOFT_SPI_SCK_PIN 11
    #define MY_SOFT_SPI_MOSI_PIN 12
    #define MY_SOFT_SPI_MISO_PIN 13
    How can this be inplemented in the nodemanager?


  • Contest Winner

    @rpunkt just use those directives in your sketch, no differences with NodeManager, those will be seen by the MySensors library and applied. Thanks



  • @user2684 Thanks a lot. I should have tried this, before to post a question, but sometimes the brain is sticky.



  • Hello all of You,
    if have a flight time sensor VL53L0X, that is running so far.
    It should measure the water level in a rain tank.
    But now i want to customize my sensornode in that way, that two other values will be transmitted.
    It should be
    V_level, that represents the percentage of my water tank
    and
    V_volume, that represents the available volume of water
    V_level and V_volume could be calculated from the sensor value of the distance sensor (VL53L0X).
    But somehow I could not manage to to get this running. I don't know where to insert what.
    Cant someone point me to the right direction, help appreciated

    /*
    * The MySensors Arduino library handles the wireless radio link and protocol
    * between your home built sensors/actuators and HA controller of choice.
    * The sensors forms a self healing radio network with optional repeaters. Each
    * repeater and gateway builds a routing tables in EEPROM which keeps track of the
    * network topology allowing messages to be routed to nodes.
    *
    * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
    * Copyright (C) 2013-2017 Sensnology AB
    * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    *
    * Documentation: http://www.mysensors.org
    * Support Forum: http://forum.mysensors.org
    *
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License
    * version 2 as published by the Free Software Foundation.
    */
    
    /**************************
    Template
    
    This sketch can be used as a template since containing the most relevant MySensors library configuration settings, 
    NodeManager's settings, all its the supported sensors commented out and a sketch structure fully functional to operate with
    NodeManager. Just uncomment the settings you need and the sensors you want to add and configure the sensors in before()
    */
    
    /**********************************
     * MySensors node configuration
     */
    
    // General settings
    #define SKETCH_NAME "NodeManager"
    #define SKETCH_VERSION "1.0"
    //#define MY_DEBUG
    #define MY_NODE_ID 8
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    #define MY_RF24_CE_PIN 7
    #define MY_RF24_CS_PIN 10
    #define MY_SOFT_SPI_SCK_PIN 11
    #define MY_SOFT_SPI_MOSI_PIN 12
    #define MY_SOFT_SPI_MISO_PIN 13
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    #define MY_SPLASH_SCREEN_DISABLED
    
    /**********************************
     * MySensors gateway configuration
     */
     
    // Common gateway settings
    //#define MY_REPEATER_FEATURE
    
    /***********************************
     * NodeManager configuration
     */
    
    #define NODEMANAGER_DEBUG ON
    #define NODEMANAGER_INTERRUPTS ON
    #define NODEMANAGER_SLEEP ON
    #define NODEMANAGER_RECEIVE OFF
    #define NODEMANAGER_DEBUG_VERBOSE OFF
    #define NODEMANAGER_POWER_MANAGER ON
    #define NODEMANAGER_CONDITIONAL_REPORT OFF
    #define NODEMANAGER_EEPROM OFF
    #define NODEMANAGER_TIME OFF
    #define NODEMANAGER_RTC OFF
    #define NODEMANAGER_SD OFF
    #define NODEMANAGER_HOOKING OFF
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_SERIAL_INPUT OFF
    
    // import NodeManager library (a nodeManager object will be then made available)
    #include <MySensors_NodeManager.h>
    
    /***********************************
     * Add your sensors
     */
    
    //PowerManager power(5,6);
     
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    //#include <sensors/SensorConfiguration.h>
    //SensorConfiguration configuration;
    
    #include <sensors/SensorSignal.h>
    SensorSignal signal;
    
    #include <sensors/SensorVL53L0X.h>
    SensorVL53L0X vl53l0x(9);
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
    	
      /***********************************
       * Configure your sensors
       */
      // 
      // EXAMPLES:
      // report measures of every attached sensors every 10 seconds
      nodeManager.setReportIntervalSeconds(10);
      void setADCOff();
      nodeManager.setSleepSeconds(10);
      // call NodeManager before routine
      nodeManager.before();
      }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif```

  • Contest Winner

    @rpunkt my recommendation would be to create a custom sensor in NodeManager which is implementing the logic you like. Feel free to copy from https://github.com/mysensors/NodeManager/blob/master/sensors/SensorVL53L0X.h and create your own or make your own class by inheriting directly from SensorVL53L0X.



  • @user2684 Seems to be to difficult for a rookie 😭
    On the conventional MySensors library it is possible with my abilities, but then the power management is a issue.
    For me the NodeManager was the choice, because it saves so much battery energy.
    Other way of solution:
    A friend of mine, convinced me off doing all the calculations in the home- automation (in my case FHEM).
    Now I only use the node transmitting the distance and calculating the "volume of water" and "percentage of water" as a "user reading".



  • Hello @user2684 et al,

    I'm trying to use this library on an ESP32 board. I'm trying this sketch out (https://raw.githubusercontent.com/mysensors/NodeManager/master/examples/AnalogLightAndTemperatureSensor/AnalogLightAndTemperatureSensor.ino)

    My problem is that if I just try to use the 1.8 version of NodeManager it will use as a dependency a version of MySensors which do not work with ESP32 and I get a known error regarding re-definition of app_main. Because of that I need to use the development version of MySensors but it seems not compatible with NodeManager 1.8 as I get the following error:

    In file included from .pio/libdeps/nodemcu-32s/MySensors/MySensors.h:43:0,
                     from .pio/libdeps/nodemcu-32s/NodeManager/MySensors_NodeManager.h:43,
                     from src\main.cpp:60:
    .pio/libdeps/nodemcu-32s/MySensors/MyConfig.h:288:2: warning: #warning MY_RADIO_NRF24 is deprecated, use MY_RADIO_RF24 instead. [-Wcpp]
     #warning MY_RADIO_NRF24 is deprecated, use MY_RADIO_RF24 instead.
      ^
    In file included from .pio/libdeps/nodemcu-32s/NodeManager/MySensors_NodeManager.h:87:0,
                     from src\main.cpp:60:
    .pio/libdeps/nodemcu-32s/NodeManager/nodemanager/Sensor.cpp: In member function 'void Sensor::presentation()':
    .pio/libdeps/nodemcu-32s/NodeManager/nodemanager/Sensor.cpp:135:54: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'mysensors_sensor_t' [-fpermissive]
       present(child->getChildId(), child->getPresentation(), child->getDescription(), nodeManager.getAck());
                                                          ^
    In file included from .pio/libdeps/nodemcu-32s/MySensors/MySensors.h:433:0,
                     from .pio/libdeps/nodemcu-32s/NodeManager/MySensors_NodeManager.h:43,
                     from src\main.cpp:60:
    .pio/libdeps/nodemcu-32s/MySensors/core/MySensorsCore.cpp:375:6: note:   initializing argument 2 of 'bool present(uint8_t, mysensors_sensor_t, const char*, bool)'   
     bool present(const uint8_t childSensorId, const mysensors_sensor_t sensorType,
          ^
    *** [.pio\build\nodemcu-32s\src\main.cpp.o] Error 1
    

    I have also tried using the development version of NodeManager with the development version of MySensors although I get the same result.
    I'm stuck and I would really appreciate any input.

    Thanks in advance!


  • Contest Winner

    @justfra thanks for reporting this issue, I believe there is some sort of library conflicts which is arising across MySensors/Nodemanager versions...something which has to be investigated carefully, I'll track this bug with https://github.com/mysensors/NodeManager/issues/491



  • Oh, I hate saying I've noticed this great piece of software just now! 😞 It would have saved me countless hours of software tinkering, giving more eyecare for better soldering...!


  • Contest Winner

    @justfra realizing only now the issue you reported was not ESP32 related but due to a compatibility issues between MySensors v2.3.2 and NodeManager just fixed in the development version with https://github.com/mysensors/NodeManager/pull/508. Either try the latest development version of NodeManager or use MySensors v2.3.1. Thanks


Log in to reply
 

Suggested Topics

  • 2
  • 1
  • 1
  • 4
  • 2
  • 2

54
Online

11.4k
Users

11.1k
Topics

112.7k
Posts