Connecting the Radio

written by hek

The NRF24L01+ and RFM69 transceiver communicates with the Arduino board via the SPI interface.

It is important to always feed the radios with a stable and noisy-less power source of 3.3V providing enough current for your device, else erratic behaviour, degraded range and sensitivy can happen.

Refer to the notes about using a regulator or a coupling-capacitor below.

NRF24L01+ & Arduino

NOTE: The input pins on the NRF24L01+ is 5V tolerant. However, you cannot feed the module with more than 3.3V on VCC. If you use a 5V Arduino you have to use a step-down regulator!

Pro Mini / Nano Mega* NRF24L01+ Color
GND GND GND Black
5VReg -> 3.3V 3.3V VCC Red
9 49 CE Orange
10 53 CSN/CS Yellow
13 52 SCK Green
11 51 COPI/MOSI Blue
12 50 CIPO/MISO Violet
2 2 IRQ Gray

The IRQ pin is only required to be connected if the MY_RX_MESSAGE_BUFFER_FEATURE is defined in the sketch. Using this feature is recommended for high traffic nodes or gateways. Enabling it will result in better throughput but will require some additional memory to keep the message in memory before processing.

(*) If you are using an Arduino Mega, the following needs to be added to your sketch before including MySensors.h:

#define MY_RF24_CE_PIN 49
#define MY_RF24_CS_PIN 53

NRF24L01+ & ESP8266

This also works with other ESP8266-based boards such as NodeMCU and Wemos D1 Mini.

NodeMCU Radio Comment
GND GND Black
3V3 VCC Red
D2 (GPIO4) CE Orange
D8 (GPIO15) CSN/CS Yellow
D5 (GPIO14) SCK Green
D7 (GPIO13) COPI/MOSI Blue
D6 (GPIO12) CIPO/MISO Violet
Note: The IRQ is currently not used by the MySensors library so it can be left un-connected.

RFM69/95 & Arduino

NOTE: The NSS, COPI/MOSI and SCK are not 5V tolerant on RFM69. You will need to use a level converter if you're using a 5V Arduino.

Arduino RFM69/95 Color
GND GND Black
3.3V VCC Red
10 NSS Yellow
13 SCK Green
11 COPI/MOSI Blue
12 CIPO/MISO Violet
2 DI00 Gray
ANA Antenna
RST Not used*
* Adafruit modules need RST connected to GND, or to MY_RFM69_RST_PIN

RFM69/95 & ESP8266

This also works with other ESP8266-based boards such as NodeMCU and Wemos D1 Mini.

ESP8266 RFM69/95 Color
GND GND Black
3.3V VCC Red
D1** (GPIO5) DIO0 Gray
D5 (GPIO14) SCK Green
D6 (GPIO12) CIPO/MISO Violet
D7 (GPIO13) COPI/MOSI Blue
D8 (GPIO15) NSS Yellow
ANA Antenna - see below
RST Not used*

* Adafruit modules need RST connected to GND, or to MY_RFM69_RST_PIN

** For the above wiring, the following defines should be used:

#ifdef ESP8266
// For RFM69
#define MY_RADIO_RFM69
#define MY_RFM69_FREQUENCY RFM69_433MHZ // Set your frequency here
#define MY_IS_RFM69HW // Omit if your RFM is not "H"
#define MY_RFM69_IRQ_PIN D1
#define MY_RFM69_IRQ_NUM MY_RFM69_IRQ_PIN
#define MY_RFM69_CS_PIN D8 // NSS. Use MY_RFM69_SPI_CS for older versions (before 2.2.0)

// For RFM95
#define MY_RADIO_RFM95
#define MY_RFM95_IRQ_PIN D1
#define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
#define MY_RFM95_CS_PIN D8
#endif

Gateways and nodes can use the same wiring, but be aware that the RFM radio uses all pins that are easy to work with except D2, so connecting anything might be a challenge. Use an Arduino instead if you want to connect stuff.

Configuring MySensors for RFM69

MySensors is configured to use the NRF24 radio by default. To use RFM69, the following needs to be added before including MySensors.h

Base defines for non-High Power 868Mhz radio, and Atmel 328p mcus (mini pro, nano, uno etc.) is :

#define MY_RADIO_RFM69  // Define for using RFM69 radio

And if you need an advanced configuration, you may need to also add these defines :

