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


  • Mod

    use a multimeter and check if pin 7 during the startup of the arduino and see if you get 5v out for 10 seconds


  • Contest Winner

    @bilbolodz v1.4 is actually ready, just want to see if the DHT issue discussed here requires a code fix or not before releasing but it is already available in the dev branch (https://github.com/mysensors/NodeManager/tree/8280de908929a117287a70e73cd047f50ab9a5bb). Let me explain the way I have implemented it because may look cumbersome but I didn't want to make exceptions and have a sensor configured in a different way the all the others.
    First of all, for any sensor, the child id can be manually assigned by providing a third argument to registerSensor(), e.g. to assign child id 5:

    nodeManager.registerSensor(SENSOR_THERMISTOR,A1,5);
    

    This was available also in v1.3 but not very clear from the docs. Of course this approach does not work when you have multiple DS18B20 sensors attached since they are all configured with a single line.
    So I have implemented a renameSensor() function which basically assign a different child id, e.g. to give the sensor with child id 1 the child id 5:

    nodeManager.renameSensor(1,5);
    

    This is available for all the sensors. So in the case of multiple DS18B20 you need to register them all in the usual way ( registerSensor(SENSOR_DS18B20,pin)) then assign the child id you like just after so in case one is lost, you still have a static mapping. The alternative would have been to provide a special registerSensor only for DS18B20 which I don't like that much. Any other better alternative of course is more than welcome!

    Btw, I have also added for DS18B20 getDeviceAddress() - in case you want to assign the child id based on the device address, getResolution() and setResolution()


  • Contest Winner

    @Robbie_ even if unfortunately I do not have a spare DHT sensor to test right now, I did some tests with other sensors trying to understand the issue. My educated guess it that the problem is related to the fact that setPowerPins() set both ground and vcc but initialize both to LOW. This means that when you register the sensor (and the DHT library is initialized), the sensor is off. This behavior will be changed in v1.4 (vcc wil be set to high). What you can do with the version you are currently running is to call nodeManager.powerOn() just after the call to setPowerPins() and before registering the sensor so to keep the power on.

    If this does not work, try calling nodeManager.setAutoPowerPins(false) after setPowerPins(): this prevent nodeManager to turn the power off which is not what you want but can help in isolating the issue.
    Thanks!



  • Hello, good work !!! I'll be trying your extension very soon....

    Quick question: is it compatible with ATMEGA chips flashed with MYSBootloader pre-1.3a ?


  • Contest Winner

    @luizrrocha I did not test it by myself but the bootloader used should have no impact on the code (unless you need to call different/specific functions with that bootloader but I guess this is not the case).



  • @user2684 Ive tested this morning a DHT22 without resistor between VIN & DATA, now it works correct. I reverted the changes back and just use the default code (1.3), everything keeps functioning. I don't understand why it works but hey, i got data! 🙂

    Somehow the following issue pops up with domoticz (also before the DHT22 was working), im not sure if anybody can help me here with it, else il open a threat at the domoticz forum. As soon ase NodeManager presents itself (via ESP8266 WiFi Gateway // MyS v2.1.0) to domoticz, domoticz goes offline. Does somebody else had the same experiance?



  • This post is deleted!


  • @Robbie_ Narrowed down the issue with domoticz, if i #define SERVICE_MESSAGES 1 in config.h domoticz crashes, if i put it back to 0 it stays online.


  • Contest Winner

    @Robbie_ glad to see it is working now! It has been still a good excuse for me to review and correct the logic of the power pins. Regarding SERVICE_MESSAGES, NodeManager sends a set of V_CUSTOM, SET messages from its service child id 200. When starts, it sends a STARTED payload , when going to sleep SLEEPING and when out of sleep AWAKE. I'm not familiar with domoticz but the service child id is presented correctly as S_CUSTOM, maybe the controller does not expect or handle a string payload. However, if you disable SERVICE_MESSAGES, this has no impact on the way NodeManager works, it just does not send those messages but if you are not using them, you are ready to go.
    In future versions I should probably even disable SERVICE_MESSAGES by default also because I expect it costs in terms of battery to send string payloads...


  • Contest Winner

    Hi, v1.4 is out and available at https://github.com/mysensors/NodeManager:

    • Added support for ML8511 UV intensity sensor
    • Added support for MQ air quality sensor
    • Added ability to manually assign a child id to a sensor
    • Ensured compatibility for non-sleeping nodes
    • Ability to control if waking up from an interrupt counts for a battery level report
    • When power pins are set the sensor is powered on just after
    • Service messages are disabled by default
    • Bug fixes

    Full changelog at https://github.com/mysensors/NodeManager/milestone/4?closed=1
    Thanks!



  • Hello,
    I am trying to sketch a simple PIR motion as an example the official NodeManager but does not appear to me the pir of domoticz
    DOMOTICZ OUTPUT

    1	S_TEMP		#1. V_TEMP (56.5)	true	1200	2017-04-09 12:11:15
    200	S_CUSTOM			true	1200	2017-04-09 11:34:45
    201	S_MULTIMETER			true	1200	2017-04-09 12:11:15
    255	S_ARDUINO_NODE	2.1.1```
    
    

    SKETCH

    /*
    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.
    
    NodeManager includes the following main components:
    - Sleep manager: allows managing automatically the complexity behind battery-powered sensors spending most of their time sleeping
    - Power manager: allows powering on your sensors only while the node is awake
    - Battery manager: provides common functionalities to read and report the battery level
    - Remote configuration: allows configuring remotely the node without the need to have physical access to it
    - Built-in personalities: for the most common sensors, provide embedded code so to allow their configuration with a single line 
    
    Documentation available on: https://mynodemanager.sourceforge.io 
     */
    
     
    // load user settings
    #include "config.h"
    // load MySensors library
    #include <MySensors.h>
    // load NodeManager library
    #include "NodeManager.h"
    
    // create a NodeManager instance
    NodeManager nodeManager;
    
    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);  
      /*
       * Register below your sensors
      */
      nodeManager.setSleep(SLEEP,60,MINUTES); 
      nodeManager.registerSensor(SENSOR_MOTION,3);
    
      /*
       * Register above your sensors
      */
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // Send the sketch version information to the gateway and Controller
    	sendSketchInfo(SKETCH_NAME,SKETCH_VERSION);
      // call NodeManager presentation routine
      nodeManager.presentation();
    
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    
    }
    
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    


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

    This is available for all the sensors. So in the case of multiple DS18B20 you need to register them all in the usual way ( registerSensor(SENSOR_DS18B20,pin)) then assign the child id you like just after so in case one is lost, you still have a static mapping. The alternative would have been to provide a special registerSensor only for DS18B20 which I don't like that much. Any other better alternative of course is more than welcome!

    Thanks for support but actually in case of multiple DS18B20 your "general solution" is not very useful..... It require manual checking ID (first it IDs need to bs stored in EEPROM) renaming child id sensor in case of change and so on. In my private opinion it could be better add special registerSensor() function which takes pin and DS18B20 ID and register sensor (or not). Please consider these.


  • Mod

    @mar.conte please include node log and gateway log when node tries to connect



  • Needles to say and re-say this is really a much needed plugin for us beginners!

    Made a bunch of battery operating nodes with only DHT22 and all are working flawlessly.

    Today I tried making a node using a DS18B20 and DHT22. DS18B20 connected to digital pin 3 and DHT22 to digital pin 4. Both sensors have 10K resistors between their vcc and data lines (tried without resistors but none of the sensors worked).

    Sketch compiles and uploads fine to a Arduino Pro Mini 328 3.3v 8MHz. It also connects to the gateway, but I run into some problems;

    The first one being that watching from the serial debug, the node strarts up, connects to the gateway, reports some data and then hangs. No more activity from the node watching on the serial debug.

    The second one is that the node never sleeps - Activity led on Arduino Pro Mini remains lit.

    The last one is that DS18B20 reports the Temp to the gateway but DHT22 reports only Temp and not the Humidity. Tried changing pins for the sensors, but the same.

    Connection logs (from the serial interface) are as follows:

    REG I=1 P=3 P=6 T=0
    REG I=2 P=4 P=6 T=0
    REG I=3 P=4 P=7 T=1
    NodeManager v1.4
    INT1 M=255
    INT2 M=255
    RADIO OK
    PRES I=200, T=23
    PRES I=201, T=30
    BATT V=3.44 P=100
    SEND D=0 I=201 C=0 T=38 S= I=0 F=3.44
    PRES I=1 T=6
    PRES I=2 T=6
    PRES I=3 T=7
    READY
    
    MY I=199 M=1
    DS18B20 I=1 T=47.75
    SEND D=0 I=1 C=0 T=0 S= N=0 F=47.75
    DHT I=2 T=25.00
    SEND D=0 I=2 C=0 T=0 S= N=0 F=25.00
    

    And the sketch I use is as follows:

    /*
    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.
    
    NodeManager includes the following main components:
    - Sleep manager: allows managing automatically the complexity behind battery-powered sensors spending most of their time sleeping
    - Power manager: allows powering on your sensors only while the node is awake
    - Battery manager: provides common functionalities to read and report the battery level
    - Remote configuration: allows configuring remotely the node without the need to have physical access to it
    - Built-in personalities: for the most common sensors, provide embedded code so to allow their configuration with a single line 
    
    Documentation available on: https://github.com/mysensors/NodeManager
     */
    
     
    // load user settings
    #include "config.h"
    // load MySensors library
    #include <MySensors.h>
    // load NodeManager library
    #include "NodeManager.h"
    
    // create a NodeManager instance
    NodeManager nodeManager;
    
    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);  
      /*
       * Register below your sensors
      */
    
        nodeManager.setBatteryMin(2.0);
        nodeManager.setBatteryMax(3.3);
        nodeManager.setSleep(SLEEP,60,SECONDS);
        nodeManager.registerSensor(SENSOR_DS18B20,3);
        nodeManager.registerSensor(SENSOR_DHT22,4);
    
      /*
       * Register above your sensors
      */
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // Send the sketch version information to the gateway and Controller
    	sendSketchInfo(SKETCH_NAME,SKETCH_VERSION);
      // call NodeManager presentation routine
      nodeManager.presentation();
    
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    
    }
    
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    

    Also on config.h I have enabled DS18B20 and DHT22 modules.

    Really, any help would be welcome!

    Thanks all in advance!



  • @gohan

    node

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    40 MCO:BGN:BFR
    REG I=1 P=3 P=6 T=0
    NodeManager v1.4
    INT1 M=255
    INT2 M=255
    59 TSM:INIT
    135 TSF:WUR:MS=0
    155 TSM:INIT:TSP OK
    176 TSM:INIT:STATID=100
    202 TSF:SID:OK,ID=100
    225 TSM:FPAR
    370 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2244 TSF:MSG:READ,0-0-100,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    2301 TSF:MSG:FPAR OK,ID=0,D=1
    2447 TSM:FPAR:OK
    2463 TSM:ID
    2478 TSM:ID:OK
    2492 TSM:UPL
    2639 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    3678 TSF:MSG:READ,0-0-100,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    3737 TSF:MSG:PONG RECV,HP=1
    3768 TSM:UPL:OK
    3784 TSM:READY:ID=100,PAR=0,DIS=1
    3883 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    4003 TSF:MSG:READ,0-0-100,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    4202 !TSF:MSG:SEND,100-100-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=NACK:2.1.1
    4415 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=NACK:0
    6733 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=2,st=NACK:NodeManagerTemplate
    6928 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=3,st=OK:1.0
    RADIO OK
    PRES I=200, T=23
    7137 !TSF:MSG:SEND,100-100-0-0,s=200,c=0,t=23,pt=0,l=0,sg=0,ft=0,st=NACK:
    PRES I=201, T=30
    7321 TSF:MSG:SEND,100-100-0-0,s=201,c=0,t=30,pt=0,l=0,sg=0,ft=1,st=OK:
    BATT V=3.25 P=93
    SEND D=0 I=201 C=0 T=38 S= I=0 F=3.25
    7469 !MCO:SND:NODE NOT REG
    7587 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:93
    PRES I=1 T=6
    7794 !TSF:MSG:SEND,100-100-0-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=NACK:
    READY
    
    7868 MCO:REG:REQ
    7933 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
    9019 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    9078 MCO:PIM:NODE REG=1
    9105 MCO:BGN:STP
    MY I=100 M=1
    9123 MCO:BGN:INIT OK,TSP=1
    THER I=1 V=354.00 T=40.05
     M=1
    SEND D=0 I=1 C=0 T=0 S= N=0 F=40.05
    9224 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:40.05
    SLEEP 3600s
    
    9316 MCO:SLP:MS=3600000,SMS=1,I1=255,M1=255,I2=255,M2=255
    9527 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=NACK:287
    9607 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    9666 !TSF:MSG:LEN,0!=8
    10108 MCO:SLP:TPD```
    
    
    

    Gateway

    0;255;3;0;9;TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=100
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;TSF:MSG:PINGED,ID=100,HP=1
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.1.1
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/0/0/17
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=11,pt=0,l=19,sg=0:NodeManagerTemplate
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/3/0/11
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=200,c=0,t=23,pt=0,l=0,sg=0:
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/200/0/0/23
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=0,pt=1,l=1,sg=0:85
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/3/0/0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:36.72
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/1/1/0/0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=22,pt=5,l=4,sg=0:286
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/3/0/22
    0;255;3;0;9;Message arrived on topic: domoticz/out/MyMQTT/0/0/3/0/18
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/0/255/3/0/22
    

    0_1491753073560_domoticz_screen.jpg


  • Mod

    I think relay is the pir sensor you are looking for.


  • Contest Winner

    @mar.conte your configuration looks correct, SENSOR_MOTION is what you want to use indeed. However, the logs are saying NodeManager is presenting the sensor as S_TEMP so the issue is on NodeManager's side also because looks like SensorThermistor has been instantiated but if I look at the code, there is no way this should happen.I'll try to setup something similar to see if I can reproduce the behavior. Very stupid question: are you sure you have uploaded successfully that sketch and it is not an old one? I really cannot explain it otherwise at a first look...
    Thanks


  • Contest Winner

    @bilbolodz having a special registerSensor() for DS18B20 is for sure feasible but I'll leave it as the last option. Are you sure you need to store something in the eeprom? The way I imaged it was something like this, all within the sketch:

    • register the DS18B20 sensors with one line. registerSensor() returns the child id of the last sensor so I know how many have been detected.
    • cycle through the DS18B20 sensors found with getSensor(index)
    • for each sensor, call of getDeviceAddress(), if the address equals to a hard-coded address, renameSensor() to a fixed id.

    In this way the same device address will always get the same child id and if a sensor will be unavailable, it will not mess up the other child IDs. Is this something which can be done or am I missing something? Far from saying it is elegant of course...
    Thanks



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

    In this way the same device address will always get the same child id and if a sensor will be unavailable, it will not mess up the other child IDs. Is this something which can be done or am I missing something? Far from saying it is elegant of course...

    Of course that it's solution but hardcoding addresses into sketch as you said "it's far from elegant"..... The good idea (in my opinion) is to put addresses into array stored in eeprom. The ideal solution would be to have possibility put addresses into eeprom by mysensors controller 😉


  • Contest Winner

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

    PRES I=1 T=6
    PRES I=2 T=6
    PRES I=3 T=7

    Hi, the sensors are all presented correctly, child id 1 is type temperature (6, the DS18B20), child id 2 is type temperature (6, the DHT22), child id 3 is type humidity (7, the DHT22).
    What it looks like from the logs is that it hangs after sending out the temperature of child id 2, never get to child id 3 so never goes to sleep.

    I wonder if having both DHT and DS18B20 together would consume too much memory causing the sketch to halt. When you compile it, what is the percentage of program storage space and dynamic memory used? For those sensors the objects are allocated dynamically so when getting closer to the memory limit strange behaviors can happen.
    Try also disabling NodeManager's debug (#define DEBUG 0) and all the other modules you are not using (e.g. MODULE_ANALOG_INPUT, MODULE_DIGITAL_INPUT, etc.). All of this should help saving additional memory. Then check on your controller if you get the humidity as well and if the node goes to sleep.

    Thanks!



  • @user2684 Hi and thank you for the prompt response!

    The % of memory used is 83% of program storage space and 63% of dynamic memory.
    
    Sketch uses 25580 bytes (83%) of program storage space. Maximum is 30720 bytes.
    Global variables use 1307 bytes (63%) of dynamic memory, leaving 741 bytes for local variables. Maximum is 2048 bytes.
    

    Heading right now to try to compile without the non-needed modules and try again.


  • Contest Winner

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

    Of course that it's solution but hardcoding addresses into sketch as you said "it's far from elegant"..... The good idea (in my opinion) is to put addresses into array stored in eeprom. The ideal solution would be to have possibility put addresses into eeprom by mysensors controller

    Ok got it, just wanted to be sure that what I had in mind, despite being awful, was kind of feasible. Now let me try to understand better what you have in mind: you store in eeprom the the addresses, then call registerSensor() and the for DS18B20, it will retrieve from there the addresses and do the mapping automatically instead of being you doing in the sketch what I listed before. Is it correct? If so, despite some obvious complexity, does not require a special registerSensor() (which would be great).

    As a side note, having the controller storing something into the EEPROM is not something extremely difficult to implement, I can add an additional V_CUSTOM message so achieve this since I can imagine may be helpful for this and other use cases (https://github.com/mysensors/NodeManager/issues/53)



  • @user2684 Yes, that could be nice solution.


  • Contest Winner

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

    @user2684 Yes, that could be nice solution.

    Cool, I'll track it down (https://github.com/mysensors/NodeManager/issues/54) so you can see when I'll get into it.
    Thanks!



  • @user2684 You were right! Definately a memory problem. Disabled the non-needed modules and everything is working as it should!

    REG I=1 P=3 P=6 T=0
    REG I=2 P=4 P=6 T=0
    REG I=3 P=4 P=7 T=1
    NodeManager v1.4
    INT1 M=255
    INT2 M=255
    RADIO OK
    PRES I=200, T=23
    PRES I=201, T=30
    BATT V=3.44 P=100
    SEND D=0 I=201 C=0 T=38 S= I=0 F=3.44
    PRES I=1 T=6
    PRES I=2 T=6
    PRES I=3 T=7
    READY
    
    MY I=199 M=1
    DS18B20 I=1 T=44.19
    SEND D=0 I=1 C=0 T=0 S= N=0 F=44.19
    DHT I=2 T=24.40
    SEND D=0 I=2 C=0 T=0 S= N=0 F=24.40
    DHT I=3 H=35.50
    SEND D=0 I=3 C=0 T=1 S= N=0 F=35.50
    SLEEP 60s
    

    Many many many THANKS for the help!



  • @user2684 By the way I am alsy trying to implement the forecasting algorithm for BME280 sensor (from here) into the BME280 section of NodeManager.cpp and Nodemanager.h but until now no joy. Maybe I am trying to do something complicated for me as a beginner into this, but I always like to learn by trial and error. Any advice you could give me to be able to implement the forecasting algorithm?


  • Contest Winner

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

    @user2684 You were right! Definately a memory problem. Disabled the non-needed modules and everything is working as it should!

    Great! I feel like there are a lot of optimizations that can be done to prevent this and other weird behaviors (tracked already with https://github.com/mysensors/NodeManager/issues/28).

    I'd need a real programmer's review sooner or later because I'm sure the way I am e.g. comparing and manipulating strings are far from being efficient...


  • Contest Winner

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

    @user2684 By the way I am alsy trying to implement the forecasting algorithm for BME280 sensor (from here)

    Great idea! I wonder if the issue you are facing is due to different libraries being used (I'm using Adafruit's library, not the one from MySensors examples folder, not sure if they are different). I'll give it a try as well (https://github.com/mysensors/NodeManager/issues/56), but please let me know if you'll find the way to have it working and I'll make it part of the main code base.

    Thanks!



  • @user2684
    all ok now is s_motion but is ever tripped high!!!why?


  • Contest Winner

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

    all ok now is s_motion but is ever tripped high!!!why?

    Default behavior is triggering on RISING but this can be changed with setMode() and setInitial(). Also ensure you are using pin 3 on a pro mini to have a valid interrupt. What is the behavior you are experiencing?
    Thanks



  • @user2684
    for istance Sensorswitch what is code?



  • @user2684
    it's ok this code?

    NodeManager nodeManager;
    SensorSwitch swiTch(1,3);
    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);  
      /*
       * Register below your sensors
      */
    swiTch.setMode(0);
    swiTch.setInitial(0);
    swiTch.setTriggerTime(4000);
      nodeManager.setSleep(SLEEP,60,MINUTES); 
      nodeManager.registerSensor(SENSOR_MOTION,3);```

  • Contest Winner

    @mar.conte sorry I'm not sure I have understood what you want to achieve. Do you have a motion sensor which is HIGH by default and when triggers goes LOW? Is this what you need?
    Thanks



  • @user2684

    Hello, I have a simple pir hcr501 that normally does not send output to pin 3 (so low) but when there is movement becomes HIGH, then my CPU goes to sleep for 60 minutes; the hardware is well configured because this setup I used it with the official mysensors sketches for pir motion; I do not understand why the domoticz controller is always the pir HIGH and does not go into sleep the MCU, thanks


  • Contest Winner

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

    Hello, I have a simple pir hcr501 that normally does not send output to pin 3 (so low) but when there is movement becomes HIGH

    Ok, so you don't need any customization in NodeManager since this is meeting the default behavior (LOW by default and triggering on HIGH), sorry for the wrong advice. Let's have a look at the sensor's logs then to see why the node is waking up continuously.

    Thanks!



  • @user2684
    @gohan

    node

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    40 MCO:BGN:BFR
    REG I=1 P=3 P=6 T=0
    NodeManager v1.4
    INT1 M=255
    INT2 M=255
    59 TSM:INIT
    135 TSF:WUR:MS=0
    155 TSM:INIT:TSP OK
    176 TSM:INIT:STATID=100
    202 TSF:SID:OK,ID=100
    225 TSM:FPAR
    370 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2244 TSF:MSG:READ,0-0-100,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    2301 TSF:MSG:FPAR OK,ID=0,D=1
    2447 TSM:FPAR:OK
    2463 TSM:ID
    2478 TSM:ID:OK
    2492 TSM:UPL
    2639 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    3678 TSF:MSG:READ,0-0-100,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    3737 TSF:MSG:PONG RECV,HP=1
    3768 TSM:UPL:OK
    3784 TSM:READY:ID=100,PAR=0,DIS=1
    3883 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    4003 TSF:MSG:READ,0-0-100,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    4202 !TSF:MSG:SEND,100-100-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=NACK:2.1.1
    4415 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=NACK:0
    6733 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=2,st=NACK:NodeManagerTemplate
    6928 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=3,st=OK:1.0
    RADIO OK
    PRES I=200, T=23
    7137 !TSF:MSG:SEND,100-100-0-0,s=200,c=0,t=23,pt=0,l=0,sg=0,ft=0,st=NACK:
    PRES I=201, T=30
    7321 TSF:MSG:SEND,100-100-0-0,s=201,c=0,t=30,pt=0,l=0,sg=0,ft=1,st=OK:
    BATT V=3.25 P=93
    SEND D=0 I=201 C=0 T=38 S= I=0 F=3.25
    7469 !MCO:SND:NODE NOT REG
    7587 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:93
    PRES I=1 T=6
    7794 !TSF:MSG:SEND,100-100-0-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=NACK:
    READY
    
    7868 MCO:REG:REQ
    7933 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
    9019 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    9078 MCO:PIM:NODE REG=1
    9105 MCO:BGN:STP
    MY I=100 M=1
    9123 MCO:BGN:INIT OK,TSP=1
    THER I=1 V=354.00 T=40.05
     M=1
    SEND D=0 I=1 C=0 T=0 S= N=0 F=40.05
    9224 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:40.05
    SLEEP 3600s
    
    9316 MCO:SLP:MS=3600000,SMS=1,I1=255,M1=255,I2=255,M2=255
    9527 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=NACK:287
    9607 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    9666 !TSF:MSG:LEN,0!=8
    10108 MCO:SLP:TPD```
    
    
    

    Gateway

    0;255;3;0;9;TSF:MSG:READ,100-100-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=100
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;TSF:MSG:PINGED,ID=100,HP=1
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.1.1
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/0/0/17
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=11,pt=0,l=19,sg=0:NodeManagerTemplate
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/3/0/11
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=200,c=0,t=23,pt=0,l=0,sg=0:
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/200/0/0/23
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=0,pt=1,l=1,sg=0:85
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/3/0/0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;TSF:MSG:SEND,0-0-100-100,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=1,c=1,t=0,pt=7,l=5,sg=0:36.72
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/1/1/0/0
    0;255;3;0;9;TSF:MSG:READ,100-100-0,s=255,c=3,t=22,pt=5,l=4,sg=0:286
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/100/255/3/0/22
    0;255;3;0;9;Message arrived on topic: domoticz/out/MyMQTT/0/0/3/0/18
    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/0/255/3/0/22
    

    0_1491753073560_domoticz_screen.jpg


  • Contest Winner

    @mar.conte there is something strange with this node. First of all the node is still presenting the temperature and not the motion sensor. Then I see a lot of failures during transmit but also while receiving (!TSF:MSG:LEN,0!=8). Are you sure you don't have something like two nodes with the same id?



  • @user2684
    hi, I noticed that the zero node has a child called S_Arduino_Repeater with an id equal to 255 child node, called 100 S_Arduino_Node, what do you recommend?
    smotion now appears I had mistakenly entered analog 0 on a wire that went to +Power


  • Contest Winner

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

    I noticed that the zero node has a child called S_Arduino_Repeater with an id equal to 255 child node, called 100 S_Arduino_Node

    The node 0 is the gateway which presents itself as S_ARDUINO_REPEATER, the child id 255 is the broadcast address, the node id 100 is instead you node. This is all correct (with or without NodeManager). Glad to hear the motion sensor is now showing up. Is it still trigger continuously?
    Thanks



  • @user2684
    Yes trig again!!!


  • Contest Winner

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

    Yes trig again!!!

    Ok, if triggers continuously, please share the logs of the node now that has been fixed so we can have a look.
    Thanks!



  • @user2684
    Hi,

    NODE OUTPUT

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    40 MCO:BGN:BFR
    REG I=1 P=3 P=1 T=16
    NodeManager v1.4
    INT1 M=3
    INT2 M=255
    59 TSM:INIT
    135 TSF:WUR:MS=0
    153 TSM:INIT:TSP OK
    176 TSM:INIT:STATID=100
    200 TSF:SID:OK,ID=100
    223 TSM:FPAR
    368 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    641 TSF:MSG:READ,0-0-100,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    698 TSF:MSG:FPAR OK,ID=0,D=1
    2445 TSM:FPAR:OK
    2461 TSM:ID
    2476 TSM:ID:OK
    2490 TSM:UPL
    2512 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2633 TSF:MSG:READ,0-0-100,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2693 TSF:MSG:PONG RECV,HP=1
    2721 TSM:UPL:OK
    2738 TSM:READY:ID=100,PAR=0,DIS=1
    2785 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2904 TSF:MSG:READ,0-0-100,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    3018 TSF:MSG:SEND,100-100-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    3229 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=NACK:0
    5316 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=11,pt=0,l=19,sg=0,ft=1,st=OK:NodeManagerTemplate
    5541 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=NACK:1.0
    RADIO OK
    PRES I=200, T=23
    5715 TSF:MSG:SEND,100-100-0-0,s=200,c=0,t=23,pt=0,l=0,sg=0,ft=1,st=OK:
    PRES I=201, T=30
    5922 !TSF:MSG:SEND,100-100-0-0,s=201,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=NACK:
    BATT V=3.21 P=86
    SEND D=0 I=201 C=0 T=38 S= I=0 F=3.21
    6072 !MCO:SND:NODE NOT REG
    6164 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=1,st=OK:86
    PRES I=1 T=1
    6371 !TSF:MSG:SEND,100-100-0-0,s=1,c=0,t=1,pt=0,l=0,sg=0,ft=0,st=NACK:
    READY
    
    6445 MCO:REG:REQ
    6531 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
    6619 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    6678 MCO:PIM:NODE REG=1
    6705 MCO:BGN:STP
    MY I=100 M=1
    6723 MCO:BGN:INIT OK,TSP=1
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=0 T=16 S= N=1 F=0.00
    6817 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    SLEEP 3600s
    
    6897 MCO:SLP:MS=3600000,SMS=1,I1=1,M1=3,I2=255,M2=255
    7104 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=NACK:264
    7684 MCO:SLP:TPD
    7700 MCO:SLP:WUP=1
    WAKE P=3, M=3
    AWAKE
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=1 T=16 S= N=1 F=0.00
    7786 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:1
    SLEEP 3600s
    
    7876 MCO:SLP:MS=3600000,SMS=1,I1=1,M1=3,I2=255,M2=255
    8087 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=NACK:1243
    8667 MCO:SLP:TPD
    8683 MCO:SLP:WUP=1
    WAKE P=3, M=3
    AWAKE
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=1 T=16 S= N=1 F=0 
    8757 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:1
    SLEEP 3600s
    
    8859 MCO:SLP:MS=3600000,SMS=1,I1=1,M1=3,I2=255,M2=255
    8982 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:2226
    9562 MCO:SLP:TPD
    9578 MCO:SLP:WUP=1
    WAKE P=3, M=3
    AWAKE
    SWITCH I=1 P=3 V=1
    SEND D=0 I=1 C=1 T=16 S= N=1 F=0.00
    9621 TSF:MSG:SEND,100-100-0-0,s=1,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:1
    SLEEP 3600s
    
    9754 MCO:SLP:MS=3600000,SMS=1,I1=1,M1=3,I2=255,M2=255
    9961 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=NACK:3121
    10541 MCO:SLP:TPD
    

    Tanks


  • Contest Winner

    @mar.conte ok, this looks better, the node is presenting correctly and I see the sensor triggering continuously. You still have a lot of radio failures while sending but this is another story and it is not related to the issue but keep in mind you are losing a few messages.
    Now, if I look at the digital read of the pin waking up the board (V=):

    SWITCH I=1 P=3 V=1
    

    This is HIGH so the board correctly wakes up. Since the signal apparently stays high, the board goes in and out of sleep so looks like an expected behavior. The are a couple of functions available to prevent this (setTriggerTime() and setDebounce()) but before giving direction I'd ask you to measure the voltage at pin 3 with a multimeter because it looks like the motion sensor goes HIGH and stay HIGH for a long time. If we know this timeframe, we can adjust the settings accordingly. Btw you should have the same behavior with the example sketch at https://www.mysensors.org/build/motion.
    Thanks



  • @user2684
    ok, I will check first the voltage of the pir and even the power of the MCU, it seems to me that the rfm69 module does not communicate with each other (node-gateway), it seems strange because with the sketch of links that you suggested it all works well ! thanks anyway I'll do my tests and let you know soon ...



  • I wanted to know what are the connections to monitor the batteries of my sensor, do I connect the battery V+ to the analog pin A0?


  • Contest Winner

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

    I wanted to know what are the connections to monitor the batteries of my sensor, do I connect the battery V+ to the analog pin A0?

    If you are connecting the arduino directly to the battery (e.g. no step-up-down), then you don't need any connection since NodeManager is able to sense and measure the input vcc (and according to my measures it is very accurate). In case instead you need to use the method here https://www.mysensors.org/build/battery, you need the following:

    nodeManager.setBatteryInternalVcc(false);
    nodeManager.setBatteryPin(A0);
    

    You can even customize the default 0.003363075 voltage per bit with setBatteryVoltsPerBit()



  • @user2684

    THEN MY NODE WILL BE CONNECTED TO A BATTERY 3.6 VOLT AA 2600 MAH, SO I DO NOT RIGHT CONNECTIONS? BUT I HAVE TO CHANGE OTHER PARAMETERS TO BEING 3.6?
    TANKS


  • Contest Winner

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

    THEN MY NODE WILL BE CONNECTED TO A BATTERY 3.6 VOLT AA 2600 MAH, SO I DO NOT RIGHT CONNECTIONS? BUT I HAVE TO CHANGE OTHER PARAMETERS TO BEING 3.6?
    TANKS

    If directly connected to the battery you don't need any other connection. To set minimum and maximum voltage to have an accurate battery percentage level calculated you need to use e.g.:

    nodeManager.setBatteryMin(2.7);
    nodeManager.setBatteryMax(3.6);
    

    So the percentage will be calculated between the two values.



  • @user2684

    Much easy INFINITE THANKS AND CONGRATULATIONS



  • @user2684
    Solved
    I solved it by putting settriggertime (5000) setdebounce (50); also solved the supply problems because if power is ftdi with the sensor was always high, with batteries the pir is stable and works well
    thanks for the support

    0_1492372761834_IMG_3804.JPG

    This is my reprap printed house for my project


  • Contest Winner

    @mar.conte great to hear it is working now! For anybody else interested in these parameters, setDebounce() will set a debounce interval, e.g. the value of the input is checked after the interval from the wakeup so to avoid false positives, while seTriggerTime() ignore any input after the pir has triggered to avoid the sensor to trigger continuously. Btw, very nice and clean packaging!



  • I have a problem, my node is in sleep for 60 minutes and hourly reads the battery voltage but when you wake the pir is high and in addition to the high volts sends me even then the controller sends me a pir pir movement false; how can I avoid it?



  • Can I suggest updated sourceforge to say that the code has been moved to github, and leaving little else there? That way it's easier to update everything in the same place. I was browsing on sourceforge for a while and wondering "Why isn't this on github instead?" It wasn't even until I came back and started skimming this thread that I realized it was moved to github.


  • Contest Winner

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

    I have a problem, my node is in sleep for 60 minutes and hourly reads the battery voltage but when you wake the pir is high and in addition to the high volts sends me even then the controller sends me a pir pir movement false; how can I avoid it?

    So you are saying when the node wakes up not from the pir interrupt at the end of the sleeping cycle to report battery level, is it also reporting a V_TRIPPED with payload 0? Thanks


  • Contest Winner

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

    Can I suggest updated sourceforge to say that the code has been moved to github

    Good advice thanks! I've changed the website link on Sourceforge as well as added a note in the description and redirected the "Support" link.



  • @user2684
    Yes of course but payload =1 pir movimento detect


  • Mod

    What's the problem if it reports no motion?



  • @user2684 Looks great!



  • @gohan
    The problem is that motion report whenever sleep goes to wake to send me the battery status every 60 minutes ,then every 60 minutes sends me battery status and motion pir


  • Mod

    Ok, but is it causing any problem?



  • @gohan
    Definitely, if I put a pir sensor to monitor a security access I will never know if I had an intrusion if I have a false alarm


  • Mod

    if it reports "no motion" it is not a false alarm. The important thing is it must report when there is "motion"


  • Contest Winner

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

    if it reports "no motion" it is not a false alarm. The important thing is it must report when there is "motion"

    Agree with what @gohan says. But I'll look into this anyway @mar-conte, reporting no motion when waking up should not happen even if it is a minor issue (https://github.com/mysensors/NodeManager/issues/71). What should not happen at all is reporting motion (payload 1) but as far as I've understood this is the case.
    Thanks



  • @user2684
    So with version 1.5 do I solve my problem too?



  • I noticed that the battery report if set to one hour does not happen every hour ...


  • Contest Winner

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

    So with version 1.5 do I solve my problem too?

    I'll look into it by then. Feel free to follow the github issue to see how it will evolve. Thanks!


  • Contest Winner

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

    I noticed that the battery report if set to one hour does not happen every hour ...

    More details please 🙂 Does not happen at all, it is not regular, happens every other hour, etc. what is the case?
    Thanks!



  • @user2684
    It happens even if i put 6 hours or every 3 hours so in the specified hours it is not regular the report sometimes jumps some report


  • Contest Winner

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

    It happens even if i put 6 hours or every 3 hours so in the specified hours it is not regular the report sometimes jumps some report

    Ok, I'd probably need both MySensors and NodeManagers's logs to troubleshoot this, just to ensure there is no failure in sending out the messages as I've seen in the other logs you have previously shared.

    Thanks!



  • @user2684
    Ok Tanks



  • Then solved the problem of the accuracy of the battery report: basically I did not realize that the sleep wait time started from the last pir movement then if i put an hour of sleep and during this active time the pir time resumes; The communication problems I solved them by letting antenna from rfm69 so every hour the battery report does not even send pir moviment
    ....Very strange my rfm69 modules communicate better without an antenna even at a distance of 10 meters with a wall


  • Mod

    There is a risk of damaging the radio module if you don't use an antenna. Also a wrong tuned antenna will make transmitting more difficult.



  • @gohan
    Ok Tanks, but the 86 mm wire for 868 what is Ideal diameter and thread type for simple antenna no dipole e non ground ant?


  • Mod

    Found in another forum

    433 1/4 wave = 164.7mm
    433 1/2 wave = 329.4mm
    433 full wave = 692.7mm

    868 1/4 wave = 82.2mm
    868 1/2 wave = 164.3mm
    868 full wave = 345.5mm

    915 1/4 wave = 77.9mm
    915 1/2 wave = 155.9mm
    915 full wave = 327.8mm

    Try shortening a little bit. What kind of wire are you using?



  • @gohan
    Wery good Tanks gohan



  • @gohan
    Normal wire electric 1 mm diameter


  • Mod

    Single core or threaded?



  • @gohan
    Threaded


  • Mod

    You need to use single core, that's why it is not working well



  • @gohan
    Should it be isolated or even without a sheath?


  • Mod

    I think you can leave insulation on; there are some guides on how to make antennas for rfm69,just Google it. In addition there are also spring single wire antennas for different frequencies you can buy.


  • Contest Winner

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

    I did not realize that the sleep wait time started from the last pir movement then if i put an hour of sleep and during this active time the pir time resumes

    Yes, when the pir wakes the node up, the sleep is aborted and when going back to sleep, it starts from scratch without resuming it. If this is not creating an issue, I'll keep the current behavior. Regarding the antenna, I'm using the small antennas from the store for my RFM69 and have a decent range without big issues.



  • @user2684
    Tanks of course bye



  • I'm trying to build sensor to drive 3 relays and connect it to Domoticz. Simple sketch:

    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);  
      /*
       * Register below your sensors
      */
    int przek1 = nodeManager.registerSensor(SENSOR_RELAY,3);
    int przek2 = nodeManager.registerSensor(SENSOR_RELAY,4);
      /*
       * Register above your sensors
      */
      nodeManager.before();
    }
    

    sensors are visible into Domoticz as switches but It's not possible to turn it on/off from Domoticz. It looks that Nodemanager expect REQ message to change state of relay but Domoticz sends SET message to change state:

    RECV S=0 I=3 C=1 T=2 D=1
    RECV S=0 I=3 C=1 T=2 D=0

    When I've used MYSController and send C_REQ message all is working fine.

    I think that in case of "output" sensors logic of getting/setting should be reversed.


  • Contest Winner

    Hello, I think I was able to implement most of the requests discussed here during the last few weeks in a pre-release v1.5 version. Please consider it still as a dev release which gone through very limited testing but since I had to make quite a few changes to core code, would be great to start collecting some feedback now.

    Is is available here: https://github.com/mysensors/NodeManager/tree/9a485cdcaf8e9856219338553335e2dce7253eb3

    It is complicated to reference each of you who requested something so please whoever is interested the full list of new additions/fixes is available here https://github.com/mysensors/NodeManager/milestone/5?closed=1. I did my best to add verbose comments so you should find all the details there. Please add any comment and report any problem directly to the existing issues on github so I can better understand the context. The documentation has been updated as well.
    Thanks




  • Contest Winner

    I've just pushed out 1.5-dev3 on https://github.com/mysensors/NodeManager/tree/702a05c7e2f4425c188d5abf62b4a119fea29bc8 fixing a critical bug for the BME280 sensor and providing a way to automatically detect which i2c address the sensor is on for both BME280 and BMP085/BMP180 if anybody is interested.

    I'm planning some additional tests so to release a stable v1.5 in a week or two (unfortunately starting from June the real life will become very demanding with me). So please share any feedback by then in case you will have the chance to test the latest dev release. Thanks


  • Mod

    Just in time, I am going to get my BME280 sensor soon 😄


  • Mod

    May I ask you a favor? Could you add also the MCP9808 I2C sensor?


  • Contest Winner

    @gohan done but I don't have such a sensor to test the code so if you could give it a try I'd really appreciate it. Available in v1.5-dev4 you can get from here: https://github.com/mysensors/NodeManager/tree/38fd51c99e47b6ec90f4885ff1cb0cfe33857ab4.
    Instructions on https://github.com/mysensors/NodeManager/issues/87
    Thanks!



  • Can you please consider support for MCP23017 IO-Expander And TTP226/TTP229 Touch control sensor modules in I2C mode?



  • I can help test them both for sure... 😈 😇

    Will it be a good idea to have external file based extension to Node Manager?

    I will like to extend the configuration child and probably add node authentication through another security-child. Self Healing Network capabilities are next on my list.


  • Mod

    @user2684 Sorry for noob question but how do I get data from the sensors?
    I have registered sensors like this to test them out

    	nodeManager.setSleep(SLEEP, 10, MINUTES);
    	nodeManager.registerSensor(SENSOR_MOTION, 3);
    	nodeManager.registerSensor(SENSOR_BME280);
    	nodeManager.registerSensor(SENSOR_MCP9808);
    

  • Contest Winner

    @vikasjee tracking both with https://github.com/mysensors/NodeManager/issues/90 and https://github.com/mysensors/NodeManager/issues/92. Mean while I will order the samples and wait for their delivery, if you have any link with demo code to share, please feel free to do so on the two github issues.

    Regarding the external file based extension, this is definitively a good idea. I did spend some time at the beginning trying to identify the best way to package this but my weak programming skills prevented me to identify an optimal solution I'm sure. I did not go for multiple files mainly because I thought during upgrade this would have required overwriting multiple files in multiple projects so I gave up. As a workaround, I also tried to put all NodeManager's files in a dedicated folder or create an arduino library but it didn't work (but don't remember why).

    So the only way now to expand the existing code in a clean way is to write in your main sketch an inline class deriving from the Sensor class or the other NodeManager's classes and use registerSensor() providing an instance of this class. But I am of course open to any other better way to achieve the same 🙂


  • Contest Winner

    @gohan since you have set a sleep interval of 10 minutes, what you should see in the logs (and in your gateway) is NodeManager starting up, presenting all the child nodes (one of more for each sensor), running SENSOR_BME280's and SENSOR_MCP9808's onLoop() and a bunch of messages set out with the measures and finally going to sleep for 10 minutes and waking up and sending out a V_TRIPPED message if SENSOR_MOTION triggers.
    Generally speaking you can get the measures in the serial output, in the controller or by sending the node a REQ message to each of the child ids. Do you see something different?
    Thanks


  • Mod

    Ok, I mean from code like if I want to use them to show on local LCD


  • Contest Winner

    @gohan never thought about it but it is a good idea to add some "output" capabilities. Tracking this with https://github.com/mysensors/NodeManager/issues/95 but would require some time since it has a few dependencies. Thanks!


  • Mod

    I'll give you a feedback sooner or later... I lost so many hours trying to figure out what was wrong with my test sensor but at the end it was a fried nrf24 module that was working since some time ago


  • Contest Winner

    I've added a rain gauge out-out-the-box sensor for the latest dev release called 1.5-dev5 (https://github.com/mysensors/NodeManager/tree/126812a9d01311640416222be8225fdcca1e7266). This is intended to be the last enhancement for the upcoming v1.5 version but of course I'll wait for some additional days to collect (and fix) any issue all the new sensors might have.

    The implementation of the rain gauge sensor has to be different than the one from the build section for a good number of reasons and limitations. All the details here: https://github.com/mysensors/NodeManager/issues/90.



  • Sorry but the name of the sketch can be different both in the node and in the gateway?


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 1
  • 2
  • 8

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts