0

members

Easy Basics: Project 083a NRF24L01 2.4GHZ RF transceiver module

of Acoptex.com in UNO

Basics: Project 083a

Project name: NRF24L01 2.4GHZ RF  transceiver module

Tags: Arduino, Arduino Uno, nRF Serial Adapter, nRF24L01, 2.4GHZ NRF24L01 Module, with PA LNA SMA antenna, NRF24L01 transceiver module, WINGONEER, PA, SMA and LNA with antenna , 2.4G NRF24L01 antenna wireless transceiver module,  Arduino, Arduino Uno, Arduino Mega, Arduino Nano, Arduino using NRF24L01 RF module, RF transceiver module,  2.4G, antenna in antistatic foam, wireless transceiver module kit, SPI wireless data transmission module, wireless data acquisition, NRF serial adapter, 5V-3.3V VCC adapter board for NRF24L01 wireless module, breakout adapter for NRF24L01, shield for NRF24L01 with ATMEGA48, base module for nRF24L01 with 3.3V regulator, socket adapter plate for 8pin NRF24L01, ATMEGA48 and NRF24L01 interface, USB adapter for NRF24L01, YL-105, YL 105, AS01-ML01DP3, Arduino Wireless Communication, nRF24L01 - 2.4GHz RF Transceiver With Arduino, nRF24L01 Arduino

Attachments: library1, serversketch1, clientsketch1

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. Arduino Uno R3 (you can also use the other version of Arduino) 2 pcs

2. Jumper cables F-M

3. Arduino IDE ( you can download it from here  )

4. NRF24L01 2.4GHZ RF transceiver module without or with external antenna PA LNA SMA  - 2pcs


General

We will learn about the nRF24L01 wireless transceiver module, how it works and interface with Arduino board.

Understanding the NRF24L01 2.4GHZ RF  transceiver module 

NRF24L01 2.4GHZ RF  transceiver modules are very popular among the Arduino community. They are transceivers which this means that each module can transmit and receive data. Having two or more Arduino boards be able to communicate with each other wirelessly over a distance opens lots of possibilities like remotely monitoring sensor data, controlling robots, home automation and the list goes on. When it comes down to having inexpensive yet reliable 2-way RF solutions, no one does a better job than nRF24L01+ transceiver module from Nordic Semiconductor. nRF24L01+ (plus) transceiver module can often be obtained online for less than 2 dollars, making it one of the most inexpensive data communication options that you can get. These modules are very tiny, allowing you to incorporate a wireless interface into almost any DIY project.

The nRF24L01+ transceiver module is designed to operate in 2.4 GHz worldwide ISM frequency band and uses GFSK modulation for data transmission. The data transfer rate can be one of 250kbps, 1Mbps and 2Mbps. 2.4 GHz band is one of the Industrial, Scientific, and Medical (ISM) bands reserved internationally for the use of unlicensed low-powered devices. Examples are Cordless phones, Bluetooth devices, near field communication (NFC) devices, and wireless computer networks (WiFi) all use the ISM frequencies.

The operating voltage of the module is from 1.9 to 3.6V, but the good news is that the logic pins are 5-volt tolerant, so we can easily connect it to an Arduino or any 5V logic microcontroller without using any logic level converter. The module supports programmable output power viz. 0 dBm, -6 dBm, -12 dBm or -18 dBm and consumes unbelievably around 12 mA during transmission at 0 dBm, which is even lower than a single LED. And best of all, it consumes 26 µA in standby mode and 900 nA at power down mode. That’s why they’re the go-to wireless device for low-power applications.

The nRF24L01+ transceiver module communicates over a 4-pin Serial Peripheral Interface (SPI) with a maximum data rate of 10Mbps. All the 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 SPI interface. The SPI bus uses a concept of a Master and Slave, in most common applications our Arduino is the Master and the nRF24L01+ transceiver module is the Slave. Unlike the I2C bus the number of slaves on the SPI bus is limited, on the Arduino Uno you can use a maximum of two SPI slaves i.e. two nRF24L01+ transceiver modules.

