You are on page 1of 9

Wireless Sensor Network using nRF24L01 module

The nRF24L01+ module is designed to operate in 2.4 GHz worldwide ISM frequency band and
uses GFSK modulation for data transmission. The data transfer rate is configurable and can be one
of 250kbps, 1Mbps and 2Mbps.
The 2.4 GHz band is one of the Industrial, Scientific, and Medical (ISM) bands internationally
reserved for unlicensed low power devices. Devices such as cordless phones, Bluetooth devices,
Near Field Communication (NFC) devices, and wireless computer networks (WiFi) all use ISM
frequencies.
Power
The module’s operating voltage ranges from 1.9 to 3.6V, but the good news is that the logic pins are
5-volt tolerant, so you can use it with your favorite 3.3V or 5V microcontroller without worry.
The module supports programmable output power i.e. 0 dBm, -6 dBm, -12 dBm or -18 dBm. At 0
dBm the module consumes only 12 mA during transmission which is less than the consumption of a
single LED.
And the best part is that it consumes 26 µA in standby mode and 900 nA in power down mode.
That’s why it’s a go-to wireless device for low-power applications.
SPI Interface
The nRF24L01+ communicates over a 4-pin SPI (Serial Peripheral Interface) with a maximum data
rate of 10Mbps.
All parameters such as frequency channel (125 selectable channels), output power (0 dBm, -6 dBm,
-12 dBm or -18 dBm), and data rate (250kbps, 1Mbps, or 2Mbps) can be configured through the
SPI interface.
Technical Specifications

Frequency Range 2.4 GHz ISM Band


Maximum Air Data Rate 2 Mb/s
Modulation Format GFSK
Max. Output Power 0 dBm
Operating Supply Voltage 1.9 V to 3.6 V
Max. Operating Current 13.5mA
Min. Current(Standby
26µA
Mode)
Logic Inputs 5V Tolerant
Communication Range 800+ m (line of sight)

The new nordic module nRF24L01+ is intergrated with PA/LNA module.


PA stands for Power Amplifier. It only amplifies the signal strength being transmitted from the
nRF24L01+ chip. Whereas LNA stands for Low-Noise Amplifier whose function is to take an
extremely weak signal from the antenna (usually below microvolts or -100 dBm) and amplify it to a
more useful level (usually around 0.5 to 1 V).
nRF24L01+ PA/LNA Block Diagram

The low-noise amplifier (LNA) of the receive path and the power amplifier (PA) of the transmit
path connect to the antenna through a duplexer, which isolates the two signals and prevents the
relatively powerful PA output from overloading the sensitive LNA input.

How nRF24L01+ module works?


The nRF24L01+ module transmits and receives data on a certain frequency called a channel. For
two or more modules to communicate with each other, they must be on the same channel. This
channel can be any frequency in the 2.4 GHz ISM band, or to be more precise, it can be between
2.400 to 2.525 GHz (2400 to 2525 MHz).

RF Channel Frequency
The nRF24L01+ module transmits and receives data on a certain frequency called a channel. For
two or more modules to communicate with each other, they must be on the same channel. This
channel can be any frequency in the 2.4 GHz ISM band, or to be more precise, it can be between
2.400 to 2.525 GHz (2400 to 2525 MHz).
Each channel takes up a bandwidth of less than 1MHz. This gives us 125 possible channels with
1MHz spacing.
This means the nRF24L01+ can use 125 different channels, allowing you to create a network of 125
independently working modems in one place.
The channel takes up a bandwidth of less than 1MHz at 250kbps and 1Mbps air data rate. However
at a 2 Mbps air data rate, 2MHz of bandwidth is required (greater than the resolution of the RF
channel frequency setting). So in 2 Mbps mode you should keep a gap of 2MHz between the two
channels to ensure non-overlapping channels and reduce cross-talk.

nRF24L01+ Multiceiver Network


The nRF24L01+ has a feature called Multiceiver. It is an abbreviation for Multiple Transmitter
Single Receiver.

nRF24L01+ Multiceiver Network


The nRF24L01+ has a feature called Multiceiver. It is an abbreviation for Multiple Transmitter
Single Receiver.

In a multiceiver network each RF channel is logically divided into 6 parallel data channels called
data pipes. In other words, the data pipe is one of six logical channels in a single physical RF
channel. Each data pipe has its own unique address called a data pipe address. Only one data pipe
can receive a packet at a time.
A multiceiver network can be depicted as below.
nRF24L01+ Multiceiver Network – Multiple Transmitters Single Receiver
To understand multiserver network imagine that the primary receiver is acting as a hub receiver that
collects information from 6 different transmitter nodes simultaneously. The hub receiver can stop
listening at any time and act as a transmitter.
Enhanced ShockBurst Protocol
The nRF24L01+ uses a packet structure known as Enhanced ShockBurst. This simple packet
structure is divided into 5 different fields as you can see below.

