RFM69 almost no range. RSSI -80 @ 10cm distance [solved]

Started by Istria, May 31, 2016, 01:29:05 PM

Istria

Hi Guys,

I'm starting to give up over here. No idea what I screwed up...

A couple of days ago I had 2 Moteinos running perfectly on my breadboard with my own code. Then I soldered them up in the application, and it didn't work anymore...

By now I have desoldered everything again and I'm back at 2 Moteinos on a breadboard. But still not working right... Even went back to the Gateway and Node examples.

Current setup:
2x Moteino RFM69HW
2x PL2303 USB to Serial (also powering the Moteinos)
2x Standard wire antenna (one of them broke off, so I soldered it back on)
Standard Gateway and Node example code from library (only uncommented the 69HW part on both).

Notes:
When it all worked flawlessly I was using FTDI chips. But I fried them both by accident, so using the PL2303s now.

Results:
The Gateway receives the Node when standing 10-20cm apart. RSSI -80. When I move them 50cm apart the link is gone. When I touch one of the antennas with my hands, its gone.

Questions:
1. The wire antenna connection is through hole. I just soldered it back into the solder pool on the top. Would this matter? I checked for continuity with a multimeter.

2. Could it have to do with the PL2303 instead of the FTDI? Thought it might not get enough power to transmit, but same result connected to 12v lead battery.

3. After the antenna broke off I had to trim some 2-3mm off the antenna before soldering it back in. I tried soldering on a longer wire (original + 10cm), and trimming it mm by mm. Didn't seem to have much effect on the RSSI.

4. What the heck can I try? Did I fry the Moteino somehow? I payed attention while soldering not to get anything too hot...