The module can use 125 different channels which gives a possibility to have a network of 125 independently working modems in one place. Each channel can have up to 6 addresses, or each unit can communicate with up to 6 other units at the same time.

Specification:

  • 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 Mode) 26µA
  • Logic Inputs 5V Tolerant
  • Communication Range 800+ m (line of sight)

Datasheet can be found here.

nRF24L01+ wireless transceiver module with built-in antenna VS nRF24L01+ PA LNA wireless transceiver module with external antenna

There are a lot of modules available based upon the nRF24L01+ chip. Let's compare nRF24L01+ wireless transceiver module with built-in antenna and nRF24L01+ PA LNA wireless transceiver module with external antenna.

1. nRF24L01+ wireless transceiver module with built-in antenna

It uses on-board antenna. This allows for a more compact version of the breakout. However, the smaller antenna also means a lower transmission range. With this version, you’ll be able to communicate over a distance of 100 meters outdoors, in an open space. Your range indoors will be slightly weakened.

2. nRF24L01+ PA LNA wireless transceiver module with external antenna

It comes with a SMA connector and a duck-antenna but that’s not the real difference. The real difference is that it comes with a special RFX2401C chip which integrates the PA, LNA, and transmit-receive switching circuitry. This range extender chip along with a duck-antenna helps the module achieve a significantly larger transmission range about 1000 metres.

What does it mean PA LNA?


The PA stands for Power Amplifier. It merely boosts the power of the signal being transmitted from the nRF24L01+ chip. Whereas, LNA stands for Low-Noise Amplifier. The function of the LNA is to take the extremely weak and uncertain signal from the antenna (usually on the order of microvolts or under -100 dBm) and amplify it to a more useful level (usually about 0.5 to 1V). The low-noise amplifier (LNA) of the receive path and the power amplifier (PA) of the transmit path connect to the antenna via a duplexer, which separates the two signals and prevents the relatively powerful PA output from overloading the sensitive LNA input. 

How nRF24L01+ transceiver module works?

The nRF24L01+ transceiver module transmits and receives data on a certain frequency called Channel. Also in order for two or more transceiver modules to communicate with each other, they need to be on the same channel. This channel could be any frequency in the 2.4 GHz ISM band or to be more precise, it could be between 2.400 to 2.525 GHz (2400 to 2525 MHz). Each channel occupies a bandwidth of less than 1MHz. This gives us 125 possible channels with 1MHz spacing. So, the module can use 125 different channels which give a possibility to have a network of 125 independently working modems in one place.

The channel occupies a bandwidth of less than 1MHz at 250kbps and 1Mbps air data rate. However at 2Mbps air data rate, 2MHz bandwidth is occupied (wider than the resolution of RF channel frequency setting). So, to ensure non-overlapping channels and reduce cross-talk in 2Mbps mode, you need to keep 2MHz spacing between two channels.

RF channel frequency of your selected channel is set according to the following formula: Freq(Selected) = 2400 + CH(Selected). For example, if you select 108 as your channel for data transmission, the RF channel frequency of your channel would be 2508MHz (2400 + 108).

The nRF24L01+ provides a feature called Multiceiver. It’s an abbreviation for Multiple Transmitters Single Receiver. In which each RF channel is logically divided into 6 parallel data channels called Data Pipes. In other words, a data pipe is a logical channel in the physical RF Channel. Each data pipe has its own physical address (Data Pipe Address) and can be configured. 

If you look at picture above you will see that the primary receiver is acting as a hub receiver collecting information from 6 different transmitter nodes simultaneously. The hub receiver can stop listening any time and acts as a transmitter. But this can only be done one pipe/node at a time.

The nRF24L01+ transceiver module uses a packet structure known as Enhanced ShockBurst. This simple packet structure is broken down into 5 different fields.

 

The original ShockBurst structure consisted only of Preamble, Address, Payload and the Cyclic Redundancy Check (CRC) fields. Enhanced ShockBurst brought about greater functionality for more enhanced communications using a newly introduced Packet Control Field (PCF).
This new structure is great for a number of reasons. Firstly, it allows for variable length payloads with a payload length specifier, meaning payloads can vary from 1 to 32 bytes.
Secondly, it provides each sent packet with a packet ID, which allows the receiving device to determine whether a message is new or whether it has been retransmitted (and thus can be ignored).
Finally, and most importantly, each message can request an acknowledgement to be sent when it is received by another device.

 

The original ShockBurst structure consisted only of Preamble, Address, Payload and the Cyclic Redundancy Check (CRC) fields. Enhanced ShockBurst brought about greater functionality for more enhanced communications using a newly introduced Packet Control Field (PCF). This new structure is great for a number of reasons. Firstly, it allows for variable length payloads with a payload length specifier, meaning payloads can vary from 1 to 32 bytes. Secondly, it provides each sent packet with a packet ID, which allows the receiving device to determine whether a message is new or whether it has been retransmitted (and thus can be ignored). Finally, and most importantly, each message can request an acknowledgement to be sent when it is received by another device.

Now, let’s discuss three scenarios to get a better understanding of how two nRF24L01+ modules transact with each other.

1. Transaction with acknowledgement and interrupt. This is an example of positive scenario. Here the transmitter starts a communication by sending a data packet to the receiver. Once the whole packet is transmitted, it waits (around 130 µs) for the acknowledgement packet (ACK packet) to receive. When the receiver receives the packet, it sends ACK packet to the transmitter. On receiving the ACK packet the transmitter asserts interrupt (IRQ) signal to indicate the new data is available.

2. Transaction with data packet lost. This is a negative scenario where a retransmission is needed due to loss of the packet transmitted. After the packet is transmitted, the transmitter waits for the ACK packet to receive. If the transmitter doesn’t get it within Auto-Retransmit-Delay (ARD) time, the packet is retransmitted. When the retransmitted packet is received by the receiver, the ACK packet is transmitted which in turn generates interrupt at the transmitter.

3. Transaction with acknowledgement lost. This is again a negative scenario where a retransmission is needed due to loss of the ACK packet. Here even if the receiver receives the packet in the first attempt, due to the loss of ACK packet, transmitter thinks the receiver has not got the packet at all. So, after the Auto-Retransmit-Delay time is over, it retransmits the packet. Now when receiver receives the packet containing same packet ID as previous, it discards it and sends ACK packet again.

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

How to improve range of nRF24L01+ 2.4GHZ RF transceiver module

1. Reduce power supply noise. An RF circuit that generates a Radio Frequency (RF) signal, is very sensitive to power supply noise. If not controlled, the power supply noise can significantly reduce the range you can get.Unless the power source is a stand-alone battery, there is a good chance that there is noise associated with the generation of the power.  To prevent this noise from entering the system, it is advised to place a 10 µf filter capacitor across the power supply line as physically close to the nRF24L01+ module as possible. An easiest way to get over with is to use a very inexpensive Adapter Module for nRF24L01.

The adapter modules have own 3.3V voltage regulator and a set of filter capacitors, so you can power it with a 5V power supply.

2. Change your channel frequency. Another potential source of noise for an RF circuit is the outside environment, especially if you have neighboring networks set on the same channel or interference from other electronics. To prevent these signals from causing issues, we suggest using the highest 25 channelsyour nRF24L01+ module. Reason for this is WiFi uses most of the lower channels.

3. Lower Data Rate. The nRF24L01+ offers highest receiver sensitivity at 250Kbps speed which is -94dBm. However at 2MBps data rate, the receiver sensitivity drops to -82dBm. If you speak this language, you know that the receiver at 250Kbps is nearly 10 times more sensitive than at 2Mbps. That means the receiver can decode a signal that is 10 times weak. Receiver sensitivity is the lowest power level at which the receiver can detect an RF signal. The larger the absolute value of the negative number, the better the receiver sensitivity. For example, a receiver sensitivity of −94 dBm is better than a receiver sensitivity of −82 dBm by 12 dB. So, lowering the data rate can significantly improve the range you can achieve. Also, for most of our projects, 250Kbps speed is more than sufficient.

4.Higher Output Power. Setting maximum output power can also improve the communication range. The nRF24L01+ lets you choose one of the output power viz. 0 dBm, -6 dBm, -12 dBm or -18 dBm. Selecting 0 dBm output power sends stronger signal over the air.

Signals and connections of the NRF24L01 2.4GHZ RF  transceiver module 


The power consumption of this module is just around 12mA during transmission, which is even lower than a single LED. The operating voltage of the module is from 1.9 to 3.6V, but the good thing is that the other pins tolerate 5V logic, so we can easily connect it to an Arduino without using any logic level converters. 

Three of these pins (MISO, MOSI, SCK) are for the SPI communication and they need to be connected to the SPI pins of the Arduino, but note that each Arduino board have different SPI pins. The pins CSN and CE can be connected to any digital pin of the Arduino board and they are used for setting the module in standby or active mode, as well as for switching between transmit or command mode. The last pin (IRQ) is an interrupt pin which doesn’t have to be used.

GND - ground pin. Connected to Arduino board GND pin.

VCC - power supply pin. Connected to Arduino board 3V3 pin

IRQ - Maskable interrupt pin

MISO (Master In Slave Out) - The Slave line for sending data to the master. SPI Slave Data Output, with tri-state option

MOSI (Master Out Slave In) - The Master line for sending data to the peripherals. SPI Slave Data Input

CE - Chip Enable Activates RX or TX mode

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

SCK (Serial Clock) - SPI Clock. The clock pulses which synchronize data transmission generated by the master. 

Wiring

Input voltage is  from 1.9V to 3.6V. Do not exceed this voltage, if it's more your NRF24L01 module will be damaged.

As nRF24L01+ transceiver module require a lot of data transfer, they will give the best performance when connected up to the hardware SPI pins on a microcontroller. 

1. Master (server) wiring

2. Slave (client) wiring

Step by Step instruction

1. Uploading sketch to the master (server) (Arduino Uno 1)

  1. Do wiring.
  2. Plug your Adruino Uno board into your PC and select the correct board and com port.
  3. Verify and upload the serversketch1 to your Adruino Uno.

2. Uploading sketch to the slave (client) (Arduino Uno 2)

  1. Do wiring.
  2. Plug your Adruino Uno board into your PC and select the correct board and com port.
  3. Verify and upload the clientsketch1 to your Adruino Uno.

3. Establishing the communication

  1. You need to download and install PuTTY client from PuTTY.org
  2. When you upload the code to Arduino Uno 1 and Arduino Uno 2 the client will be sending a message: "Hello World!" to the server via RF and the server is sending back to client the following message: "hello". Those messages are being displayed in the serial monitor. 

Summary

We learnt about the nRF24L01 wireless transceiver module, how it works and interface with Arduino board. nRF24L01 wireless transceiver modules work very well when the receiver and transmiter are close to each other. If you will have positioned them too far you’ll loose the communication. The communication range also vary. It will depend on how much noise in your environment, if there’s any obstacles and if you’re using an external antenna.

You can have multiple nodes and you can set different device addresses to allow multiple clients.The library comes with an example that will help you use that concept.Having the library installed in your Arduino IDE. Go to File -> Examples -> Radiohead -> nrf24 and use these examples "nrf24_reliable_datagram_client" and "nrf24_reliable_datagram_server". If you look at the code you can set different addresses to each device. See more information about it here.

If you want to use Arduino Mega board you must swap pins: 10->53, 13->52, 11->51, 12->50 on the Arduino Mega, and instantiate (line 7 in code) using the following instead: RH_NRF24 nrf24(8, 53); //mega

Libraries:
  • See attachments on the begining of this project description
  • RadioHead library included. Download, unzip and add to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries or in C:\Program Files (x86)\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can find more about it here. It works with almost all RF modules available on the market.

Project resources:

  • See attachments on the begining of this project description


Other projects of Acoptex.com
Easy Basics: Project 083d Sipeed Maixduino Kit for RISC-V AI and IoT of Acoptex.com in ESP8266 ESP-32 16-06-2019
Easy Basics: Project 076f ESP32 Development board - How to use GPIO pins of Acoptex.com in ESP8266 ESP-32 03-06-2019
Easy Basics: Project 082a Lithum battery charger TP4056 of Acoptex.com in UNO 01-06-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 02-06-2019
Viewed: 95 times