RFM69HW 915Mhz collection lost

Hi All,

I have a strange behavior, where connection to the RFM69HW gateway is lost by action nodes.

Setup:
All RFM69HW915Mhz are configured at 868Mhz.

Gateway: Arduino UNO + logic level convert + RFM69HW

All nodes Arduino nano v3 + logic level convert + RFM69HW

Power to RFM69HW
+5v from Arduino (UNO/NANO) → to 0.1uF ceramic capacitor > LD1117V33 (PIN3), LD1117V33 (PIN1 GND) and LD1117V33 (PIN2) → ALUM 47UF 25V > 0.1uF ceramic capacitor

I have total 3 sensor nodes connected with LDR, DTH11 and reed switch. all the sensor nodes are working fine, every 5 min data is sent to the gateway. Issue is with Action nodes, action nodes are basically input button and output pins connected to relay. I need to reset the action node after every couple of hours. Only then it will connect to the gateway. I have no idea what is wrong with the action node. Someone please help me to find what is my fault.

One thing to check is current draw. The RF board spec says it draws 130mA at max power. The Uno 5v line has a limit of 200mA. If you have other circuits running from the 5v line then you may be exceeding the Uno rating. Also, if the TX is left on continuous then the regulator will heat up and may trip out from overtemp. It might be a better idea to move the 3v3 regulator input to the raw supply that the Uno is using. The regulator will get warmer but it's better designed to do so, especially with an attached heat sink.

@remyalmeida

When you say the nodes lost connectivity, what that actually you mean? Have a look on some question/points below. It might help you debugging the issue:

  • The nodes stop transmitting AND receiving? How are you checking it?

  • How do you recover the connectivity? If you simply restart the whole Arduino + RFM69 it might be something else, like Out-of-memory behavior in the Arduino. Any way you can prove the Arduino still happy and haven't stopped/restarted as well?

  • Does it happens to all nodes at same time? - if yes the gateway might be the problem ;)

  • How often it happens? Have you noticed if there's something to do with the nodes uptime, number of exchanged messages or it's completely random?

  • Why do you pointed it to be a RFM69 power supply failure? Have you checked if it actually restarts? - You might be able to check it by looking one of the RFM69 registers. Change the register value to something else and keep "printing" it. If it suddenly change to the default value at same time your node losts connectivity, yes, it's restarting.

  • Do you have any other device connected to the Arduino SPI? If yes, you need to make sure you use atomic SPI transactions.

  • What RFM69 driver are you using, if any?

Please post as much details you can so it'll make easier to think what might be going wrong? From my experience Arduino running out of memory is a common problem, and many times difficult to diagnose. One idea is to keep sending the "free memory" to your gateway from time to time... if it's continualy decreasing you have a memory leak.

Cheers, Mike M.

musskopf: @remyalmeida

When you say the nodes lost connectivity, what that actually you mean? Have a look on some question/points below. It might help you debugging the issue:

  • The nodes stop transmitting AND receiving? How are you checking it?

-- I have an LED connected to PIN 9 of Arduino which is turned on during RX/TX and turned off at the start of the loop() function.

  • How do you recover the connectivity? If you simply restart the whole Arduino + RFM69 it might be something else, like Out-of-memory behavior in the Arduino. Any way you can prove the Arduino still happy and haven't stopped/restarted as well?

-- My sketch uses 7,448 bytes (24%) of program storage space. Maximum is 30,720 bytes.

  • Does it happens to all nodes at same time? - if yes the gateway might be the problem ;)

-- As mention in my initial post, it only happens to the action nodes and that too, not at the same time.

  • How often it happens? Have you noticed if there's something to do with the nodes uptime, number of exchanged messages or it's completely random?

-- Its mostly random, It will stay up for couple of hours, I have noticed minimum 10 to 12 hours.

  • Why do you pointed it to be a RFM69 power supply failure? Have you checked if it actually restarts? - You might be able to check it by looking one of the RFM69 registers. Change the register value to something else and keep "printing" it. If it suddenly change to the default value at same time your node losts connectivity, yes, it's restarting.

