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. OpenHardware.io
  3. šŸ’¬ NodeManager

šŸ’¬ NodeManager

Scheduled Pinned Locked Moved OpenHardware.io
contest2017arduinonewbiemysensorsbattery sensor
196 Posts 42 Posters 67.4k Views 41 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.
  • core_cC Offline
    core_cC Offline
    core_c
    wrote on last edited by
    #43

    I have a BMP280 sensor (as far as i know, they are quite similar). At first it seemed like the sensor was not detected. After inspecting the datasheet, i found out that the address could be selected (one of 2 possibilities).
    Here's the text from the datasheet:

    Connecting SDO to GND results in slave
    address 1110110 (0x76); connection it to VDDIO results in slave address 1110111 (0x77)

    Some people change the library code, but (like in my case), i only needed to connect the SDO pin to +3.3V.

    At first i did not connect the SDO pin at all, and my sensor was not reporting at all. That was because of this:

    The SDO pin cannot be left floating; if left floating, the
    I²C address will be undefined.

    Perhaps those issues can be the cause of your problems ksga?

    U 1 Reply Last reply
    0
    • core_cC core_c

      I have a BMP280 sensor (as far as i know, they are quite similar). At first it seemed like the sensor was not detected. After inspecting the datasheet, i found out that the address could be selected (one of 2 possibilities).
      Here's the text from the datasheet:

      Connecting SDO to GND results in slave
      address 1110110 (0x76); connection it to VDDIO results in slave address 1110111 (0x77)

      Some people change the library code, but (like in my case), i only needed to connect the SDO pin to +3.3V.

      At first i did not connect the SDO pin at all, and my sensor was not reporting at all. That was because of this:

      The SDO pin cannot be left floating; if left floating, the
      I²C address will be undefined.

      Perhaps those issues can be the cause of your problems ksga?

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

      @core_c this is what I was thinking of as well. Right now in NodeManager the only way to change the i2c address is to change the core code under registerSensor() in NodeManager.cpp which is not handy. I need to find out how to provide an easy way to set it. The problem is registerSensor() takes a fixed number of parameters (and I want it to stay in this way) and it is responsible to create the bmp/bme object, passing it to the 2-3 child sensors. I can provide a setAddress() function but the user needs just after to retrieve each sensor (temperature, humidity, pressure, etc.) and set it manually which is not not great.
      I've opened https://github.com/mysensors/NodeManager/issues/85 for this which is needed regardless. Thanks

      U 1 Reply Last reply
      0
      • U user2684

        @core_c this is what I was thinking of as well. Right now in NodeManager the only way to change the i2c address is to change the core code under registerSensor() in NodeManager.cpp which is not handy. I need to find out how to provide an easy way to set it. The problem is registerSensor() takes a fixed number of parameters (and I want it to stay in this way) and it is responsible to create the bmp/bme object, passing it to the 2-3 child sensors. I can provide a setAddress() function but the user needs just after to retrieve each sensor (temperature, humidity, pressure, etc.) and set it manually which is not not great.
        I've opened https://github.com/mysensors/NodeManager/issues/85 for this which is needed regardless. Thanks

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

        @core_c found a great way to to let NodeManager identifying automatically which i2c address the sensor is using without the need for the user to change anything in the code. This is done by requesting the chip_id for the two i2c address and comparing it with the expected one to identify the right address. I've implemented it for both the BME280 and BMP085/BMP180 sensors and it is available in 1.5-dev3 (https://github.com/mysensors/NodeManager/tree/702a05c7e2f4425c188d5abf62b4a119fea29bc8). Also, under the hood, I've created a SensorBosch class which is not exposed but helps providing common functionalities to the two sensors without duplicating the code.

        Finally, specifically for your problem @ksga, I found a critical bug in the BME280 class. I wonder how I've missed it so far. For some unknown reasons, the bme object created by registerSensor and passed to the SensorBME280 class, was not stored by the latter. This means it was calling e.g. readTemperature on a null pointer which I even wonder why was not crashing everything. It has been fixed in 1.5-dev3 so if you would like to give it a try, I'm more confident it will work just fine finally :-)

        1 Reply Last reply
        2
        • U Offline
          U Offline
          user2684
          Contest Winner
          wrote on last edited by
          #46

          Do you think would make any sense to add NodeManager among the Arduino's examples? So that from the IDE one can select Examples, MySensors and NodeManager would show up like MotionSensor and the others. However I'd expect new versions of NM to be released more frequently than updates to the core code so it might happen an outdated version to be available there...

          1 Reply Last reply
          0
          • U Offline
            U Offline
            user2684
            Contest Winner
            wrote on last edited by
            #47

            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.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Dencan
              wrote on last edited by
              #48

              Hi, nice work!
              I have changed the code for REBOOT so there is no need for a reboot-pin.
              like this...

              else if (strcmp(message, "REBOOT") == 0) {
              #if DEBUG == 1
              Serial.println(F("REBOOT"));
              #endif
              // Software reboot with watchdog timer
              // Enter Watchdog Configuration mode:
              WDTCSR |= (1<<WDCE) | (1<<WDE);
              // Reset enable
              WDTCSR= (1<<WDE);
              // Infinite loop until watchdog reset after 16 ms
              while(true){}
              }

              U core_cC 3 Replies Last reply
              1
              • D Dencan

                Hi, nice work!
                I have changed the code for REBOOT so there is no need for a reboot-pin.
                like this...

                else if (strcmp(message, "REBOOT") == 0) {
                #if DEBUG == 1
                Serial.println(F("REBOOT"));
                #endif
                // Software reboot with watchdog timer
                // Enter Watchdog Configuration mode:
                WDTCSR |= (1<<WDCE) | (1<<WDE);
                // Reset enable
                WDTCSR= (1<<WDE);
                // Infinite loop until watchdog reset after 16 ms
                while(true){}
                }

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

                @Dencan interesting thanks! I initially thought there were two use cases, one is to reboot with a remote command and the other is by using a pin (e.g. when having physical access is easier than sending out a message). But I think you're right, if you have physical access, well, hitting the reset button is way easier than connecting the reboot pin to RST ;-)
                I'll use this snippet for the version about to be released (https://github.com/mysensors/NodeManager/issues/101). Thanks!

                1 Reply Last reply
                1
                • D Dencan

                  Hi, nice work!
                  I have changed the code for REBOOT so there is no need for a reboot-pin.
                  like this...

                  else if (strcmp(message, "REBOOT") == 0) {
                  #if DEBUG == 1
                  Serial.println(F("REBOOT"));
                  #endif
                  // Software reboot with watchdog timer
                  // Enter Watchdog Configuration mode:
                  WDTCSR |= (1<<WDCE) | (1<<WDE);
                  // Reset enable
                  WDTCSR= (1<<WDE);
                  // Infinite loop until watchdog reset after 16 ms
                  while(true){}
                  }

                  core_cC Offline
                  core_cC Offline
                  core_c
                  wrote on last edited by
                  #50

                  @Dencan That is a method i never even thought about Dencan.
                  Cool.. You tought me something. Thanks. I have to try it out for myself. :)
                  My first thought was jumping to the address of the RESET interrupt vector in memory.
                  It's located in the very first bytes at address 0.

                  __asm__ __volatile__ ("jmp 0");
                  
                  1 Reply Last reply
                  0
                  • U Offline
                    U Offline
                    user2684
                    Contest Winner
                    wrote on last edited by
                    #51

                    Version 1.5 of NodeManager is finally available here!
                    https://github.com/mysensors/NodeManager

                    I've done my best to implement most of the requests received so far since unfortunately I'm expecting starting from June very little spare time to spend here so I tried to hurry up a bit :-) The result is a pretty long change log and a total of 26 between ad-hoc and generic out-of-the-box sensors supported up to this release:

                    • Added support for ACS712 current sensor
                    • Added support for HC-SR04 distance sensor
                    • Added support for BMP085/BMP180 temperature and pressure sensor
                    • Added support for Sonoff smart switch
                    • Added support for Rain Gauge sensor
                    • Added support for MCP9808 temperature sensor
                    • Added forecast output to all Bosch sensors
                    • Added I2C address auto-discovery for all Bosch sensors
                    • Added support for running as a gateway
                    • Added option to retrieve the latest value of a sensor from outside NodeManager
                    • Remote reboot now does not need a reboot pin configured
                    • A heartbeat is now sent also when waking up from a wait cycle
                    • When waking up for an interrupt, only the code of the sensor expecting that interrupt is executed
                    • Added capability to retrieve the time from the controller
                    • Optimized battery life for DS18B20 sensors
                    • SLEEP_MANAGER has been deprecated (now always enabled) and setMode() replaces setSleepMode()
                    • New mode ALWAYS_ON to let the node staying awake and executing each sensors' loop
                    • ESP8266WiFi.h has to be included in the main sketch if MY_GATEWAY_ESP8266 is defined
                    • Added receiveTime() wrapper in the main sketch
                    • Fixed the logic for output sensors
                    • Added common gateway settings in config.h

                    I've added upgrade instructions as well in the documentation. Generally speaking to upgrade it is safe to just replace the existing NodeManager.h and NodeManager.cpp files but with this release I had to do some minor changes to the main sketch as well, as documented in the release notes.

                    Thanks everybody for all the advice and for reporting any issue always in a constructive way :-)

                    1 Reply Last reply
                    1
                    • U Offline
                      U Offline
                      user2684
                      Contest Winner
                      wrote on last edited by
                      #52

                      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 :)

                      1 Reply Last reply
                      1
                      • Sergio RiusS Offline
                        Sergio RiusS Offline
                        Sergio Rius
                        wrote on last edited by
                        #53

                        Very good job @user2684 ! I like it very much.
                        Only one thing, how I can create a simple DHT22 node? I activated MODULE_DHT, and registered like this:

                          /*
                             Register below your sensors
                          */
                          int sensorDHT_Id = nodeManager.registerSensor(SENSOR_DHT22,4);
                          SensorDHT*  sensorDHT = (SensorDHT*)nodeManager.getSensor(sensorDHT_Id);
                          sensorDHT->setSamples(5);
                          sensorDHT->setTackLastValue(true);
                          sensorDHT->setForceUpdate(5);
                          /*
                             Register above your sensors
                          */
                        

                        But when compiling it throws: 'DHT11' was not declared in this scope

                        I have the DHT library installed by the env, and a copy at the projects libraries folder (portable) and also at the same project folder (when opening the sketch also opens the library), but still complains.

                        ??

                        U 1 Reply Last reply
                        0
                        • Sergio RiusS Sergio Rius

                          Very good job @user2684 ! I like it very much.
                          Only one thing, how I can create a simple DHT22 node? I activated MODULE_DHT, and registered like this:

                            /*
                               Register below your sensors
                            */
                            int sensorDHT_Id = nodeManager.registerSensor(SENSOR_DHT22,4);
                            SensorDHT*  sensorDHT = (SensorDHT*)nodeManager.getSensor(sensorDHT_Id);
                            sensorDHT->setSamples(5);
                            sensorDHT->setTackLastValue(true);
                            sensorDHT->setForceUpdate(5);
                            /*
                               Register above your sensors
                            */
                          

                          But when compiling it throws: 'DHT11' was not declared in this scope

                          I have the DHT library installed by the env, and a copy at the projects libraries folder (portable) and also at the same project folder (when opening the sketch also opens the library), but still complains.

                          ??

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

                          @Sergio-Rius thanks! Are you sure you are using the DHT library from the arduino IDE ( https://github.com/adafruit/DHT-sensor-library) and not the one from the MySensors example folder? Thanks

                          Sergio RiusS 1 Reply Last reply
                          0
                          • U user2684

                            @Sergio-Rius thanks! Are you sure you are using the DHT library from the arduino IDE ( https://github.com/adafruit/DHT-sensor-library) and not the one from the MySensors example folder? Thanks

                            Sergio RiusS Offline
                            Sergio RiusS Offline
                            Sergio Rius
                            wrote on last edited by Sergio Rius
                            #55

                            @user2684
                            AH! You're right, you got me. I'll change and test it. Anyways the one I was using was failing frecuently reading the sensor.

                            But you could also make your wrapper compatible with the MyS one. The difference between both is that the later places its declarations inside the class. You can make it work by fully qualifying the calls like the example:

                            NodeManager.cpp @1949:       int dht_type = sensor_type == SENSOR_DHT11 ? _dht.DHT11 : _dht.DHT22;
                            

                            It could be interesting if there are anyone really needing the MyS DHT library. And also it seems more memory optimized. The adafruit's are two in one and also needs another library helper in cascade.

                            U Sergio RiusS 2 Replies Last reply
                            0
                            • Sergio RiusS Sergio Rius

                              @user2684
                              AH! You're right, you got me. I'll change and test it. Anyways the one I was using was failing frecuently reading the sensor.

                              But you could also make your wrapper compatible with the MyS one. The difference between both is that the later places its declarations inside the class. You can make it work by fully qualifying the calls like the example:

                              NodeManager.cpp @1949:       int dht_type = sensor_type == SENSOR_DHT11 ? _dht.DHT11 : _dht.DHT22;
                              

                              It could be interesting if there are anyone really needing the MyS DHT library. And also it seems more memory optimized. The adafruit's are two in one and also needs another library helper in cascade.

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

                              @Sergio-Rius great idea! Will prevent people to get crazy with compile errors, thanks!
                              I'll track this with https://github.com/mysensors/NodeManager/issues/144

                              Sergio RiusS 1 Reply Last reply
                              0
                              • U user2684

                                @Sergio-Rius great idea! Will prevent people to get crazy with compile errors, thanks!
                                I'll track this with https://github.com/mysensors/NodeManager/issues/144

                                Sergio RiusS Offline
                                Sergio RiusS Offline
                                Sergio Rius
                                wrote on last edited by
                                #57

                                @user2684 Nevermid! I'm still struggling trying to make the TH sensor :sweat_smile:
                                That's the serial output I get and nothing at domoticz.

                                REG I=1 P=4 P=6 T=0
                                REG I=2 P=4 P=7 T=1
                                NodeManager v1.5
                                INT1 M=255
                                INT2 M=255
                                RADIO OK
                                PRES I=200, T=23
                                PRES I=201, T=30
                                BATT V=2.95 P=50
                                SEND D=0 I=201 C=0 T=38 S= I=0 F=2.95
                                PRES I=1 T=6
                                PRES I=2 T=7
                                READY
                                
                                MY I=3 M=1
                                
                                U 1 Reply Last reply
                                0
                                • Sergio RiusS Sergio Rius

                                  @user2684 Nevermid! I'm still struggling trying to make the TH sensor :sweat_smile:
                                  That's the serial output I get and nothing at domoticz.

                                  REG I=1 P=4 P=6 T=0
                                  REG I=2 P=4 P=7 T=1
                                  NodeManager v1.5
                                  INT1 M=255
                                  INT2 M=255
                                  RADIO OK
                                  PRES I=200, T=23
                                  PRES I=201, T=30
                                  BATT V=2.95 P=50
                                  SEND D=0 I=201 C=0 T=38 S= I=0 F=2.95
                                  PRES I=1 T=6
                                  PRES I=2 T=7
                                  READY
                                  
                                  MY I=3 M=1
                                  
                                  U Offline
                                  U Offline
                                  user2684
                                  Contest Winner
                                  wrote on last edited by
                                  #58

                                  @Sergio-Rius ok, this is kind of a standard startup with the temperature and humidity sensors presented as child 1 and 2, so far so good.

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

                                  By default no data is reported unless the node enters in a cycle. You would like to add:

                                  nodeManager.setSleep(SLEEP, 10, MINUTES);
                                  

                                  Or

                                  nodeManager.setSleep(WAIT, 10, MINUTES);
                                  

                                  To start getting periodically the data out. Alternatively you can send a REQ message to the child id with the appropriate V_type

                                  Sergio RiusS 1 Reply Last reply
                                  0
                                  • U user2684

                                    @Sergio-Rius ok, this is kind of a standard startup with the temperature and humidity sensors presented as child 1 and 2, so far so good.

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

                                    By default no data is reported unless the node enters in a cycle. You would like to add:

                                    nodeManager.setSleep(SLEEP, 10, MINUTES);
                                    

                                    Or

                                    nodeManager.setSleep(WAIT, 10, MINUTES);
                                    

                                    To start getting periodically the data out. Alternatively you can send a REQ message to the child id with the appropriate V_type

                                    Sergio RiusS Offline
                                    Sergio RiusS Offline
                                    Sergio Rius
                                    wrote on last edited by
                                    #59

                                    @user2684 Mmmmm what if you have a motion sensor in the same node? (I'm trying to migrate my own sketch)

                                    U 1 Reply Last reply
                                    0
                                    • Sergio RiusS Sergio Rius

                                      @user2684
                                      AH! You're right, you got me. I'll change and test it. Anyways the one I was using was failing frecuently reading the sensor.

                                      But you could also make your wrapper compatible with the MyS one. The difference between both is that the later places its declarations inside the class. You can make it work by fully qualifying the calls like the example:

                                      NodeManager.cpp @1949:       int dht_type = sensor_type == SENSOR_DHT11 ? _dht.DHT11 : _dht.DHT22;
                                      

                                      It could be interesting if there are anyone really needing the MyS DHT library. And also it seems more memory optimized. The adafruit's are two in one and also needs another library helper in cascade.

                                      Sergio RiusS Offline
                                      Sergio RiusS Offline
                                      Sergio Rius
                                      wrote on last edited by
                                      #60

                                      @Sergio-Rius said in šŸ’¬ NodeManager:

                                      The difference between both is that the later places its declarations inside the class.

                                      Please don't waste your time as they are not compatible. In my stupidity didn't make sure that my lib wasn't "personalized".
                                      What a pity.

                                      1 Reply Last reply
                                      0
                                      • Sergio RiusS Sergio Rius

                                        @user2684 Mmmmm what if you have a motion sensor in the same node? (I'm trying to migrate my own sketch)

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

                                        @Sergio-Rius yes, you can have a motion sensor on the same node as far as it is a sleeping node. This is because the interrupt is coming from the MySensors sleep() call. Having this compatibility in a non sleeping node is instead only planned (https://github.com/mysensors/NodeManager/issues/142)

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          strangeoptics
                                          wrote on last edited by
                                          #62

                                          Hi, I would like to have smartSleep for my nodes. I read that NodeManager can do that. But I couldn't find an explanation how it is doing it. I use OpenHAB as the controller and MQTT to communicate to the MySensors-Gateway. Is smartSleep working for this scenario? Did you extend the Gateway?

                                          U 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          16

                                          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