Any tips would be greatly apprecieted. I was really hoping to get it all done tonight. =(
Thanks in advance!

#[110][2] 123 ABCDEFGHIJKLMNOPQR   [RX_RSSI:-84] - ACK sent.
#[111][2] 123 ABCDEFGHIJKLMNOPQRS   [RX_RSSI:-83] - ACK sent.
#[112][2] 123 ABCDEFGHIJKLMNOPQRST   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...nothing
#[113][2] 123 ABCDEFGHIJKLMNOPQRSTU   [RX_RSSI:-82] - ACK sent.
#[114][2] 123 ABCDEFGHIJKLMNOPQRSTUV   [RX_RSSI:-84] - ACK sent.
#[115][2] 123 ABCDEFGHIJKLMNOPQRSTUVWX   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...ok!
#[116][2] 123 ABCDEFGHIJKLMNOPQRSTUVWXY   [RX_RSSI:-83] - ACK sent.
#[117][2] FLASH_MEM_ID:0x0   [RX_RSSI:-85] - ACK sent.
#[118][2] 12   [RX_RSSI:-84] - ACK sent. Pinging node 2 - ACK...nothing
#[119][2] 123   [RX_RSSI:-84] - ACK sent.
#[120][2] 123    [RX_RSSI:-81] - ACK sent.
#[121][2] 123 A   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...nothing
#[122][2] 123 ABC   [RX_RSSI:-84] - ACK sent.
#[123][2] 123 ABCD   [RX_RSSI:-86] - ACK sent.
#[124][2] 123 ABCDE   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...nothing
#[125][2] 123 ABCDEF   [RX_RSSI:-85] - ACK sent.
#[126][2] 123 ABCDEFGHI   [RX_RSSI:-85] - ACK sent.
#[127][2] 123 ABCDEFGHIJ   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...nothing
#[128][2] 123 ABCDEFGHIJKLMNO   [RX_RSSI:-83] - ACK sent.
#[129][2] 123 ABCDEFGHIJKLMNOP   [RX_RSSI:-82] - ACK sent.
#[130][2] 123 ABCDEFGHIJKLMNOPQR   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...nothing
#[131][2] 123 ABCDEFGHIJKLMNOPQRS   [RX_RSSI:-84] - ACK sent.
#[132][2] 123 ABCDEFGHIJKLMNOPQRST   [RX_RSSI:-84] - ACK sent.


EDIT: Just found out the RSSI of the ACK (the gateway transmitting to the node) is -23db. So it transmits fine from Gateway to Node, but not the other way around..
[1] ACK TEST   [RX_RSSI:-28] - ACK sent
Sending[7]: 123 ABC ok!
Sending[8]: 123 ABCD ok!
Sending[9]: 123 ABCDE ok!
[1] ACK TEST   [RX_RSSI:-28] - ACK sent
Sending[10]: 123 ABCDEF ok!
Sending[11]: 123 ABCDEFG ok!
Sending[12]: 123 ABCDEFGH ok!
[1] ACK TEST   [RX_RSSI:-28] - ACK sent
Sending[13]: 123 ABCDEFGHI ok!
Sending[14]: 123 ABCDEFGHIJ ok!
Sending[15]: 123 ABCDEFGHIJK ok!
[1] ACK TEST   [RX_RSSI:-28] - ACK sent
Sending[16]: 123 ABCDEFGHIJKL ok!
Sending[17]: 123 ABCDEFGHIJKLM ok!
Sending[18]: 123 ABCDEFGHIJKLMN ok!
[1] ACK TEST   [RX_RSSI:-28] - ACK sent
Sending[19]: 123 ABCDEFGHIJKLMNO ok!
Sending[20]: 123 ABCDEFGHIJKLMNOP ok!


EDIT2: I noticed the HIGH on digital pin 2 is only 0.7V. This is on both Moteinos. Pin 3 is 3.3V.

Istria

Just tried this:

void setup() {
  // put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  int state = HIGH;
digitalWrite(2, state);
digitalWrite(3, state);
digitalWrite(4, state);
digitalWrite(5, state);
digitalWrite(6, state);
digitalWrite(7, state);
digitalWrite(8, state);
digitalWrite(9, state);
digitalWrite(10, state);
digitalWrite(11, state);
digitalWrite(12, state);
}


All pins are 3.3v, except for pin2. Which is 0.7V. Is this a symptom of something? Google doens't know.
If I turn them LOW. Pin 2 is also LOW.

Felix

What voltage current rating does your PL2303s have?
Is the interface the same as the FTDI board?
Did you set your IS_RFM69HW setting to match each radio?
Did you ensure you did not introduce any solder bridges to GND from the antenna or any other solder/desolder damage?

Istria

#3
Hi, I wouldn't know about the current rating. It's a cheap china device with 5V and 3.3V output. I suppose the data pins are 5V, which seems to work. I also tried powering it from a 12V battery, so I guess it's not lack of current/power. (pic in the link below)

Interface? If you mean if they work the same way. Yes. It just pops up as a COM port in device manager. Did have to work some driver magic though.

IS_RFM69HW is true on both Moteinos.

I checked for solder bridges. The antenna pad isn't connected to anything close to it.


I did get it to work somehow though. I switched the Moteino's (putting the sender code on the receiver and vica versa) and that seemed to work. I skipped pin2 and put my buttons on 3 and 4.

By the way. The idea is to have 2 buttons on the transmitter and a LED on the receiver. When no button is pressed, nothing should be transmitted. With 1 button pressed a "BLINK" payload should be sent. With both buttons pressed a "ON" payload should be sent.
Pics: https://dl.dropboxusercontent.com/u/63392345/mote.zip

When no button is pressed the void loop() takes about 1-2ms to complete. When a button is held, suddenly there is a 3000ms delay between loops. I also tried using "send" instead of "sendWithRetry". Then the loop takes 1000ms when a button is held.

It's just so frustrating that I had everything up and running beautifully for days. And now the time has come to actually put the device together it all went to hell. xD

In short what I would like to know: Why would it take so long for a transmitting loop to complete now when it didin't before?

I'll do some more testing tomorrow on the weird no range problem. There is a limit to the amount of times a man can fiddle with keeping the RST and GND together while clicking the upload button with his nose and not wanting to throw the whole thing in the trashcan.  ;D
GOD I miss the DTR pin on the FTDI I fried.  :'(

#include <RFM69.h>    //get it here: https://www.github.com/lowpowerlab/rfm69
#include <RFM69_ATC.h>//get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h>

//*********************************************************************************************
//************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE *************
//*********************************************************************************************
#define NODEID        2    //must be unique for each node on same network (range up to 254, 255 is used for broadcast)
#define NETWORKID     100  //the same on all nodes that talk to each other (range up to 255)
#define GATEWAYID     1
//Match frequency to the hardware version of the radio on your Moteino (uncomment one):
#define FREQUENCY   RF69_433MHZ
#define ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define IS_RFM69HW    //uncomment only for RFM69HW! Leave out if you have RFM69W!
//*********************************************************************************************



#define SERIAL_BAUD   115200


// Define hardware pins
#define LEDPIN            9 // Moteinos have LEDs on D9
#define btn1PIN           3 // Button 1
#define btn2PIN           4 // Button 2



int TRANSMITPERIOD = 150; //transmit a packet to gateway so often (in ms)

// Set Payloads
char payload_Blink[] = "BLINK";
char payload_On[] = "ON";
byte Blink_Len = strlen(payload_Blink);
byte On_Len = strlen(payload_On);

char buff[20];

// Set something. No idea. (MS)
boolean requestACK = false;

// Initialize Radio
RFM69 radio;

// Set variables
unsigned long     currentTime;
long              lastPeriod = 0;
byte              buttonState = 0;



unsigned long loopcount = 0;

void setup() {

// Start Serial
  Serial.begin(SERIAL_BAUD);

// Setup Radio  
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  //radio.writeReg(0x03,0x68);  //zet baud to 1200
  //radio.writeReg(0x04,0x2B);  //zet baud to 1200
  radio.setHighPower(); //uncomment only for RFM69HW!
  radio.encrypt(ENCRYPTKEY);
  
// Print line once at startup  
  char buff[50];
  sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
  Serial.println(buff);

// Set Pinmodes
  pinMode(btn1PIN, INPUT_PULLUP);
  pinMode(btn2PIN, INPUT_PULLUP);
  pinMode(LEDPIN, OUTPUT);
  
}

/////////////////////////////////////////////////////////////////////MAIN LOOP////

void loop() {
// Read and Set buttonstates

  if ( (digitalRead(btn1PIN) == HIGH) &&  (digitalRead(btn2PIN) == HIGH) )
  {
    buttonState = 0; // Zero buttons depressed.
  }
  if ( ( (digitalRead(btn1PIN) == LOW) &&  (digitalRead(btn2PIN) == HIGH) ) || ( (digitalRead(btn1PIN) == HIGH) && (digitalRead(btn2PIN) == LOW)  ) )
  {
    buttonState = 1; // One of the buttons depressed, but not both.
  }

  if ( (digitalRead(btn1PIN) == LOW) &&  (digitalRead(btn2PIN) == LOW) )
  {
    buttonState = 2; // Both buttons depressed.
  }

  Serial.print(buttonState);Serial.print("   ");
  
// Transmitting Part
  
  int currPeriod = millis()/TRANSMITPERIOD;
  if (currPeriod != lastPeriod)  // BEGIN TRANSMITTING
  {
    lastPeriod=currPeriod;

  if ( buttonState == 0 )
      {
        digitalWrite(LEDPIN, LOW);
      }
   
    // If one of the buttons if depressed, but not both.
    if ( buttonState == 1 )
      {
       if  (radio.sendWithRetry(GATEWAYID, payload_Blink, Blink_Len)) //Send Package with ACK request
       {
            digitalWrite(LEDPIN, HIGH);
            Serial.print("SENT: BLINK COMMAND");
       }    
      }

      // If both buttons are depressed.
    if ( buttonState == 2 )
      {
       radio.sendWithRetry(GATEWAYID, payload_On, On_Len);
        
          Serial.print("Sent ON command");
          digitalWrite(LEDPIN, HIGH);
      }
  }   // END TRANSMITTING
  
// //Temporary. Show how long it takes to complete the loop.  
  Serial.print("     Loop Time: ");Serial.println(millis() - loopcount);
  loopcount = millis();





}


1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 3
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 1
1        Loop Time: 1
1        Loop Time: 1
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 2
1        Loop Time: 1
1        Loop Time: 1
1        Loop Time: 1
1        Loop Time: 2
1        Loop Time: 3122
1        Loop Time: 3120
1        Loop Time: 3120
1        Loop Time: 3120
1        Loop Time: 3120
1        Loop Time: 3120
0        Loop Time: 0
0        Loop Time: 1
0        Loop Time: 0
0        Loop Time: 1
0        Loop Time: 1
0        Loop Time: 1
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 3
0        Loop Time: 2
0        Loop Time: 1
0        Loop Time: 1
0        Loop Time: 1
0        Loop Time: 1
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 2
0        Loop Time: 2

Felix

The FTDI is 5v VCC and 3.3v data pins, and always works, no current issue to power a Moteino.
But glad to hear you solved it.

Istria

Well. This morning I fiddled around some more. Somehow (almost) everything works perfectly again.

I can't reproduce the extremely weak signal. It's around -25dB when the radios are right next to eachother and -30dB 5m apart. I'll do some range testing tonight, but it seems normal.

Although it works now, i'm still a little curious about two things.

1. What could be going on with pin 2? It doesn't produce a HIGH an both Moteino's. Only 0.7V.

2. I had a bug in my own code for a while, which caused the loop to stop at radio.send(). It would do everything up to that line and then just freeze. I tracked it down the the assignment of a pinMode() in the setup. I had set pinMode(13, OUTPUT) to drive a transistor. This appears to screw with the RFM69.
I did a quick search, but are there other pin's on the Moteino that the RFM69 is using and should be left untouched?

Thanks

Felix

Quote from: Istria on June 01, 2016, 09:35:48 AM
I did a quick search, but are there other pin's on the Moteino that the RFM69 is using and should be left untouched?
Did you look at the pinout diagrams?
Both the pins you mentioned are used by the RFM69.

Istria

Thanks. Somehow I didn't think to look at the board pin layout scheme. Duh...

I also had other "RFM pins" in use. I guess that's where all my problems came from. It all works great now.

Thanks for the help!