1      Documentation. 2

2      Goal. 2

3      Arduino. 3

3.1       The hardware. 3

3.2       The source file. 3

3.3       Create a Project for the Node (sender). 4

3.4       Build and Download the node. 7

3.5       Create a Project for the Gateway (receiver). 7

3.6       Build and download the gateway. 8

4      Raspberry Pi 9

4.1       Send Receive Test 9


1         Documentation.

2         Goal.

The purpose of this article is to give basic information to check the RFM69 communication between two Arduino platforms and 2 Raspberry Pi platform.



3         Arduino

3.1      The hardware.

You can buy a Anarduino to

or a moteino to

They are compatible.

3.2      The source file.

A sketch can be downloaded from several source like :


But as I’ll also check the communication with a RaspberryPi I take the source from here :


You can download the Zip file.

The zip contains 3 folders :

For the arduino platform, we need the “Gateway” and “Sensor Node”.

3.3      Create a Project for the Node (sender).

I use the Eclipse IDE , but you can also use the Arduino IDE.


In Eclipse, create a new Arduino project.



Then select :

Give a name :

Select the board corresponding to your hardware :

The project is created and a new template cpp is created :

Copy and paste the contains of the file “SensorNode.ino” into “RpiGateway.cpp”.

There will be a lot of unresolved symbols :


To correct this, it is necessary to add the Library RFM69 available from moteino gthub :


You can check where the library needs to be copied in the project properties:

Copy the library to “EclipseLibraries“ folder  : 


Add the library to your project :



Then, it is important to adapt values for all devices :

  • The nodeID (sender) will be 13
  • The gatewayID (receiver) will be 10
  • The network must be the same for all devices : 100

#define NODEID        13    //unique for each node on same network

#define NETWORKID     100  //the same on all nodes that talk to each other

#define GATEWAYID     10


Then match the frequency to the hardware version of the RFM 69

#define FREQUENCY   RF69_433MHZ


Define the same Encrypt key for all devices :

#define ENCRYPTKEY    “sampleEncryptKey” //exactly the same 16 characters/bytes on all


Comment the FLAG IS_RFM69 if your RFM isn’t a High power device.

//#define IS_RFM69HW    //uncomment only for RFM69HW! Leave out if you have RFM69W!


As I don’t have a DHT module, I suppressed every relation to DHT.

//#include <dht.h>

//dht DHT;

And set fixed value :

    double h = 55.5;

    // Read temperature as Celsius

    double t = 22.5;


We also need to add the SPI library :

3.4      Build and Download the node.

Then you can build the project, upload the project and verify the monitor log :

This is all for the node.

3.5      Create a Project for the Gateway (receiver).

I’ll not describe every step because it’s the same procedure as for the node.


The gateway is adress 10 :

#define NODEID        10    //unique for each node on same network

#define NETWORKID     100  //the same on all nodes that talk to each other

#define FREQUENCY   RF69_433MHZ


#define ENCRYPTKEY    “sampleEncryptKey” //exactly the same 16 characters/bytes on all nodes!


Comment the Ethernet and Mosquitto:

/*#include <Ethernet.h>



byte mac[]    = { 

  0x90, 0xA2, 0xDA, 0x0D, 0x11, 0x11 };

byte server[] = {

  192, 168, 0, 50 };


IPAddress ip(192,168,0,61);

EthernetClient ethClient;

#define DHCP_RETRY 500




// Mosquitto—————

#include <PubSubClient.h>

PubSubClient client(server, 1883, callback, ethClient);

#define MQTT_CLIENT_ID “arduinoClient”

#define MQTT_RETRY 500

int sendMQTT = 0;


void MQTTSendInt(PubSubClient* _client, int node, int sensor, int var, int val);

void MQTTSendULong(PubSubClient* _client, int node, int sensor, int var, unsigned long val);

void MQTTSendFloat(PubSubClient* _client, int node, int sensor, int var, float val);






/*  while (Ethernet.begin(mac) != 1) {

    DEBUGLN1(“Error getting IP address via DHCP, trying again…”);





  // Mosquitto ——————————

  while (client.connect(MQTT_CLIENT_ID) != 1) {

    DEBUGLN1(“Error connecting to MQTT”);





3.6      Build and download the gateway.

Verify that the gateway receives the string from the Node



4         Raspberry Pi

Start the first Raspberry Pi and in your project folder download the source from


Build the sendReceive program.


For the instruction , follow the instruction here :


But,for a simple test, you don’t need to install the mosquito.

You can install the WiringPi and go directly to the end of the page : “Send Receive Test”


4.1      Send Receive Test

Download the source :

git clone git://

Go into folder : HomeAutomation/piGateway


I changed the type of RFM69



Compile : make SenderReceiver

Run the gateway : SenderReceiver -r



Do the same on the other RaspberryPi and run the node : SenderReceiver -s


Print Friendly, PDF & Email