Yun and RFM69

Hello,

I'm trying to attach an RFM69H with the Arduino Yun but I don't succeed. It works well with the Genuino or Pro Mini but the Yun, I can't get it to work. I've followed the manual at Sparkfun RFM69HCW Hookup Guide - learn.sparkfun.com.

Anybody succeeded in getting it to work ?

Any help appreciated !

Tkx
Leo

Leo,

In what way is it not working?

I don't have any experience with the RFM69H, but I would note that SPI is used if you are programming a sketch wirelessly with the Yun. If you are having trouble getting the sketch to load, having another device connected to the SPI might be the issue. Despite supposedly tri-state design, I've had to add a manual switch to disconnect an ADC from the SPI for programming. Once programmed, I've not had a problem letting the SPI device connect.

I don't know if your Pro Mini is 3.3V or not, but they mention using a level shifter for 5V boards like the Yun.

Also make sure that you moved your interrupt wire from arduino pin 2 to pin 3 when you switched over to the Yun. Interrupt 0 is on Pin 2 on the Pro Mini/Genuino, but is on Pin 3 on the Yun.

Hello,

Thank you for your answer and sorry for the late reply. I’ve been testing but had no luck. Let me elaborate on what I did.
First, I had a 3.3V Pro Mini with RFM69W and a 5V Uno (with logic level convertor) with RFM69W send messages to one another. This works OK for sending and receiving. This way, I’m sure my sketches are allright.
Then I replaced the Uno with a Yun, indeed using Pin 3 now and using ICSP (as described in the Sparkfun tutorial)
(see for sketch and wiring scheme)
I have no problem uploading the sketch, the thing is that I cannot send/receive any messages to/from the Yun.
(communication with ProMini to/from Yun does not work)
(communication with ProMini to/from Uno does work)

P.S. I used is wiring scheme RFM69HCW because couldn’t find RFM69W)

#include <RFM69.h>
#include <SPI.h>

// Addresses for this node. CHANGE THESE FOR EACH NODE!

#define NETWORKID     0   // Must be the same for all nodes
#define MYNODEID      2   // My node ID
#define TONODEID      1   // Destination node ID

// RFM69 frequency, uncomment the frequency of your module:

#define FREQUENCY   RF69_433MHZ
//#define FREQUENCY     RF69_915MHZ

// AES encryption (or not):

#define ENCRYPT       false // Set to "true" to use encryption
#define ENCRYPTKEY    "TOPSECRETPASSWRD" // Use the same 16-byte key on all nodes

// Use ACKnowledge when sending messages (or not):

#define USEACK        false // Request ACKs or not

// Packet sent/received indicator LED (optional):

#define LED           9 // LED positive pin
#define GND           8 // LED ground pin

// Create a library object for our RFM69HCW module:

RFM69 radio;

void setup()
{
  // Open a serial port so we can send keystrokes to the module:

  Serial.begin(9600);
  while (!Serial);
  Serial.print("Node ");
  Serial.print(MYNODEID,DEC);
  Serial.println(" ready now");  
  Serial.println(RF69_IRQ_PIN,DEC);
  Serial.println(RF69_IRQ_NUM,DEC);
  
  // Set up the indicator LED (optional):

//  pinMode(LED,OUTPUT);
//  digitalWrite(LED,LOW);
//  pinMode(GND,OUTPUT);
//  digitalWrite(GND,LOW);

  // Initialize the RFM69HCW:

  radio.initialize(FREQUENCY, MYNODEID, NETWORKID);
  //radio.setHighPower(); // Always use this for RFM69HCW

  // Turn on encryption if desired:

  if (ENCRYPT)
    radio.encrypt(ENCRYPTKEY);
}

void loop()
{
  // Set up a "buffer" for characters that we'll send:

  static char sendbuffer[62];
  static int sendlength = 0;

  // SENDING

  // In this section, we'll gather serial characters and
  // send them to the other node if we (1) get a carriage return,
  // or (2) the buffer is full (61 characters).

  // If there is any serial input, add it to the buffer:

  if (Serial.available() > 0)
  {
    char input = Serial.read();

    if (input != '\r') // not a carriage return
    {
      sendbuffer[sendlength] = input;
      sendlength++;
    }

    // If the input is a carriage return, or the buffer is full:

    if ((input == '\r') || (sendlength == 61)) // CR or buffer full
    {
      // Send the packet!


      Serial.print("sending to node ");
      Serial.print(TONODEID, DEC);
      Serial.print(", message [");
      for (byte i = 0; i < sendlength; i++)
        Serial.print(sendbuffer[i]);
      Serial.println("]");

      // There are two ways to send packets. If you want
      // acknowledgements, use sendWithRetry():

      if (USEACK)
      {
        if (radio.sendWithRetry(TONODEID, sendbuffer, sendlength))
          Serial.println("ACK received!");
        else
          Serial.println("no ACK received");
      }

      // If you don't need acknowledgements, just use send():

      else // don't use ACK
      {
        radio.send(TONODEID, sendbuffer, sendlength);
      }

      sendlength = 0; // reset the packet
      Blink(LED,10);
    }
  }

  // RECEIVING

  // In this section, we'll check with the RFM69HCW to see
  // if it has received any packets:

  if (radio.receiveDone()) // Got one!
  {
    // Print out the information:

    Serial.print("received from node ");
    Serial.print(radio.SENDERID, DEC);
    Serial.print(", message [");

    // The actual message is contained in the DATA array,
    // and is DATALEN bytes in size:

    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i]);

    // RSSI is the "Receive Signal Strength Indicator",
    // smaller numbers mean higher power.

    Serial.print("], RSSI ");
    Serial.println(radio.RSSI);

    // Send an ACK if requested.
    // (You don't need this code if you're not using ACKs.)

    if (radio.ACKRequested())
    {
      radio.sendACK();
      Serial.println("ACK sent");
    }
    //Blink(LED,10);
  }
}

void Blink(byte PIN, int DELAY_MS)
// Blink an LED for a given number of ms
{
  digitalWrite(PIN,HIGH);
  delay(DELAY_MS);
  digitalWrite(PIN,LOW);
}

Are you connecting to the Yun over USB or using Ethernet/Wireless?

If Ethernet/Wireless, you will need to use Console instead of Serial for communicating with the Yun.

Past that, I'm afraid I don't have any other ideas :zipper_mouth_face:

Hi DarkSabre,

I'm connecting over USB ...

Thanks for the thoughts !

Leo