Repeatrer level limit (NRF24L01 transport)



  • Could someone please confirm that repeater mode could be "chained" (I mean that that could be more than one repeater along path between leaf node and gateway node). I've bunch of sensors but I have problems with tree mode).
    Working setup for me is GW->RN->LF(RN) but I can't get working GW->RN->RN->LF.
    RN - repater node
    RN(LF) - repater node connected to GW or RP "last in chain
    LF - leaf node (last in chain)

    Second question. Generally (in most sensors) I'm using NFR24L01 modules with BCB antena (not "SMD" version, without PA). Is it OK to use RF24_PA_LOW power mode setting or for these modules only option is RF24_PA_MIN?

    Best regards

    Piotr


  • Mod

    You can chain more repeaters. You could set a fixed parent ID in the repeaters so they don't try to jump one.

    About NRF24 power, you can also use pa_max and pa_high, it just depends on the quality of the radio module.



  • @gohan said in Repeatrer level limit (NRF24L01 transport):

    About NRF24 power, you can also use pa_max and pa_high, it just depends on the quality of the radio module.

    Even versions without PA and rubber duck antena?


  • Mod

    Yes, it works but it depends on the chip quality: there are some performing better with lower power, it is a matter of doing tests to figure it out, there is not rule to follow with all those counterfeit nrf24 chips around.



  • @gohan said in Repeatrer level limit (NRF24L01 transport):

    You can chain more repeaters.

    I've managed to "chain repeaters" so your statement is 100% true 😉 Still fighting with range but "there is a hope" for my project.



  • @gohan said in Repeatrer level limit (NRF24L01 transport):

    You could set a fixed parent ID in the repeaters so they don't try to jump one.

    Is there a way to change fixed parent in "programming way (to set it as custom value in eeprom and call function setting it on startup not as define and recompile). I've about 20 devices the same type and I prefer to have the same firmware for all.

    Second question (I've looked at source and answer probably is: now it's very hard to do it): Is there a way to the same with transmit power of NRF module?


  • Mod

    @bilbolodz first question: it might be possible using the method suggested here: https://forum.mysensors.org/topic/5410/changing-node-id-at-run-time/
    If you try it, please report back with the results. If it works we should document it somewhere where it is easier to find.

    Second question: it might be possible using the same technique as above, but I think you would need to reset the node or trigger re-initialization of the radio. Maybe sleep is enough, I'm not sure if the radio is re-initialized after sleep.
    Adding reference for the second question: https://github.com/mysensors/MySensors/issues/900


  • Mod

    The radio object can be accessed through the global variable _radio (see here). Maybe you can just call the appropriate function?



  • @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

    @bilbolodz first question: it might be possible using the method suggested here: https://forum.mysensors.org/topic/5410/changing-node-id-at-run-time/
    If you try it, please report back with the results. If it works we should document it somewhere where it is easier to find.

    For sure there is possibility to change ID of node "on the fly" set:

    #define MY_NODE_ID AUTO

    and send message C_INTERNAL I_ID_RESPONSE with new ID node. Working even without node reboot

    I will check your method with parent ID. I will try to check also these method with power level but I don't know how to check in programming way current NRF power.


  • Mod

    @bilbolodz the level is RF24_PA_HIGH unless you have an override in your sketch. See https://github.com/mysensors/MySensors/blob/10ef62307b914c88295977d58b9601d994e89117/MyConfig.h#L640



  • @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

    The radio object can be accessed through the global variable _radio (see here). Maybe you can just call the appropriate function?

    I've made a quick grep. It looks that _radio is avaliable for RFM69 transport. For NFR there is a function RF24_setRFSetup but as parameter i takes MY_RF24_RF_SETUP defined as:

    #define MY_RF24_RF_SETUP (uint8_t)( ((MY_RF24_DATARATE & 0b10 ) << 4) | ((MY_RF24_DATARATE & 0b01 ) << 3) | (MY_RF24_PA_LEVEL << 1) ) + 1 // +1 for Si24R1

    It's problematic using it for power level without messing other things!


  • Mod

    See if you can change the value and call

    _radio.RF24_initialize();
    

    But I am not familiar with the inner workings of the radio code. Maybe running RF24_initialize() will have unintended side effects.



  • @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

    @bilbolodz the level is RF24_PA_HIGH unless you have an override in your sketch.

    That's obvious, I'm using it. Problem is that its "#define'ed" so value of these "variable" is set during compilation and it's not possible to change it in program!


  • Mod

    @bilbolodz sorry, I must have misunderstood your question. You asked how to get the current power setting. I said that the current power setting will be the default value, unless you set it to something else. If you set it to something else, it will be set to the value you set it to. So just use the value you set it to? No need to get it from the radio?


  • Mod

    Enabling MY_DEBUG_VERBOSE_RF24 would print the registers though. Maybe that's what you are asking for?



  • @mfalkvidd
    The problem is:

    My sensors network is over 30 nodes a few repeaters and so on, majority of nodes are the same hardware devices.
    I want to "tune" my network changing NRF power level and MY_PARENT_NODE_ID "on th fly" (now it's "hard defined").
    You've suggested to use method:

    int8_t myNodeId;
    
    #define MY_NODE_ID myNodeId
    
    void before () { 
        // read I/O pins and set myNodeId
        myNodeId = 32;
        Serial.println( myNodeId );
    }
    

    but with MY_PARENT_NODE_ID and MY_RF24_PA_LEVEL. Good idea I will check if it working BUT:

    there MUST be a way to check remotely IF it's working. There is no problem with MY_PARENT_NODE_ID because it affect network topology and it could be easily checked. I don't know how to check "from program" current power level.

    Ideal solution would that sketch will detect current power level and suffix sketch name with _MIN, _LOW, _HIGH, _MAX.

    It would allow me to have only two version of "HEX firmware" for OTA: with or without repeater mode. Other things (parent level and ID) I could change "on the fly" sending command" (and maybe rebooting) to sensor.

    Is it clear now?


  • Mod

    @bilbolodz yup. Thanks for clarifying.
    And thanks for noticing that _radio is only available for rfm69. Seems a bit inconsistent to me, but there are probably reasons for it.

    It looks like transportGetTxPowerLevel() / RF24_getTxPowerLevel() will return some sort of mapping of the current power level. But these functions are internal/private, so I don't know how to access them.


  • Mod

    Verifying the parent node id should be possible by calling transportGetParentNodeId() or simply getParentNodeId();


  • Mod

    @bilbolodz how about this? https://github.com/mysensors/MySensors/blob/726a20dad9696ed86408106061a9e0be31995b5c/core/MyTransport.h#L524

    Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?



  • @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

    Sending a I_SIGNAL_REPORT_REQUEST message with the command "T" could be what you need?

    Unfortunately MYSController in current version doesn't support I_SIGNAL_REPORT_REQUEST message. I will try it in code, thanks



  • This post is deleted!


  • @mfalkvidd

    /**
    * @brief Get transport signal report
    * @param command:
    * R = RSSI (if available) of incoming @ref I_SIGNAL_REPORT_REQUEST message (from last hop)
    * R! = RSSI (if available) of ACK to @ref I_SIGNAL_REPORT_REVERSE message received from last hop
    * S = SNR (if available) of incoming @ref I_SIGNAL_REPORT_REQUEST message (from last hop)
    * S! = SNR (if available) of ACK to @ref I_SIGNAL_REPORT_REVERSE message received from last hop
    * P = TX powerlevel in %
    * T = TX powerlevel in dBm
    * U = Uplink quality (via ACK from parent node), avg. RSSI
    * @return Signal report (if report is not available, INVALID_RSSI, INVALID_SNR, INVALID_PERCENT, or INVALID_LEVEL is sent instead)
    */
    int16_t transportSignalReport(const char command);
    
    /**
    * @brief Get transport signal report
    * @param signalReport
    * @return report
    */
    int16_t transportGetSignalReport(const signalReport_t signalReport);
    

    These functions are available only in devlopment branch. Not implemented into stable code 😞


  • Mod

    @bilbolodz yes. Everything in MySensors started off in the development branch 🙂 It takes time and effort to code and test. What you're asking for is interesting, but historically it has not been interesting enough for anyone to "man up" and spend the time needed.



  • It looks that I've achieved my goal. I'm able dynamically change parent id node (proved in lab) and power level (don't have idea how to check it). You can send V_VAR1 message with number of preferred parent or V_VAR2 with requested power (values: 0 - RF24_PA_MIN, 1 - RF24_PA_LOW, 2 - RF24_PA_HIGH, RF24_PA_MAX) and then REBOOT node (required to changes take effect). Version of sketch reported to controller is changed dynamically depends of set power level.

    My "repeater: code bellow:

    #define SKETCH_NAME "Repeater Node L1"
    #define SV "1.0.1" 
    #define MY_RADIO_NRF24
    #define MY_REPEATER_FEATURE
    
    int8_t myParrentNodeId;
    int8_t myRF24PALevel;
    
    #define MY_PARENT_NODE_ID myParrentNodeId
    #define MY_RF24_PA_LEVEL myRF24PALevel
    
    #include <MySensors.h>
    
    #ifndef MY_REPEATER_FEATURE
    #define SKETCH_VERSION1 SV
    #else
    #define SKETCH_VERSION1 SV "R"
    #endif
    
    #define SKETCH_VERSION SKETCH_VERSION1 "   "
    
    uint8_t SketchVersion[sizeof(SKETCH_VERSION)];
    
    #define EEPROM_PARENT 0
    #define EEPROM_PA_LEVEL 1
    
    void before() {
    
      int8_t tmpui = loadState(EEPROM_PARENT);
      if (tmpui == 0xFF)
      {
        myParrentNodeId = 0;
      }
      else {
        myParrentNodeId = tmpui;
      }
    
      memcpy(SketchVersion, SKETCH_VERSION, sizeof(SKETCH_VERSION));
    
      tmpui = loadState(EEPROM_PA_LEVEL);
      switch (tmpui)
      {
        case 0:
          myRF24PALevel = RF24_PA_MIN;
          memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "MIN", 3);
          break;
        case 1:
          myRF24PALevel = RF24_PA_LOW;
          memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "LOW", 3);
          break;
        case 2:
          myRF24PALevel = RF24_PA_HIGH;
          memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "HIG", 3);
          break;
        case 3:
          myRF24PALevel = RF24_PA_MAX;
          memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "MAX", 3);
          break;
        default:
          myRF24PALevel = RF24_PA_MAX;
          break;
      }
    }
    
    void setup()
    {
    
    }
    
    void presentation()
    {
      //Send the sensor node sketch version information to the gateway
      //sendSketchInfo("Repeater Node L1 MAX", "1.0");
      sendSketchInfo(SKETCH_NAME, SketchVersion);
    }
    
    void loop()
    {
    }
    
    void receive(const MyMessage &message) {
      if (!message.isAck()) {
        if (message.type == V_VAR1) {
          uint8_t tmpui = message.getByte();
          uint8_t tmpui1 = loadState(EEPROM_PARENT);
          if (tmpui != tmpui1)
          {
            saveState(EEPROM_PARENT, tmpui);
          }
        }
        else if (message.type == V_VAR2)
        {
          uint8_t tmpui = message.getByte();
          uint8_t tmpui1 = loadState(EEPROM_PA_LEVEL);
          if (tmpui >= 0 && tmpui <= 3)
          {
            if (tmpui != tmpui1)
            {
              saveState(EEPROM_PA_LEVEL, tmpui);
            }
          }
        }
      }
    }
    


  • @mfalkvidd said in Repeatrer level limit (NRF24L01 transport):

    Everything in MySensors started off in the development branch

    If you are using dev branch please test my sketch and check changing power mode with I_SIGNAL_REPORT_REQUEST message or transportGetSignalReport(const signalReport_t signalReport) function.


 

366
Online

7.5k
Users

8.4k
Topics

90.4k
Posts