💬 Door, Window and Push-button Sensor


  • Admin

    This thread contains comments for the article "Door, Window and Push-button Sensor" posted on MySensors.org.



  • Hello. I used that example for open gate and doorbell and i think the 1 / 0 values are reversed.
    I mean . Switch button it's connected between , by example PIN 2 ... and ground ,so PIN 2 its always ** 1** (),when i press the switch button it goes to 0. That cause my Vera have trigger values reversed... it's always triggered if i not change advance option trigger. should i change : send(msg2.set(value==HIGHT ? 1 : 0)); TO send(msg2.set(value==LOW ? 1 : 0)); ????


  • Mod

    @Tmaster yes that will work.

    You can also apply the techinque used in https://www.mysensors.org/build/relay where RELAY_ON/OFF are set by defines.



  • Is it possible to add multiple reed sensors to the one node? If so, can you just copy the basic code provided and paste it below that in the same sketch and change the arduino pins appropriately??


  • Mod

    @breimann yes



  • My sketch have 2 binary switches. Working very good.



  • what is "debouncer" for? I removed it from my sketch and it still works...


  • Mod

    @siod when a switch is pressed it can bounce, which can look like several presses to the mcu. More information is available at http://www.allaboutcircuits.com/textbook/digital/chpt-4/contact-bounce/


  • Hardware Contributor

    I did just build a similar sensor based on my small sensor node. I think the example code here isn't really perfect though (although its very basic, perhaps that was the only goal).

    As I wanted to use this with batteries I used an interrupt and sleep(). The deboucing library isn't really need, a short gw.wait(50); did it for me too.
    Here is my code (not yet updated to mysensors 2). Any comments? Perhaps we could update the example code too.



  • Dont forget to add a 10K resistor between GND and your PIN (in this example pin3)


  • Hardware Contributor

    @janvier123 Do you really need that? Shouldn't the internal pullups be enough?

    pinMode(BUTTON_PIN,INPUT);
    // Activate internal pull-up
    digitalWrite(BUTTON_PIN,HIGH);
    


  • for some reason the value was always "1" untill i "pushed the button" => then i got "0"
    however ive added an 10K resistors between the pin and gnd, and now it works fine 🙂

    maybe because its not an official UNO board?



  • i don't why, but debouncer.read(); always return 1, i was never able to send the status of the door, however, digitalRead(BUTTON_PIN) returns the actual value.

    since i am using this for reed switch, i believe i don't need the debouncing functionality do i ?


  • Hardware Contributor

    @Meshx86 said:

    i don't why, but debouncer.read(); always return 1, i was never able to send the status of the door, however, digitalRead(BUTTON_PIN) returns the actual value.

    since i am using this for reed switch, i believe i don't need the debouncing functionality do i ?

    Hello,

    yes you can get rid of the debouncing stuff for your reed switch (or any physical switch) if you are sleeping and waking up on interrupt, just add a little wait before you read the value to let the switch settle.
    If you are running at 1MHz then the time to wake up from sleep is longer (45ms if I remember well) and you don't even need the sleep.



  • What is the way to put the sketch on a sensebender with battery powered ?



  • Is the BinarySwitchSleepSensor a good answer ?



  • @Meshx86

    I have the same problem, when I use the bounce library to read my reed switch I always read "1". If I use digitalRead I get an bounce error.
    I have an arduino compatible, configure it for 1Mhz, 1M resistor for the reed switch and 2 AA battery.
    Someone has a similar one working?



  • @Jic i was wondering what's the purpose of the 1 M resistor on the reed switch ?
    i used 2 x AA battery, digitalRead, 8 MHz stock clock and no resistor, i know this might not be the most optimized power consumption setup



  • Nuub here..
    Thinking about building this in my mailbox..
    AND if possible set a green light diode to start light when box is opened and stop when its opened again.

    That way i would see when i come home if someone has opened the mailbox or not.. Sure push notifications work aswell but it would be a nice touch for the wifey


  • Hardware Contributor

    @meanmrgreen if you use a led it will draw a few mA when on and battery life will be poor.
    At best you could wake up every few seconds and flash it briefly (like 100ms or less). In that case use a low value current limiting resistor to have an intense flash, and probably a red LED is better.
    To stop the blinking why not use a button (or touch button, check TTP223 in AliExpress) inside the mailbox ?


  • Mod

    Not sure if it more battery friendly, but maybe sending a bluetooth low energy beacon is better than a led? Higher nerd factor for sure, but maybe less spouse friendly (depending on how good the ble app on the phone is).

    Seems like it would be possible by using an extra nrf24: https://github.com/floe/BTLE/blob/master/examples/send/send.ino

    On the other hand, if a smartphone is required you might as well open the app for your controller and check the status there 🙂

    Maybe use a battery-friendly PIR and only light/blink the led when motion is detected?



  • You lost me at bluetooth beacon? 🙂

    Me personally is using the app but wifey and kids ain't really as interested as i am 😉

    So therefore I would need a indicator of some sorts around the mailbox that is about 30 meters from the house in the road up to the house.

    Maybe a solar led light or similar to light up? Or a flag on a servo?

    Will start with building the switch and figure out the indicator later.



  • Hi Everyone
    Be carefull a newby here... 🙂

    I have ordered all the parts for my sensor network. My plan is to have battery powered sensor sensing the following: Door/window status AND temp/humidity. Doing all this in a low power fashion.

    My question is: Would these code in the build section be easily combined (dooe switch and temp/hum) in a way that it measures the temp/hum regurarly (every 15-30 min) and if during the sleep a door event happens it sends the door event to the gateway (and probably since we are awake do a temp/hum measurement as well)?

    Every piece of direction, advice is appreciated.

    Atesz



  • Like I said..newby here. Hold back your horses for a moment, I did a deep search and found some interesting forum topics here 🙂


  • Mod

    @Atesz very welcome to the MySensors community!
    "easily" is in the eye of the beholder, but I'd say yes. https://forum.mysensors.org/topic/2597/combining-mysensors-examples is a great starting poing for combining sketches.



  • @mfalkvidd Thank you very much, it is almost what I've been looking for !



  • Goodevening,
    I am new to mysensors (newby) i wil make 3 sensors on my mini pro can some one help me with the sketch.
    I am working a hole day but i can't get it writh help is very use vol.
    One switch (reed contact) is working.


  • Admin

    Hi Ton,

    You have to give us a little bit more information here (and please start a new thread for your project).

    Normally good to give information about:

    1. What are you trying to accomplish?
    2. What is working?
    3. What is not working?
    4. What did you try yourself before posting?
    5. What is the expected result?
    6. Logs from the sensor/gateway/controller.


  • I had big problems getting this one to work in Domoticz... But then I downgraded the Arduino IDE to IDE 1.6.7 (https://forum.mysensors.org/topic/5164/ethernet-gw-w5100-can-not-connect-to-domoticz/2) and then it worked!



  • @hek,

    Thanks for the reply.

    What are you trying to accomplish?
    I want to try 3 reed/door contacts on one mini-pro on pin 3,4 and 5

    What is working?
    One reed/door contact is working

    What is not working?
    I don't no how i must make a second reed/door contact in the sketch (door/window push button)
    I am new to programming arduino and don't undertsand how to do that, ik look for a hint how i can implement a second reed/door switch in the sketch

    What did you try yourself before posting?
    I look many sketches on internet and try to copy a copple of line in the working sketch but i don't get a second reed/switch in domoticz. I am trying this a hole day (i am with pension).

    What is the expected result? a second, thirth reed/sensor in domoticz i see here only the first sensor.

    Logs from the sensor/gateway/controller.
    The log for the first reed/door switch i see and it is working in domoticz, that is not the problem.

    Sorry for the bad English.



  • @ Svante

    Thanks for the reply but is is working well with one reed switch. So that is not the problem I want on the mini/pro a second and thirt switch.



  • Hi, New here but stumbled across this.
    I am planning on re-using an old wired alarm system that has door and window sensors all over my house terminating under my stairs. Can I combine one sketch into multiple door reed switches on one arduino. That seems to have been asked before but there doesn't seem to be an answer. It would be quite annoying to have 8 arduinos next to each other in order to do so.
    Nick


  • Hardware Contributor

    @nickgosling - no problem if you have 1 wire for each reedswitch you could just add it to different input/pins and have 1 arduno check which pins is high or low.



  • Thanks for the response. OK I'm fine with assigning a pin as an input but how would I change the code to reflect this .thanks.


  • Hardware Contributor

    @nickgosling - take the sketch and add one child for each sensor. Define one input for each sensor and in the loop check each pin for a statechange. With a if you can then send the status for each changed pin.



  • Thank you I'll give that a go.



  • Hi,
    Maybe it is a little off-topic here, but maybe you could point me to the right direction: I want to build nice wall switch, and from technological point of view it is not that difficult using mysensors, this part is clear, including battery powering or making some kind of power conversion from AC to DC (in openhardware there are quite a few examples on that). What is bothering me is the switch "enclosure". I have one example from TKB Home:
    http://www.ebay.de/itm/TKB-Home-Z-Wave-Plus-Dual-Paddle-Wall-Switch-TZ56D-ZW5-/122201876698?ssPageName=ADME:X:EAC:GB:1120
    that I have bought to try with smarttnings controller (which is not intended to work with, now I know), but what it has - it is the enclosure: it is nice switch with 2 micro switches inside (4 in total, since it is dual wall switch), that are not locking in the pressed position - you press up and it clicks one button/switch and returns back to its initial "neutral" position, you press down - again, click and back to "neutral".
    I think the similar are are in aliexpress, that are called like wall wireless remote switch Transmitter, but I'm not sure about that, since I didn't bought one to disassemble.
    Maybe some one have met something similar for making some nice RF controlled wall switches?

    Thanks in advance!
    Regards


  • Hardware Contributor

    @Justas Hello, please check the dedicated category, if you don't find your hapiness please post there 🙂

    https://forum.mysensors.org/category/42/enclosures-3d-printing



  • I tried this today and it wouldn't find a parent.

    Adding #define MY_NODE_ID 1 seems to have solved the problem, so maybe this (and other) examples need to be updated with this info?

    Thanks for the work on this project though, I think it will be a lort of fun when I get it all working! 🙂


  • Mod

    @skywatch that shouldn't bee needed. Would it be possible for you to post the entire log from when the node was unable to find parent?



  • I'll see if I can replicate it ...been nusy trying to sork out a controller now Heheh.....Not fun!



  • I just uploaded the sketch again without the define and it is working - I didn't clear the eeprom before uploading so maybe that would have made a difference? Is there a list of what is held in eeprom anywhere?



  • Hi instead of using a arduino nano can i use esp8266 for a sensor


  • Mod

    @joseyapor yes you can but the esp8266 has very few usable io pins so connecting a radio and sensor at the same time might be difficult.



  • @joseyapor Yes no problem. 8 digital I/O. One of them a bit problematic as input (used for program mode)



  • Another newbie sorry.
    Trying to use this as a simple doorbell, just to send a trigger to Domoticz.

    I connect doorbell button to digital pin 3, the Node appears in Domoticz ok as a "security sensor" but shows as state "ON". However pressing the button appears to do nothing sadly, switch status stays as on, and log shows no activity at all?

    Using a Uno (clone) and wondering if somethings up with it? 😞


  • Hardware Contributor

    What does the nodes and/or the gateways log say?
    It might not change in domoticz if you just send on but no off signals but it should still be visible in the nodes log (arduino and in domotizc)



  • Hold that thought, embarrassingly it might just be a bad connection! Oops
    Just took it all apart in frustration, had a cuppa and put it back together.
    And something is triggering now, need to play some more, but first hurdle looks like possibly a simply connection maybe.
    I'll let you know.



  • Not sure what I'm doing wrong but I tried to add more than one sensor and didn't get very far. Was hoping to do a motion and a door sensor from the same arduino.



  • As doors and windows are usually not near power sources would it not be better to have this sketch with a SLEEP function and trigger on interupt?



  • what is the logic of the variable "V_TRIPPED"to use? I just messed a little with the MyController application, and by using the V_TRIPPED the value changes from off to on,and stays on,even if the button is released? ( simular to close an opened door)
    Should the variable not be of a binary type with according sensor type?



  • Hi,
    I have my sensor working well, Arduino pro mini with an Ethernet gateway using Home Assistant. .This is the first sensor I'm actually using a battery, so I've never really needed it, I see the battery level in HA as 0, how do I turn that on and use the battery level? Any pointers?
    Thanks!
    Jim



  • Dumb question, but how would I set this sketch to have an array of 5 switches? I’ve tried a couple of things but I’m lost





  • Hi,
    I rewrite sketch for doors/window/buttons to work with multiple buttons (no rellays) .It shows up in Domoticz but it did not change status buttons if pressed.
    Can someone look for the skech what I am doing wrong

    /**
      The MySensors Arduino library handles the wireless radio link and protocol
      between your home built sensors/actuators and HA controller of choice.
      The sensors forms a self healing radio network with optional repeaters. Each
      repeater and gateway builds a routing tables in EEPROM which keeps track of the
      network topology allowing messages to be routed to nodes.
    
      Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
      Copyright (C) 2013-2015 Sensnology AB
      Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    
      Documentation: http://www.mysensors.org
      Support Forum: http://forum.mysensors.org
    
      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      version 2 as published by the Free Software Foundation.
    
    *******************************
    
      DESCRIPTION
    
      Simple binary switch example updated  for 2 switches
      Connect button or door/window reed switch between
      digitial I/O pin 3 (BUTTON_PIN below) and GND.
      http://www.mysensors.org/build/binary
    */
    
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    #define MY_GATEWAY_SERIAL
    
    //#include <SPI.h>
    #include <MySensors.h>
    #include <Bounce2.h>
    
    #define FIRST_PIN  8  // Arduino Digital I/O pin for button/reed switch
    #define noButtons 4
    const int buttonPin[noButtons];
    
    Bounce debouncer[noButtons] = Bounce();
    
    int oldValue[noButtons];
    
    MyMessage msg[noButtons];
    
    void setup() {
    
     for (int i = 0; i < noButtons; i++) {
    
       msg[i].sensor = i;                                   // initialize messages
       msg[i].type = V_TRIPPED; //
    
       pinMode(buttonPin[i + FIRST_PIN], INPUT_PULLUP);
       digitalWrite(buttonPin[i + FIRST_PIN], HIGH);
       debouncer[i] = Bounce();                        // initialize debouncer
       debouncer[i].attach(buttonPin[i + FIRST_PIN]);
       debouncer[i].interval(30);
     }
    }
    
    void presentation() {
     sendSketchInfo("Doors", "1.0");
     for (int i = 0; i < noButtons; i++)
       present(i, S_DOOR);                               // present sensor to gateway
    
    
    }
    
    
    //  Check if digital input has changed and send in new value
    void loop()
    {
     for (int i = 0; i < noButtons; i++) {
       debouncer[i].update();
    
       int value = debouncer[i].read();
       if (value != oldValue[i]) {
    
         // Send in the new value
         send(msg[i].set(value == HIGH ? 1 : 0));
         oldValue[i] = value;
       }
    
     }
    }
    

  • Mod

    @rodaman 0_1474354717994_upload-0e56e228-365f-4d94-90b3-5cf1305c6fae

    I fixed it for you.



  • @mfalkvidd
    thank you, i hope will be good soul who fix my sketch itself to work... 🙂


  • Admin

    @rodaman said in 💬 Door, Window and Push-button Sensor:

    What is the purpose of the buttonPin-array?

    E.g.

    pinMode(buttonPin[i + FIRST_PIN], INPUT_PULLUP);

    This will fetch a random (probably 0-initialised) value from the array and set pinmode on that value...



  • @hek
    That part was in original sketch for establish internal pullup as I understand. I used array to do it for each pins.



  • @hek
    I have changed

    pinMode(buttonPin[i + FIRST_PIN], INPUT_PULLUP);
    

    to

    pinMode(buttonPin[i + FIRST_PIN], INPUT);
    

    thanks, but sadlly still does not work...


  • Admin

    @rodaman said in 💬 Door, Window and Push-button Sensor:

    http://www.mysensors.org/build/binary

    I don't get the buttonPin array thing at all?

    Why not just:
    pinMode(i + FIRST_PIN, INPUT_PULLUP);


  • Mod

    @hek if the array was initialized, it could be used to set arbitrary pins. So pin 4,5,6,7,8,A0,A1,A2,A3 could be used for example (to avoid conflicts with the standard nrf24 wiring but still allow a lot of buttons). But as you mentioned before, without initializing the array the behavior will be strange.



  • @hek said in 💬 Door, Window and Push-button Sensor:

    pinMode(i + FIRST_PIN, INPUT_PULLUP);

    Big Thanks!
    I have changed all array parts in setup in the same manner like above and it works 🙂



  • @rodaman
    Hi,
    Here is a sketch for multi buttons (no relays, no repeated parts of code for each buttons) just enter number of buttons and first digital pin where buttons are attached.
    Thanks to @hek for help...

    /**
       The MySensors Arduino library handles the wireless radio link and protocol
       between your home built sensors/actuators and HA controller of choice.
       The sensors forms a self healing radio network with optional repeaters. Each
       repeater and gateway builds a routing tables in EEPROM which keeps track of the
       network topology allowing messages to be routed to nodes.
    
       Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       Copyright (C) 2013-2015 Sensnology AB
       Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    
       Documentation: http://www.mysensors.org
       Support Forum: http://forum.mysensors.org
    
       This program is free software; you can redistribute it and/or
       modify it under the terms of the GNU General Public License
       version 2 as published by the Free Software Foundation.
    
     *******************************
    
       DESCRIPTION
    
       Simple binary switch example updated  for multi switches
       Connect buttons or door/window reed switches between
       digitial I/O choosen pin  (FIRST_PIN below) and GND.
       http://www.mysensors.org/build/binary
    */
    
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    #define MY_GATEWAY_SERIAL
    
    //#include <SPI.h>
    #include <MySensors.h>
    #include <Bounce2.h>
    
    #define FIRST_PIN  2  // Arduino Digital I/O pin for button/reed switch
    #define noButtons 6
    
    
    Bounce debouncer[noButtons] = Bounce();
    
    int oldValue[noButtons];
    int value;
    MyMessage msg[noButtons];
    
    void setup() {
    
      for (int i = 0; i < noButtons; i++) {
    
        oldValue[i] = -1;
        
        msg[i].sensor = i;                                   // initialize messages
        msg[i].type = V_TRIPPED; //
        pinMode(i + FIRST_PIN, INPUT_PULLUP);
        digitalWrite(i + FIRST_PIN, HIGH);
      
        debouncer[i] = Bounce();                        // initialize debouncer
        debouncer[i].attach(i + FIRST_PIN);
        debouncer[i].interval(3);
      }
    }
    
    void presentation() {
      sendSketchInfo("Doors", "1.0");
      for (int i = 0; i < noButtons; i++)
        present(i, S_DOOR);                               // present sensor to gateway
    }
    
    
    //  Check if digital input has changed and send in new value
    void loop()
    {
      for (int i = 0; i < noButtons; i++) {
        debouncer[i].update();
    
        value = debouncer[i].read();
        if (value != oldValue[i]) {
        // Send in the new value
          send(msg[i].set(value == HIGH ? 1 : 0));
          oldValue[i] = value;
        }
     }
    }
    
    

  • Mod

    Could these reed switches be used in the NC configuration for door/window sensor to save more battery?


  • Hardware Contributor

    @gohan
    yes exactly.
    i made a nrf5 board using this principle.


  • Mod

    did you use those with 3 pins?


  • Hardware Contributor

    yes no-nc reed, connect them to IOs of your mcu and switch between input and output


  • Hardware Contributor

    @gohan said in 💬 Door, Window and Push-button Sensor:

    did you use those with 3 pins?

    I use them, with one wire connected to each interrupt pin (I only activate the one that's not connected) and they work fine.
    Else you can cheat with a basic reed switch, you just need an additional magnet on the other side of your switch that's weaker than the door magnet, and turn your reed 180°.
    You make the weak magnet close the reed when door is opened and far from the strong door magnet. When you close the door the strong magnet will open the reed switch.


  • Mod

    given the low price, I think it is not worth the extra work to "mod" the normal reed switches 😄


  • Plugin Developer

    I'd like to go even simpler:

    • Window is closed - magnet pulls reed switch so that no power flows to the NRF5.
    • Window is opened - The NRF5 now gets power, boots, connects to the MySensors network, and sends a "window is open" message every 10 minutes.
    • Window is closed again - NRF5 loses power.

    Seems to me that this would be quite energy efficient?

    Perhaps build it into this case:
    https://www.aliexpress.com/item/Home-Burglar-Alarm-Wireless-Home-Security-Door-Window-Entry-Burglar-Alarm-System-Magnetic-Sensor-drop-shipping/32876055564.html
    (runs on 2 AAA batteries)


  • Hardware Contributor

    @alowhum
    I would say this technique is efficient depending on the usecase.
    For example, for basic ambiant sensors not needing any security why not. On other side, for main doors which could benefit security, I prefer to use hearbeat with less interval time, so it's possible to know if the sensor is offline. else controller wouldn't know this if the sensor only update when door state change.


  • Plugin Developer

    Totally true.

    I was wondering what the state of Attiny85 support is. For absolute beginners (in workshops) it might be easier to connect the radio to a digispark.

    // cancel that. It could never support encryption.



  • I have some troubles with this device.
    Sometimes it does not respond to the first click, sometimes it remains switched on after first click until second click

    When I press the button once - I see the LED on my gateway blinks always 3 times
    1 RX TX
    2 RX ERR
    3 RX ERR

    Device powered with CR2032 and running on 1Mhz@1.8V (internal clock)
    Button input pulled to GND with resistor 47K and waking up if VCC connected through the button
    Also have a 10uF tantal capacitor on power supply pins +several 0,1uF ceramic capacitors

    Actually I dont know how to debug/log my gateway messages on Linux

    Node code:

    
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    
    #include <MySensors.h>
    
    #define SKETCH_NAME "Door button"
    #define SKETCH_MAJOR_VER "1"
    #define SKETCH_MINOR_VER "0"
    
    #define PRIMARY_CHILD_ID 3
    #define PRIMARY_BUTTON_PIN 2   // Arduino Digital I/O pin for button/reed switch
    //#define BATTERY_SENSE_PIN A6  // select the input pin for the battery sense point
    int oldBatteryPcnt = 0;
    
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
    
    void setup()
    {
      // Setup the buttons
      pinMode(PRIMARY_BUTTON_PIN, INPUT);
      //	pinMode(SECONDARY_BUTTON_PIN, INPUT_PULLUP);
    
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER);
      present(PRIMARY_CHILD_ID, S_DOOR);
    }
    
    // Loop will iterate on changes on the BUTTON_PINs
    void loop()
    {
      uint8_t value;
      static uint8_t sentValue = 2;
    
      // Short delay to allow buttons to properly settle
      sleep(5);
    
      value = digitalRead(PRIMARY_BUTTON_PIN);
    
      if (value != sentValue) {
        // Value has changed from last transmission, send the updated value
        send(msg.set(value == HIGH));
        sentValue = value;
      }
    
      // Sleep until something happens with the sensor
      sleep(PRIMARY_BUTTON_PIN - 2, CHANGE, 0);
    }
    

    Serial data, one line = one button click

    4;3;1;0;16;0
    4;3;1;0;16;1
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;1
    4;3;1;0;16;1
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;1
    4;3;1;0;16;1
    4;3;1;0;16;1
    4;3;1;0;16;1
    4;3;1;0;16;1
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;0
    4;3;1;0;16;1
    4;3;1;0;16;0
    4;3;1;0;16;1
    

  • Mod

    Uncomment the my_debug and you should see all the debug info.



  • @gohan I cant to set correct speed for the serial port because used 1mhz@int osc
    I tried all options...


  • Mod

    You can do it on the gateway at least



  • @gohan already done but not possible to see anything
    Every line was shifted to the right side and finally no space left.
    I use minicom app for monitoring serial port

    ,1-1-0,s=3,c=1,t=16,pt=1,l=1,sg=,1-1-0,s=3,c=1,t=16,pt=1,l=1,sg=0:0
                                                                       ,1-1-0,s=3,c=1,t=16,pt=1,l=1,sg=0;255;3;0;9;3726496 TSF:MSG:READ0:0
                                                                                                                                          1;3;1;0;16;0
                                                                                                                                                      ,1-1-0,s=3,c=1,t=16,pt=1,l=1,sg=0;255;3;0;9;3727488 TSF:MSG:READ0:0
                                                                                                                                                                                                                         1;3;1;0;16;0
                                                                                                                                                                                                                                     ,1-1-0,s=3,c=1,t=16,pt=1,l=1,sg=0;255;3;0;9;3728475 TSF:MSG:READ0:0
                                                                                                                                                                                                                                                                                                        1;3;1;0;16;0
                                                                                                                                                                                                                                                                                                                    ,1-1-0,s=3,c1
                                                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                                                0
                                                                                                                                                                                                                                                                                                                                0
                                                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                                                1
                                                                                                                                                                                                                                                                                                                                =
    
    

    Actually i need to make 100-1000 clicks to catch a fail moment
    Here is working fine


  • Mod

    Can't you just use the arduino ide serial monitor?



  • This post is deleted!


  • This post is deleted!


  • I was build a new button node with new arduino (8mhz) and new nrf24, then update to 2.3.0 gateway and all other devices
    But now have a worse result than before

    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    36 TSF:SID:OK,ID=11
    38 TSM:FPAR
    75 TSF:MSG:SEND,11-11-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    403 TSF:MSG:READ,0-0-11,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    409 TSF:MSG:FPAR OK,ID=0,D=1
    2084 TSM:FPAR:OK
    2084 TSM:ID
    2086 TSM:ID:OK
    2088 TSM:UPL
    2093 TSF:MSG:SEND,11-11-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2099 TSF:MSG:READ,0-0-11,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2105 TSF:MSG:PONG RECV,HP=1
    2109 TSM:UPL:OK
    2111 TSM:READY:ID=11,PAR=0,DIS=1
    2129 TSF:MSG:SEND,11-11-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2138 TSF:MSG:READ,0-0-11,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2168 TSF:MSG:SEND,11-11-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.0
    2179 TSF:MSG:SEND,11-11-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2187 TSF:MSG:READ,0-0-11,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2220 TSF:MSG:SEND,11-11-0-0,s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=OK:Door button
    2230 TSF:MSG:SEND,11-11-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.5
    2240 TSF:MSG:SEND,11-11-0-0,s=3,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2246 MCO:REG:REQ
    2252 TSF:MSG:SEND,11-11-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2260 TSF:MSG:READ,0-0-11,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2267 MCO:PIM:NODE REG=1
    2269 MCO:BGN:STP
    2271 MCO:BGN:INIT OK,TSP=1
    2275 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    2279 TSF:TDI:TSL
    2281 MCO:SLP:WUP=-1
    2283 TSF:TRI:TSB
    2287 TSF:MSG:SEND,11-11-0-0,s=3,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=OK:0
    2295 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    2299 TSF:TDI:TSL
    

    the pressing button twice

    30343 MCO:SLP:WUP=0
    30345 TSF:TRI:TSB
    30347 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    30353 TSF:TDI:TSL
    30355 MCO:SLP:WUP=-1
    30357 TSF:TRI:TSB
    32043 !TSF:MSG:SEND,11-11-0-0,s=3,c=1,t=16,pt=1,l=1,sg=0,ft=3,st=NACK:1
    32049 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    32055 TSF:TDI:TSL
    32057 MCO:SLP:WUP=0
    32059 TSF:TRI:TSB
    32061 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    32067 TSF:TDI:TSL
    32069 MCO:SLP:WUP=-1
    32071 TSF:TRI:TSB
    32073 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    32079 TSF:TDI:TSL
    32081 MCO:SLP:WUP=0
    32083 TSF:TRI:TSB
    32086 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    32092 TSF:TDI:TSL
    32094 MCO:SLP:WUP=-1
    32096 TSF:TRI:TSB
    33779 !TSF:MSG:SEND,11-11-0-0,s=3,c=1,t=16,pt=1,l=1,sg=0,ft=4,st=NACK:0
    33787 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    33794 TSF:TDI:TSL
    

    But no incoming messages at the gateway. Only several random messages coming to controller from one hundred button clicks
    Sometimes after fast series of clicks I get this:

    23179 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23183 !MCO:SLP:TNR
    23185 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23191 !MCO:SLP:TNR
    23218 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23222 !MCO:SLP:TNR
    23224 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23230 !MCO:SLP:TNR
    23257 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23261 !MCO:SLP:TNR
    23263 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23269 !MCO:SLP:TNR
    23296 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23300 !MCO:SLP:TNR
    23302 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23308 !MCO:SLP:TNR
    23336 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23341 !MCO:SLP:TNR
    23343 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23349 !MCO:SLP:TNR
    23377 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23382 !MCO:SLP:TNR
    23384 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23390 !MCO:SLP:TNR
    23418 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23422 !MCO:SLP:TNR
    23425 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23431 !MCO:SLP:TNR
    23459 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23463 !MCO:SLP:TNR
    23465 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23472 !MCO:SLP:TNR
    23500 !TSF:SND:TNR
    23502 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23506 !MCO:SLP:TNR
    23508 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23515 !MCO:SLP:TNR
    23543 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23547 !MCO:SLP:TNR
    23549 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23556 !MCO:SLP:TNR
    23584 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23588 !MCO:SLP:TNR
    23590 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23597 !MCO:SLP:TNR
    23625 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23629 !MCO:SLP:TNR
    23631 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23638 !MCO:SLP:TNR
    23666 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23670 !MCO:SLP:TNR
    23672 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23678 !MCO:SLP:TNR
    23707 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23711 !MCO:SLP:TNR
    23713 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23719 !MCO:SLP:TNR
    23746 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23750 !MCO:SLP:TNR
    23752 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23758 !MCO:SLP:TNR
    23785 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23789 !MCO:SLP:TNR
    23791 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23797 !MCO:SLP:TNR
    23824 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23828 !MCO:SLP:TNR
    23830 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23836 !MCO:SLP:TNR
    23863 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23867 !MCO:SLP:TNR
    23869 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23875 !MCO:SLP:TNR
    23902 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23906 !MCO:SLP:TNR
    23908 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23914 !MCO:SLP:TNR
    23941 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23945 !MCO:SLP:TNR
    23947 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23953 !MCO:SLP:TNR
    23980 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    23984 !MCO:SLP:TNR
    23986 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    23992 !MCO:SLP:TNR
    24014 TSF:MSG:READ,0-0-11,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    24020 TSF:MSG:FPAR OK,ID=0,D=1
    24025 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24029 !MCO:SLP:TNR
    24031 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24037 !MCO:SLP:TNR
    24064 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24068 !MCO:SLP:TNR
    24070 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24076 !MCO:SLP:TNR
    24104 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24109 !MCO:SLP:TNR
    24111 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24117 !MCO:SLP:TNR
    24145 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24150 !MCO:SLP:TNR
    24152 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24158 !MCO:SLP:TNR
    24186 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24190 !MCO:SLP:TNR
    24193 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24199 !MCO:SLP:TNR
    24227 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24231 !MCO:SLP:TNR
    24233 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24240 !MCO:SLP:TNR
    24268 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24272 !MCO:SLP:TNR
    24274 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24281 !MCO:SLP:TNR
    24309 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24313 !MCO:SLP:TNR
    24315 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24322 !MCO:SLP:TNR
    24350 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24354 !MCO:SLP:TNR
    24356 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24363 !MCO:SLP:TNR
    24391 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24395 !MCO:SLP:TNR
    24397 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24403 !MCO:SLP:TNR
    24432 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24436 !MCO:SLP:TNR
    24438 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24444 !MCO:SLP:TNR
    24471 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24475 !MCO:SLP:TNR
    24477 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24483 !MCO:SLP:TNR
    24510 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24514 !MCO:SLP:TNR
    24516 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24522 !MCO:SLP:TNR
    24549 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24553 !MCO:SLP:TNR
    24555 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24561 !MCO:SLP:TNR
    24588 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24592 !MCO:SLP:TNR
    24594 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24600 !MCO:SLP:TNR
    24627 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24631 !MCO:SLP:TNR
    24633 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24639 !MCO:SLP:TNR
    24666 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24670 !MCO:SLP:TNR
    24672 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24678 !MCO:SLP:TNR
    24705 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24709 !MCO:SLP:TNR
    24711 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24717 !MCO:SLP:TNR
    24745 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24750 !MCO:SLP:TNR
    24752 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24758 !MCO:SLP:TNR
    24786 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24791 !MCO:SLP:TNR
    24793 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24799 !MCO:SLP:TNR
    24827 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24832 !MCO:SLP:TNR
    24834 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24840 !MCO:SLP:TNR
    24868 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24872 !MCO:SLP:TNR
    24875 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24881 !MCO:SLP:TNR
    24909 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24913 !MCO:SLP:TNR
    24915 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24922 !MCO:SLP:TNR
    24950 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24954 !MCO:SLP:TNR
    24956 MCO:SLP:MS=25,SMS=0,I1=255,M1=255,I2=255,M2=255
    24963 !MCO:SLP:TNR
    24991 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    24995 !MCO:SLP:TNR
    24997 MCO:SLP:MS=25,
    

    Then it continue works as before

    Actually I have problems only with fu@ing button, most simplest device. Several month I can't to start use it.
    All other devices are working properly even on 2.3.0 ver. 😜


  • Mod

    Have you tried with a debouce? Just in case...



  • This post is deleted!


  • @gohan the default sketch with debounce library works better, but now i see my primary problem.
    Occasionally I have an ACK errors

    4231 TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0
    4239 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    4245 TSF:TDI:TSL
    4247 MCO:SLP:WUP=0
    4249 TSF:TRI:TSB
    4290 !TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=NACK:1
    4298 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    4302 TSF:TDI:TSL
    4304 MCO:SLP:WUP=0
    4306 TSF:TRI:TSB
    4313 TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:0
    4321 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255
    

    I tried to icrease the time ack on my controller - it does not help
    Ithink that I need to ckeck ack state on the node and send the message again, but have no idea how to do


  • Mod

    you are at the limit of the radio range I'd say so randomly it looses a message, so you need to either increase power or get a better antenna (I hope you aren't using any buck/boost converter as power supply)



  • @gohan how you know?
    Id 21 from range 0..255. Are you sure that is limit?

    Same with any different IDs, I tried sending message 3 times, this guarantees delivery of payload, but it using too much power

    Now I use power supply with 1117

    But my other nodes powered by CR2032 with boost 0.8-3.3V dc/dc with inductor coil on the NRF24 supply pin without any troubles


  • Hardware Contributor

    @pavel-polititsky said in 💬 Door, Window and Push-button Sensor:

    @gohan how you know?
    Id 21 from range 0..255. Are you sure that is limit?

    He means radio range (distance) not ID of node 😉



  • @nca78 oke, undestood
    Problem stiil not resolved. I want to send message again to the gateway if NACK but dont know how to do it.

    send(msg.set(value == HIGH), true); 
    

    in this case i have additional ack log in the serial debug, nothing more


  • Mod

    The send function returns a value, so you can check if it was successfully sent or not and in case retry


  • Plugin Developer

    A quick ACK example:

            static boolean tryAgainLater = false; // should we resend?
    
            if(send(msgDust.setSensor(CHILD_ID_DUST_PM25).set(sensorValue),1)){
              Serial.println(F("Received ACK"));
              tryAgainLater = false;
            }else {
              Serial.println(F("Connection problem, try again"));
              tryAgainLater = true;
            }
    

  • Mod

    There is no need to set the second parameter to send() to true. That parameter is unrelated to the return value (except very unfortunate similar naming). More info: https://github.com/mysensors/MySensors/issues/1103


  • Plugin Developer

    @mfalkvidd said in 💬 Door, Window and Push-button Sensor:

    https://github.com/mysensors/MySensors/issues/1103

    Ah, thanks. So ACK basically always happens?

    in that case, do you have any better example code on how to check if the ACK is received?


  • Mod

    @alowhum on nrf24, "hardware" ack is always on. "Software" ack is controlled by the second parameter in the send() function. Read https://forum.mysensors.org/post/34267 for an attempt to sort out the details. It is still quite confusing for me.



  • What will happen if i cut the power OFF of the radio after each transmission? is it needed to be initialize again before next transmission?


  • Mod

    @tiana yes.

    But don't cut the power. Use transportDisable and transportReInitialize instead.



  • Do you know how much will be power usage in transportDisable mode?


  • Mod

    @tiana depends on which transport you are using, and if using genuine or clone chips. The nrf24 is rated for 900nA.



  • Thanks for fast reply, actually 900nA is to big number and i prefer to use xxx_POWER_PIN to cut the power of the NRF module.
    I am building switch powered with CR2032 battery and i want to extend battery live as much as possible, for a switch is not needed to keep radio alive, i need it ON only when transmit signal


  • Mod

    @tiana 900nA on a cr2032 is 27.9 years battery life. The self discharge of a cr2032 is around 250nA.
    But yes, use the power pin setting if you want to.

    Would be interesting to see how long sleep times are needed to make up for the extra time needed to wake up the radio from power off compared to sleep. The mcu and the radio will need to be awake for 100ms longer time when starting from power off than when starting from sleep.


Log in to reply
 

Suggested Topics

  • 3
  • 5
  • 2
  • 109
  • 164
  • 109

68
Online

11.4k
Users

11.1k
Topics

112.7k
Posts