Ability to change channel & or base radio ID



  • Hi,

    It's my understanding that you can change the channel and/or base radio ID via defines at the top of the sketch, but this means you can't change anything dynamically or via the program at run-time?

    Could the MySensors system be enhanced to enable selection of channel number and/or base radio ID, for example in before(), so that a switch value could be read and so the radio could be configured to be set at different channel or base radio ID?

    This would be a way to enable devices to be set to non-interfering channel or radio ID without a re-program? This sort of approach is used for things like wireless door-bell systems, so if the neighbour has the same setup it doesn't trigger your bell or interfere?

    Thanks, Philip


  • Mod

    @phil2020 said in Ability to change channel & or base radio ID:

    you can't change anything dynamically or via the program at run-time?

    Correct

    Could the MySensors system be enhanced to enable selection of channel number and/or base radio ID, for example in before(), so that a switch value could be read and so the radio could be configured to be set at different channel or base radio ID?

    Yes, it probably could. You can enter a new issue here and describe your ideas.

    This would be a way to enable devices to be set to non-interfering channel or radio ID without a re-program?

    The normal way to go (as channel and base-ID are globally set for your complete mysensors network) is to select an available channel/base-ID combination and program this in all nodes and the gateway.



  • @phil2020 Perhaps you can get some inspiration from this project https://forum.mysensors.org/topic/9178/nrf24doctor/4
    Here these are done dynamically.


  • Mod

    There have been some earlier discussions on this topic, that might help find a solution. One example:
    https://forum.mysensors.org/topic/7760/change-the-channel-number-for-the-entire-network-find-the-channel-for-the-new-node

    The solution described in https://github.com/mysensors/MySensors/issues/701 should work.



  • Thanks for the replies. From looking through those links, it appears that instead of just using a fixed #define value, you can instead reference a variable and assign the variable's value programmatically in the before() section. For example you could load in the value required for channel or base radio ID from EEPROM memory.

    So you can, in a sense, dynamically change the values through store of updated parameters into EEPROM and effect that change via a software reset process that you can call from your program.



  • I would definitely welcome that improvement.

    I think that a desired method would be a default via #defines, and some way to overide that programatically.

    To what channel we move? I think that some kind of physical input, even taking some pins, would be great. We could "encode" 2^n inputs in order to change the channel from default. Or for more advanced use cases we could change it via a sensor variable for OTA frecuency setting.

    Thanks to you all


  • Mod

    @guillermo-schimmel could you clarify what you refer to by "that improvement"?

    Do you mean the define described in https://forum.mysensors.org/topic/5410/changing-node-id-at-run-time/5 ? If so, that's already possible. If you mean something else, it would be nice if you could describe it so people can consider implementing it.



  • Hi @mfalkvidd, and thanks for you time.

    I see that there is already a mechanism for altering the node id on runtime.

    What I would like to know is if there is something similar to change the RF Channel (and/or) RF Power, also on runtime.

    Something in the likes of transportAssignNodeID(), perhaps transportAssignRFChannel().

    regards


  • Mod

    @guillermo-schimmel from what I understand, you should be able to do this:

    int8_t myChannel;
    
    #define MY_RF24_CHANNEL myChannel
    #define CHANNEL_PIN 4
    
    void before () {
      // read I/O pins to determine which channel to use.
      // This simple example lets you switch between 42 and 100 by holding down a button at boot
      if (digitalRead(CHANNEL_PIN)) {
        myChannel = 42;
      } else {
        myChannel = 100;
      }
    }
    


  • @mfalkvidd that's really great. I'll try. Thank you very much.


Log in to reply
 

Suggested Topics

33
Online

11.2k
Users

11.1k
Topics

112.5k
Posts