RFM95W on my custom PCB only works over short distances

Started by renatotavares, August 18, 2016, 03:57:14 PM

renatotavares

I built a board using RFM95W (attached image) and it works very well at short distances (less than 30cm) but at distances up to 1m radio can not transmit.

Really this is very strange, because I tested these radios few days ago and got transmission over 3km. Now they no longer work in larger distances.

Someone has been there, have any idea?

client

#include <RHReliableDatagram.h>
#include <RH_RF95.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2
#define RF95_FREQ 915.0

RH_RF95 rf95(RFM95_CS, RFM95_INT);
RHReliableDatagram manager(rf95, CLIENT_ADDRESS);

uint8_t data[] = "Hello World!";
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];

void setup()
{
    Serial.begin(9600); delay(50);

    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);

    pinMode(RFM95_RST, OUTPUT);
    digitalWrite(RFM95_RST, HIGH);

    Serial.println("Arduino LoRa TX Test!");

    // manual reset
    digitalWrite(RFM95_RST, LOW); delay(10);
    digitalWrite(RFM95_RST, HIGH); delay(10);

    while (!rf95.init()) {
        Serial.println("LoRa radio init failed");
        while (1);
    }

    Serial.println("LoRa radio init OK!");
  
    if (!rf95.setFrequency(RF95_FREQ)) {
        Serial.println("setFrequency failed");
        while (1);
    }

    Serial.print("Set Freq to: ");
    Serial.println(RF95_FREQ);

    rf95.setTxPower(23, false);

    if (!manager.init()) {
        Serial.println("init failed");
    }

    //manager.setTimeout(3000);
    //manager.setRetries(0);
}


void loop()
{
    if (manager.sendtoWait(data, sizeof(data), SERVER_ADDRESS)) {
        // Now wait for a reply from the server
        uint8_t len = sizeof(buf);
        uint8_t from;
        if (manager.recvfromAckTimeout(buf, &len, 2000, &from)) {
          Serial.print("got reply from : 0x");
          Serial.print(from, HEX);
          Serial.print(": ");
          Serial.println((char*)buf);
        }
    else {
        Serial.println("No reply, is rf95_reliable_datagram_server running?");
    }
  } else {
        Serial.println("sendtoWait failed");
  }
  delay(1000);
}


#include <RHReliableDatagram.h>
#include <RH_RF95.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2
#define RF95_FREQ 915.0

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);
RHReliableDatagram manager(rf95, SERVER_ADDRESS);


uint8_t data[] = "And hello back to you";
// Dont put this on the stack:
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];

void setup() 
{
    Serial.begin(9600); delay(50);

    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);
    
    pinMode(RFM95_RST, OUTPUT);
    digitalWrite(RFM95_RST, HIGH);
    
    Serial.println("Arduino LoRa TX Test!");  

    // manual reset
    digitalWrite(RFM95_RST, LOW);
    delay(10);
    digitalWrite(RFM95_RST, HIGH);
    delay(10);
  
    while (!rf95.init()) {
        Serial.println("LoRa radio init failed");
        while (1);
    }
    
    Serial.println("LoRa radio init OK!");
 
    // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
    if (!rf95.setFrequency(RF95_FREQ)) {
        Serial.println("setFrequency failed");
        while (1);
    }
    
    Serial.print("Set Freq to: "); 
    Serial.println(RF95_FREQ);
  
    rf95.setTxPower(23, false);
    
    if (!manager.init()) {
        Serial.println("init failed");
    }
    //manager.setTimeout(1000);

}



void loop()
{
  if (manager.available())
  {
    // Wait for a message addressed to us from the client
    uint8_t len = sizeof(buf);
    uint8_t from;
    if (manager.recvfromAck(buf, &len, &from))
    {
      Serial.print("got request from : 0x");
      Serial.print(from, HEX);
      Serial.print(": ");
      Serial.println((char*)buf);

      // Send a reply back to the originator client
      if (!manager.sendtoWait(data, sizeof(data), from))
        Serial.println("sendtoWait failed");
    }
  }
}


my board




renatotavares

I discovered what makes the radios work only near each other, but do not know the cause of the problem. The RSSI is always above -88, when I tested these radios for the first time, the RSSI was always at -25 maximum - 30

What may have made the radios lose senssibilidade this way? Is it problem with my antenna? I have three radios and all with the same behavior.

Felix

Probably the antenna or some bad coupling somewhere.
Try bending it perpendicular to your PCB.
Or try to solder a simple straight up 164mm wire instead of what you got now.

renatotavares

Only to be confused my mind even more. If I colcoar your finger on the radio IC or even touch the IC with the tip of the multimeter, the RSSI drops to -50 or -60. It is not normal but is much smaller than the -99 I'm currently having

Felix

Yes, you become the antenna ;)

So your antenna is probably very badly mismatched and your signal might be reflecting back into the RF chip, possibly damaging it in the long run. My guess is only a very tiny amount of signal propagates in the air hence your very low signal strength.

Try my suggesion of replacing your coil antenna with a straight 164mm wire (for 915mhz).

renatotavares

Felix, you are the best! I replaced the original antenna by a wire (these network cable wires) and the RSSI dropped from -99 to -60. The distance transmission now jumped from a few centimeters to a few meters. Unfortunately I'm not getting the same quality when I bought the radio. RSSI in the first test was only -30 now even less than 40 cm The RSSI is greater than -60.

Do these radios are damaged forever? How do I know if it really were the antennas I bought that were with the wrong values? Is there any equipment that measures the actual frequency of an antenna?

My fear is to question the seller about the antenna quality, but what really made the radio stop was my poor layout  :(

Felix

Your PCB layout could still have an impact. If it's damaged it's hard to tell. The only way to know is to get another known good module and compare in the same conditions.
The antenna does not influence the frequency. But you can use a spectrum analyzer or SDR to look at the frequency.

renatotavares

#7
I discovered the problem.

After changing my antennas and buy new radios, I found that the problem of communication only short distances (and also high RSSI) is related to the use of RHReliableDatagram class.

When I use the example without using Addressed messages, RSSI and quite low and radios operate over long distances. When I use the RHReliableDatagram class with the code above, the RSSI is very bad, and I can only communication short ditancias.

Has anyone ever experienced this? What am I doing wrong?

jhoward88

Quote from: renatotavares on August 23, 2016, 02:51:25 PM
I discovered the problem.

After changing my antennas and buy new radios, I found that the problem of communication only short distances (and also high RSSI) is related to the use of RHReliableDatagram class.

When I use the example without using Addressed messages, RSSI and quite low and radios operate over long distances. When I use the RHReliableDatagram class with the code above, the RSSI is very bad, and I can only communication short ditancias.

Has anyone ever experienced this? What am I doing wrong?

I'm having the exact same problem with the RF95.  It seems any settings I make regarding power level, modem config etc. no longer have an effect if I use the RHReliableDatagram as manager in order to get addressing and automatic acks.  With the same RH_RF95 settings I get great distances without the manager and terrible distance with the manager.  I've tried changing the driver settings both before and after the manager init, but no combinations work.  If anyone knows how to fix this problem let us know.
Thanks,  Jerry

jhoward88

I have made some progress on this issue.  It turns out that if you do the
    rf95.setFrequency(915);
    rf95.setTxPower(22, false);

AFTER the manager.init()  then the power setting takes effect.  I'm now getting good RSSI after I do it that way.

-Jerry