-- I don't think it is restarting as the RX/TX LED at pin 9 remains on until I restart. Every 10min, gateway is pulling RSSI from all the nodes. All 3 sensor nodes will respond to the gateway, but for both action nodes, gateway will report as connection lost and at the same time if I go and press the push button on the action node, the relay associate to the respective push button will turn on/off the AC lights, but the TX LED at pin 9 remains on always and it prints "Trying again" message. This message is printed if radio.sendWithRetry returns false.

I am using the default registers values, which I guess it is 0x1A, 0x0B.

  • Do you have any other device connected to the Arduino SPI? If yes, you need to make sure you use atomic SPI transactions.

-- no

  • What RFM69 driver are you using, if any?

-- RFM69 library at: https://github.com/LowPowerLab/

Please post as much details you can so it'll make easier to think what might be going wrong? From my experience Arduino running out of memory is a common problem, and many times difficult to diagnose. One idea is to keep sending the "free memory" to your gateway from time to time... if it's continualy decreasing you have a memory leak.

As indicated by @Arctic_Eddie, I too suspected it as current issue, but I was not sure. Last night I did the changes as suggested by @Arctic_Eddie.

INFO: I have 2 channel relay module (SRD-05VDC-SL-C) to turn on/off AC lights and TIP121 to turn on/off 12v 2A LED strip. I think SRD-05VDC-SL-C need 100mA and Arduino can supply only 40mA. This is why I suspected it is current issue, but was not sure. Thanks @Arctic_Eddie for the hint. I have done the change as you have suggested

Cheers, Mike M.

Thank you Mike for your help. I will update the status after monitoring for the whole day.

Two comments based on your answer:

  1. The memory I mention is the RAM, not the Flash memory. You haven’t answered how to you recover/fix the dead nodes, do you restart the whole node?

  2. If the Arduino hangs in an Out-of-memory situation, is very likely the LED on PIN 9 will stay on. I would change a bit your code and make the LED blink ever second for 10ms (non-blocking pls) as a heat beat and during TX/RX it can blink 3 times very quickly in a 10ms ON, 100ms OFF…

If you suspect about lack of current add a very large resistor in series to your LED. Even small LEDs can draw as much as 50mA if you don’t have the right resistor… just make some tests with a multi-meter and read the current choosing the largest resistor you can.

Cheers,
Mike M.

musskopf: Two comments based on your answer:

  1. The memory I mention is the RAM, not the Flash memory. You haven't answered how to you recover/fix the dead nodes, do you restart the whole node?

-- Right, the whole node

  1. If the Arduino hangs in an Out-of-memory situation, is very likely the LED on PIN 9 will stay on. I would change a bit your code and make the LED blink ever second for 10ms (non-blocking pls) as a heat beat and during TX/RX it can blink 3 times very quickly in a 10ms ON, 100ms OFF....

-- I will definitely do this.

If you suspect about lack of current add a very large resistor in series to your LED. Even small LEDs can draw as much as 50mA if you don't have the right resistor... just make some tests with a multi-meter and read the current choosing the largest resistor you can.

-- I have connect yellow LED 5mm with 1k resistor.

Cheers, Mike M.

Once again thanks a lot for the suggestions.

@Arctic_Eddie, no luck I have the same issue.

@Mike M. issue here. (radio.sendWithRetry(GATEWAYID, (const void*)(&mes), sizeof(mes), 5))

radio.sendWithRetry wait for a long long time and fails

There is a way of monitoring the remaining RAM. It involves using a couple of system variables and a simple calculation. I used it in one of my early Uno projects and will search for it now.

Found it. Now runs on the Teensy 3.2. Had to make a couple of type changes as it would not compile on any board. The two extern variables were originally declared of type void but it works with uint16_t.

// Put this in global variables
extern uint16_t __bss_end;
extern uint16_t *__brkval;

// Put this with your other functions
int get_free_memory()
{
    int free_memory;

    if((int)__brkval == 0)
        free_memory = ((int)&free_memory) - ((int)&__bss_end);
    else
        free_memory = ((int)&free_memory) - ((int)__brkval);

    return free_memory;
}

//Put this in loop()
    Serial.print( "Available memory = " );
    Serial.println( get_free_memory() );

Solve, node up and running for last 3 days.

Had to create RC snubber as mentioned here http://forum.arduino.cc/index.php?topic=200393.0