1

I'm working on RFM69 connected to an Arduino Uno. Currently, I was able to initialize the RFM69 using the a code I modified from the internet. However, my Receiver part always encounters error. It doesn't sometimes proceed and sometimes got stuck in the initialization loop. Yesterday, my Transmitter managed to work properly but today, sometimes I also observed same problem with my Receiver.

Here's my wiring. enter image description here

The code I'm using for both Transmitter and Receiver

#include <SPI.h>
#include <RH_RF69.h>

/************ Radio Setup ***************/

// Change to 434.0 or other frequency, must match RX's freq!
#define RF69_FREQ 434.0

#define RFM69_CS 10
#define RFM69_INT 2
#define RFM69_RST 9
#define LED 13

// Singleton instance of the radio driver
RH_RF69 rf69(RFM69_CS, RFM69_INT);

int16_t packetnum = 0;  // packet counter, we increment per xmission

void setup() 
{
  Serial.begin(9600);
  //while (!Serial) { delay(1); } // wait until serial console is open, remove if not tethered to computer

  pinMode(LED, OUTPUT);     
  pinMode(RFM69_RST, OUTPUT);
  //digitalWrite(RFM69_RST, LOW);
  //from this point I added it
  digitalWrite (RFM69_RST, HIGH);
  delay (100);
  digitalWrite (RFM69_RST, LOW);
  delay (100);

  Serial.println("LoRa Daughter Board (RFM69) - Transmitter");
  Serial.println();

  // manual reset
  digitalWrite(RFM69_RST, HIGH);
  delay(10);
  digitalWrite(RFM69_RST, LOW);
  delay(10);
  
  if (!rf69.init()) {
    Serial.println("RFM69 Initialization Failed!");
    while (1);
  }
  Serial.println("RFM69 Initialization Success!");
  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module)
  // No encryption
  if (!rf69.setFrequency(RF69_FREQ)) {
    Serial.println("setFrequency failed");
  }

  // If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the
  // ishighpowermodule flag set like this:
  //rf69.setTxPower(20, true);  // range from 14-20 for power, 2nd arg must be true for 69HCW

  // The encryption key has to be the same as the one in the server
  uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  rf69.setEncryptionKey(key);
  
  pinMode(LED, OUTPUT);

  Serial.print("RFM69 Frequency: ");  Serial.print((int)RF69_FREQ);  Serial.println(" MHz");
}



void loop() {
  delay(1000);  // Wait 1 second between transmits, could also 'sleep' here!

  char radiopacket[20] = "Hello World #";
  itoa(packetnum++, radiopacket+13, 10);
  Serial.print("Sending "); Serial.println(radiopacket);
  
  // Send a message!
  rf69.send((uint8_t *)radiopacket, strlen(radiopacket));
  rf69.waitPacketSent();

  // Now wait for a reply
  uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);

  if (rf69.waitAvailableTimeout(500))  { 
    // Should be a reply message for us now   
    if (rf69.recv(buf, &len)) {
      Serial.print("Got a reply: ");
      Serial.println((char*)buf);
      Blink(LED, 50, 3); //blink LED 3 times, 50ms between blinks
    } else {
      Serial.println("Receive failed");
    }
  } else {
    Serial.println("No reply, is another RFM69 listening?");
  }
}

void Blink(byte PIN, byte DELAY_MS, byte loops) {
  for (byte i=0; i<loops; i++)  {
    digitalWrite(PIN,HIGH);
    delay(DELAY_MS);
    digitalWrite(PIN,LOW);
    delay(DELAY_MS);
  }
}

Here are screenshots of the results Taken yesterday: Mar 16 enter image description here

Taken today: Mar 17 enter image description here

2
  • please, no screenshots of text ... add the actual text ... some people here cannot view images
    – jsotola
    Commented Mar 17, 2022 at 3:39
  • I'm surprised that you're getting anything reliable through the level converter at 1MHz. Where you've indicated it's not relevant I deleted that answer. No other suggestions for you.
    – timemage
    Commented Mar 26, 2022 at 3:45

1 Answer 1

-1

It may be your environment, I have lots of problems here with RF transmission interference, a nearby radio amateur and proliferation of WiFi seem to exacerbate the problem. I've had some success building an RFM69 relay but have mostly gone over to WiFi using ESP8266 modules as they're much more reliable for communication.

1
  • Thank you @Bra1n. Actually Im currently in a laboratory. I was able to communication the RFM9x LoRa Radio by Adafruit in this very same environment, however, our prototype RFM69 didn't communicate at all huhuhu. Commented Mar 23, 2022 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.