#define MY_RFM69_FREQUENCY RFM69_433MHZ  // Define for frequency setting. Needed if you're radio module isn't 868Mhz (868Mhz is default in lib)
#define MY_IS_RFM69HW  // Mandatory if you radio module is the high power version (RFM69HW and RFM69HCW), Comment it if it's not the case
//#define MY_RFM69_NETWORKID 100  // Default is 100 in lib. Uncomment it and set your preferred network id if needed
//#define RFM69_IRQ_PIN 4  // Default in lib is using D2 for common Atmel 328p (mini pro, nano, uno etc.). Uncomment it and set the pin you're using. Note for Atmel 328p, Mysensors, and regarding Arduino core implementation D2 or D3 are only available. But for advanced mcus like Atmel SAMD (Arduino Zero etc.), Esp8266 you will need to set this define for the corresponding pin used for IRQ
// #define MY_RFM69_IRQ_NUM 4 // Temporary define (will be removed in next radio driver revision). Needed if you want to change the IRQ pin your radio is connected. So, if your radio is connected to D3/INT1, value is 1 (INT1). For others mcu like Atmel SAMD, Esp8266, value is simply the same as your RFM69_IRQ_PIN
// #define MY_RFM69_SPI_CS 15 // If using a different CS pin for the SPI bus. Use MY_RFM69_CS_PIN for the development branch.

You can find more info about these define here : https://www.mysensors.org/download/sensor_api_20

Note : Mysensors RFM69 driver is interrupt driven.

RFM69 Antenna

IMPORTANT: You MUST attach an antenna to the board. The antenna need to be single core inside, only one wire, not multi-wire braided like you can find in common dupont cable (not good for antenna.) Aside from not working without an antenna, transmitters can be damaged if they transmit without an antenna present.

By cutting a wire to the proper length you can create a simple antenna for your RFM69 radio. Depending on the frequency of the radio, the antenna has to be cut to different lengths. Cut the antenna slightly longer to give room to solder it to your board. You can always trim it once soldered.

Frequency Length (in) Length (mm)
434 MHz 6.47" 164.7 mm
868 MHz 3.22" 82.2 mm
915 MHz 3.06" 77.9 mm

Above antenna length represent 1/4 wave. There is also commercial antennas to buy in proper length.

Tips:


Connecting a Decoupling-Capacitor

The nrf24 radios are extremely sensitive to noisy or unstable/insufficient power. You will need to add a decoupling capacitor of 4.7µ - 47µF (the exact size usually doesn't matter, but you can try 47uF if 4.7uF still doesn't work, especially if sending data works well and not receiving data) across the radio's 3.3V and GND.

Capacitor Radio Comment
- side GND Marked Black on radio
+ side 3.3V Marked Red on radio

The side with "< - < - "-marking should be connected to GND

Connecting a Voltage Regulator

NOTE: If you are using the 5V version of Arduino Pro Mini (that lacks the 3.3V regulated output) you'll have to connect a 5V->3.3V regulator between the Arduino and Radio.

Arduino Regulator Radio
5V Vin
GND GND GND
Vout VCC

Datasheets

NameSize# Downloads
nRF24L01P_PS_v1.0.pdf1.08 MB2672
RFM69HW-V1.3.pdf1.17 MB5094
sx1231h.pdf962.48 kB3344

Shopping Guide

100pcs electrolytic capacitors
Assorted values. 0.1uF-100uF. Use capacitors to stabilize power to the radio.
2 available - $12.61   Buy
undefined   Buy
10pcs 433Mhz Antenna
For RFM69 Modules
undefined available   Buy
undefined   Buy
10pcs 868Mhz Antenna
For RFM69 Modules
1 available - $8.23   Buy
undefined   Buy
10pcs 915MHz Antenna
For RFM69 modules
undefined   Buy
undefined   Buy
10pcs LE33ACZ 5V-3.3V Step Down Regulator
Regulator for adjusting the power to the radio when using 5V Arduino Pro Minis. Easy to solder and/or use on a breadboard.
undefined   Buy
10pcs NRF24L01+ 2.4GHz Wireless Transceiver
This is what enables your sensors to communicate wirelessly across a nominal range of 60 meters.
1 available - $13.99   Buy
undefined   Buy
20pcs 662K 5V-3.3V Step Down Regulator
Inexpensive regulator for adjusting the power to the radio when using 5V Arduino Pro Minis. Warning! Very small and hard to solder.
Unavailable   Buy
undefined   Buy
AMS1117 5V-3.3V Step Down Module
Regulator for adjusting the power to the radio when using 5V Arduino Pro Minis. Solder free.
Unavailable   Buy
undefined   Buy
Logic Level Shifter
Bi-Directional logic level shifter. 5V to 3v3. 4 Pins.
Unavailable   Buy
undefined   Buy
NRF24L01+ Socket Adapter Board
Another adapter for Arduino Pro Mini 5V that provide 3.3v regulated power to the radio. Solder free.
Unavailable   Buy
undefined   Buy
RFM69 433Mhz Transceiver
HopeRF RF69 module. Select frequency band on aliexpress.
Unavailable   Buy
undefined   Buy
RFM69 868Mhz Transceiver
HopeRF RF69 module. Select frequency band on aliexpress.
Unavailable   Buy
undefined   Buy
Shielded nRF24L01 PA+LNA
A shielded nRF24L01 PA+LNA with SMA connector (needs external antenna)
Unavailable   Buy
undefined   Buy

Gateways

Sensors & Actuators

Related Content

Comments