nRF24L01+ Enhanced ShockBurst Packet Structure


The original shockburst structure only included Preamble, Address, Payload and the Cyclic
Redundancy Check (CRC) fields. Enhanced Shockburst brought more functionality for more
advanced communications using the newly introduced Packet Control Field (PCF).

This new structure is great for several reasons.

 Firstly, it allows variable length payloads with a payload length specifier, meaning that
payloads can vary from 1 to 32 bytes.
 Secondly, it assigns a packet ID to each sent packet, which allows the receiving device to
determine whether a message is new or has been retransmitted.
 Lastly, and most importantly, each message can request the receiver to send an
acknowledgment after receiving the message.
nRF24L01+ Automatic Packet Handling
 Transaction with an acknowledgment:
This is an example of a positive scenario. Here the transmitter initiates the communication by
sending a data packet to the receiver. Once the packet is transmitted, it waits approximately 130 µs
to receive the acknowledgment packet (ACK packet). When the receiver receives the packet it sends
the ACK packet to the transmitter. The transaction ends when the transmitter receives the ACK
packet.

 Transaction with a lost data packet:


This is a negative scenario where retransmission is required due to the loss of the transmitted
packet. After the packet is transmitted, the transmitter waits to receive the ACK packet.

If the transmitter does not receive it within the auto-retransmit-delay (ARD) time it retransmits the
packet. When the receiver receives the retransmitted packet, it transmits the ACK packet thereby
terminating the transaction.
 Transaction with a lost acknowledgment:
This is again a negative scenario where retransmission is required due to loss of ACK packets. Here
even though the receiver has received the packet in the first attempt itself, due to the loss of the
ACK packet, the transmitter thinks that the receiver has not received the packet.

So after the Auto-Retransmit-Delay timeout, the transmitter retransmits the packet. Now when the
receiver receives the packet with the same ID as before, it discards it and sends the ACK packet
again. The transaction ends when the transmitter receives the ACK packet.

This entire packet handling is done automatically by the nRF24L01+ chip without the involvement
of the microcontroller.

nRF24L01+ Module Pinout


VCC supplies power to the module. It can be anywhere from 1.9 to 3.9 volts. You can connect it to
the 3.3V output from your Arduino. Remember that connecting this to the 5V pin will probably
destroy your nRF24L01+ module!

CE (Chip Enable) is an active-high pin. When selected, the nRF24L01 will either transmit or
receive, depending on which mode it is currently in.

CSN (Chip Select Not) is an active-low pin and is normally kept HIGH. When this pin goes low,
the nRF24L01 starts listening on its SPI port for data and processes it accordingly.

SCK (Serial Clock) accepts clock pulses provided by the SPI bus master.

MOSI (Master Out Slave In) is the SPI input to the nRF24L01.

MISO (Master In Slave Out) is the SPI output from the nRF24L01.

IRQ is an interrupt pin that can alert the master when new data is available to process.

Wiring a nRF24L01+ module to an Arduino


Pins CSN and CE can be connected to any digital pin on the Arduino. In our case, these are
connected to digital pins #8 and #9 respectively. Now we are left with the pins that are used for SPI
communication.

Since the nRF24L01+ module requires a lot of data transfer, it will give the best performance when
connected to the hardware SPI pins on the microcontroller.

Note that each Arduino board has different SPI pins that must be connected accordingly.

Remember you need to make two such circuits. One will act as transmitter and the other as receiver.
Both have the same wiring.

We will use the RF24 library for Interfacing a nRF24L01+ module.

Arduino Example Code – For Transmitter


simply send a traditional ‘Hello World‘ message to the receiver.

//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

//create an RF24 object


RF24 radio(9, 8); // CE, CSN

//address through which two modules communicate.


// The pipe address does not have to be “00001”, it can be any 5-character
string such as “node1” as long as the transmitter and receiver both use the same
address.
const byte address[6] = "00001";

void setup()
{
radio.begin();

//set the address


radio.openWritingPipe(address);
//Set module as transmitter
radio.stopListening();
}
void loop()
{
//Send message to receiver
const char text[] = "Hello World";
radio.write(&text, sizeof(text));

delay(1000);
}

Arduino Example Code – For Receiver


//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

//create an RF24 object


RF24 radio(9, 8); // CE, CSN

//address through which two modules communicate.


const byte address[6] = "00001";

void setup()
{
while (!Serial);
Serial.begin(9600);

radio.begin();

//set the address


radio.openReadingPipe(0, address);

//Set module as receiver


radio.startListening();
}

void loop()
{
//Read the data if available in buffer
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
}
}

You might also like