Easy way to configure ID / channel



  • I built various sensors for me, friends,...
    I have to use several because of to heavy walls

    I learned here how to add a Jumper to clear eeprom during boot, so i could handle out sensors to anybody, then the sensor is once started with the Jumper, then ready for it´s new place

    But now trouble starts with channel / ID - i have to use different ones, because of the different Gateways
    I expect that even to be a problem chrashing my ESP8266-Gateway

    Does anybody have a good idea how to handle that`?

    My idea is to have a box full of sensors, take one, and adapt it to the desired gateway
    I can´t flash each one again to the desired ID, because as all of you know, which was the right IDE, which was the right sketch,....

    For the start, it should at least be in the sketch itself, not in another file....


  • Mod

    How about using a rotary encoder for selecting the channel?



  • I was already thinking about that, BCD-encoded, but as there are many genious People here, maybe there are better Solutions ?
    Something like if the sensor is 20 cm away from the Gateway, and a button pressed on the Gateway, or such things ?

    As i understood mysensors beginner-friendly, maybe that´s something that´s needed ?


  • Mod

    @kr0815 said:

    which was the right IDE, which was the right sketch,....

    IMHO That's just a matter of administration.

    Anyway, if the number of combinations you want to support is small and board space/IO's are limited, you could use a voltage divider consisting of 2 resistors and hook them up to an analog input of the microcontroller.

    More or less like the schematic below, but by only using one switch:

    analog_read_dipswitch.jpg

    By reading the analog input you can determine which resistor configuration is present and thus which channel is selected.



  • I will try it with 2 Jumpers to select between 4 different channels

    but how to define the channel in the sketch, not in MyConfig.h ?


  • Mod

    @kr0815 Currently you cannot change the channel dynamically, as it is set
    to RF24_CHANNEL in MyTransportNRF24::init().
    You could change the implementation of MyTransportNRF24::init() and pass the channel as a parameter.


 

360
Online

8.1k
Users

8.9k
Topics

95.2k
Posts