LowPowerLab Forum

Hardware support => Moteino => Topic started by: Explorer on September 15, 2014, 11:07:39 AM

Title: Code RFM69.cpp question for canSend() RSSI test
Post by: Explorer on September 15, 2014, 11:07:39 AM
Hi,
Should the test for RSSI be ">" not "<" in canSend() since these are negative numbers?
bool RFM69::canSend()
{
  if (_mode == RF69_MODE_RX && PAYLOADLEN == 0 && readRSSI() < CSMA_LIMIT) //if signal stronger than -100dBm is detected assume channel activity
  {
    setMode(RF69_MODE_STANDBY);
    return true;
  }
  return false;
}
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Felix on September 15, 2014, 01:48:43 PM
Lower (more negative) is less signal strength (ie a farther transmitting node will have lower value than a closer transmitting node, receiving base being the same).
To give some numbers ... -100dBm is very weak, compared to -60dBm. A -30dBm signal is very strong.
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Explorer on September 15, 2014, 07:35:39 PM
So if I get -30 from readRSSI(), isn't that greater than -100 for the condition to be true and canSend returns true?
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Felix on September 15, 2014, 10:53:29 PM
Yes -30 > -100
How you interpret it is up to you.
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Explorer on September 16, 2014, 12:52:39 AM
So...  should the code I referred to be change to > from <?
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Felix on September 16, 2014, 07:47:57 AM
No
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Explorer on September 17, 2014, 03:02:35 PM
Thanks - was thinking in reverse (that it needed a good RSSI)
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Felix on September 17, 2014, 03:15:48 PM
well the farther a transmitter is the weaker signal and (RSSI lower as in more towards -100 which is the limit in the lib by default). The decrease is logarithmic not linear, quite important to mind that detail.
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Explorer on September 17, 2014, 03:33:51 PM
Yes, I understand.  Wondering if a great way to save power & battery life  is to have code to adjust the transmitter power based on the RSSI received (-30db means that the gateway would not need to be full power, but at -80db keep all PA's on)?
Thanks
Title: Re: Code RFM69.cpp question for canSend() RSSI test
Post by: Felix on September 17, 2014, 04:17:02 PM
RX mode doesn't have power levels only the TX mode. So you'd have to tell your node to turn power lower. Doable, but I'd like metrics before I recommend that.