RSSI and SNR on SX1276 #1007
Replies: 2 comments 2 replies
-
I seem to have dropped this (like a lot of other things) when the pandemic hit. Did you check this comment? I think I cryptically indicated the answer ("need to subtract What are your values (close to the gateway) of uint16_t packetRssi = ((uint8_t)LMIC.rssi) + RSSI_OFF;
int8_t packetSnr = LMIC.snr;
int rssi;
int snr = LMIC.snr / 4;
if (packetSnr > 0)
{
// -157 + 16/15 * PacketRssi, rounded
rssi = (-157 + (16 * packetRssi + 7) / 15);
}
else
{
// -157 + PacketRssi + PacketSnr * 0.25
rssi = (-157 + (packetRssi * 4 + packetSnr + 2) / 4);
}
Serial.println(rssi);
Serial.println(snr); |
Beta Was this translation helpful? Give feedback.
-
I didn't look at the code. Since int16_t packetRssi = LMIC.rssi + RSSI_OFF;
int8_t packetSnr = LMIC.snr;
float rssi;
float snr = LMIC.snr / 4.0f;
if (packetSnr > 0)
{
// -157 + 16/15 * PacketRssi, rounded
rssi = (-157 + (16.0f * packetRssi) / 15.0f);
}
else
{
// -157 + PacketRssi + PacketSnr * 0.25
rssi = (-157 + (packetRssi * 4 + packetSnr) / 4.0f);
}
Serial.println(rssi);
Serial.println(snr); Or for the original integer approach: int16_t packetRssi = LMIC.rssi + RSSI_OFF;
int8_t packetSnr = LMIC.snr;
int rssi;
int snr = LMIC.snr / 4;
if (packetSnr > 0)
{
// -157 + 16/15 * PacketRssi, rounded
rssi = (-157 + (16 * packetRssi + 7) / 15);
}
else
{
// -157 + PacketRssi + PacketSnr * 0.25
rssi = (-157 + (packetRssi * 4 + packetSnr + 2) / 4);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
So I'm trying to get a simple sketch to connect to a gateway, join using OTAA and send confirmed messages at interval to measure the RSSI and SNR. Following the examples I got all of that working relatively easily on a Lilygo TTGO V2 1.6.1 (SX1276) but I really can't make sense of the RSSI and SNR values.
I did check around the issues (and google) before asking here, and I can see related discussions such as, #493 and #369 but i'm far from convinced with the calculated values (using #369 (comment))
Few meters away from the gateway (I know it shouldn't be too close) I get a RSSI of ~-130/-140 and an SNR of 5 at the microcontroller. Checking on chirpstack the gateway has a RSSI of -55 and a SNR of ~12, I know it's 2 different radios so I'm not expecting a match but that's a very very significant difference in calculated rssi/snr (and I think it's more a calculation discrepancy)
Does anyone know if the following code is correct (from #369) or if another calculation is necessary?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions