RFM69HW: Some node are losing connection after few days



  • Hello Guys
    First of all I have to declare that I'm a big fan of Mysensors, I have now a dizain of node and building those and making it tailormade is just GREAT. Having said that, I have from time to time, lets say after a week of working fine, some node that disconnect and cannot be controled. When it is the case I have to manually reset the arduino, and then it' fine again for another couple of days.
    My configuration is RFM69HW + arduino and JEEDOM as a controler.

    Anyone else encounters same issues? Any suggestion or help?

    Would be great as this is currenlty the only cons I have in using Mysensors...



  • If you connect your laptop to the node's serial output, do you see some output in the serial monitor? Does the Arduino still communicate via the serial monitor?

    If yes, the arduino is still working --> it can be the radio (is the antenna soldered in a correct way, is the elco capacitor soldered correctly, ...)

    If no, the arduino is soft crashed for some reason.
    Do you have other working nodes with the same sketch? If yes, the sketch should be correct because the other nodes are still working after x days.
    If no, there could be a software problem. But then we have to see the sketch...



  • @evb thanks for your answer. On my arduino pro mini, the red led is not blinking anymore when it occurs (ie I use a node as a door bell, and when I click on the button, when it is working fine the red led blinks when sending data to the gateway). So I would rather bet, arduino failure.

    I'm using 3.3V from arduino itself to power the RFM69HW. Is it better to use another source? I will try to power RFM in direct from power source, and will let you know if node still crashes after a couple of days/weeks.

    I post below the easiest sketch (door bell) on which I'm suffering those connection losses on, in case you notice something missing or wrong, please let me know, but again this is very basic...

    Thanks a lot for your help!

    
    //
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    
    #define MY_REPEATER_FEATURE
    #define MY_NODE_ID 21
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RFM69_433MHZ // Set your frequency here
    #define MY_IS_RFM69HW // Omit if your RFM is not "H"
    
    
    #include <MySensors.h>
    #include <Bounce2.h>
    
    #define CHILD_ID 3
    #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
    #define BUTTON_RESET 4
    
    Bounce debouncer = Bounce(); 
    int oldValue=1;
    
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(CHILD_ID,V_TRIPPED);
    MyMessage msg2(4,V_STATUS);
    
    void setup()  
    {  
      // Setup the button
      pinMode(BUTTON_PIN,INPUT);
     
      // Activate internal pull-up
     digitalWrite(BUTTON_PIN,HIGH);
    //  digitalWrite(BUTTON_RESET,HIGH);
      
      // After setting up the button, setup debouncer
      debouncer.attach(BUTTON_PIN);
      debouncer.interval(5);
    }
    
    void presentation() {
        sendSketchInfo("Sonette", "1.0");
      present(CHILD_ID, S_DOOR);  
    }
    
    void loop() 
    {
      debouncer.update();
      // Get the update value
      int value = debouncer.read();
    
      if (value != oldValue) {
         // Send in the new value
         send(msg.set(value==HIGH ? 1 : 0));
         oldValue = value;
      }
    }
    
      void receive(const MyMessage &message)
    {
    
      if (message.sensor == 4) {
    Serial.print(" reset");
     pinMode(BUTTON_RESET,OUTPUT);
    digitalWrite(BUTTON_RESET,LOW);
      }
        
      
    }
    


  • @Stab power failure can be a reason, so this can be a good test.
    If it fails again, then we are sure that it is not the 3.3V from the pro mini who is to weak.
    If it fails not, we have the solution 🙂

    If I understand correctly, the door bell button is connected directly to the pin 3 of the arduino. When pushed it takes the pin 3 to the ground GND?
    How long are the wires between the button and the arduino? Are they shielded?
    Long wires can act as antenna's and inject directly faults into the pins of the arduino causing crashes of the Arduino or even the dead of the Arduino.
    The best way to avoid these problems is to use an optocoupler.
    Search on Google on the keywords "button optocoupler arduino" and you will find a schema.
    You can find a good explication on: https://www.electronics-tutorials.ws/io/input-interfacing-circuits.html
    If an optocoupler is a bridge to far, you can also start with putting a little 100nF capacitor directly between Pin3 and the ground, as close to the arduino as possible. It will act as a high frequency killer.

    I don't see strange things in your sketch, so it should be oké.
    Must the node act as a repeater?
    If not, set the define in comment to have the bare minimum....

    On a pro mini, there is no standard serial connection, I think.
    Otherwise you could directly connect a laptop to see the debugging messages.


Log in to reply
 

Suggested Topics

53
Online

11.4k
Users

11.1k
Topics

112.6k
Posts