Introduction: Use NRF24L01 Wireless in Your Projects
A common wireless module to use in your projects is the NRF24L01. It is relatively inexpensive and very versatile for a wireless transceiver module, that's why I decided to use this module in my projects and have written an instructable tutorial to show you how simple it is to integrate into your Arduino projects.
Before we continue, below is a video of the tutorial if you'd like to watch instead:
Using wireless in a project has the obvious benefit of not requiring wires to communicate data between a microcontroller and a sensor. Where it is not practical to use wires, the NRF24L01 can be an ideal solution such as when using a remote sensor to transmitting data to the controlling microcontroller.
We will now look at how easy it is to connect and setup an NRF24L01 module to an Arduino Uno (or compatible board).
Step 1: NRF24L01 Features and Specifications
The main features and specification for the NRF24L01 are as follows:
- Operates in the 2.4HGz ISM band
- Supply voltage is 3.3V
- SPI pins are 5V tolerant
- 126 selectable channels (frequencies)
- Channels selectable in 1MHz increments
- Output RF power is adjustable
- Up to 2Mbps data rate
Selectable channels can help to avoid interference from nearby devices that are operating on the same frequency.
The modules themselves are very small, about half the size of a matchbox.
These modules can also be purchased with an external antenna socket. Using an external antenna can greatly increase the working range of these devices.
Step 2: Building the Project - Simple One Way Link
The idea of this example it to show that using the NRF24L01 is simple to setup.
We use two Uno boards and two NRF24L01 modules along with the RF24 library in the code. One unit acts as the transmitter and the other as the receiver.
The transmitting unit transmits the text string "It Works !". The receiver receives the text string and displays it on a PC using the serial monitor of the Arduino IDE.
- 2 x Arduino Uno (or compatible boards)
- 2 x NRF24L01 modules
- Hookup wire
- Computer with Arduino IDE installed and a spare USB port
The diagram above lists what pins of the NRF24L01 module connects to what pins of the Arduino board.
Step 3: Loading the Code to the Arduino Boards
Before we continue, the code and pin out diagram are available from the following website as it would be too much to list everything here :
Uploading the Code
Step 1: Upload the transmit code to the Arduino Uno that is connected to the transmitter module.
Step 2: Upload the receive code to the Arduino Uno that is connected to the receiver module.
Run the Code
Power up the transmitter unit with a power supply or USB power supply.
Power up the receiver unit with the USB cable that is plugged into the PC, then select the correct port in the Arduino IDE and open the Serial Monitor.
If all is working well the Serial Monitor should display the text "It Works !" every second.
Step 4: NRF24L01 Setup Summary
Now that the example is working, the next thing to do is to make the project practical. I did this by adding a rain gauge sensor to the tranmitting Arduino and display the rainfall in millimeters on the Arduino IDE's Serial Monitor. Further information on how to do this is on the Smart Microcontroller website at the following link.
I hope this Tutorial has been useful to you. If you liked it please share it with a friend.
Also, I'd really appreciate it for you to join my email subscriber list where we'll keep you up to date with our latest videos, tutorials and articles relating to microcontrollers, Arduino and other electronics information. You'll also receive our free newsletter which is exclusive to our email subscribers only !
Thanks for spending your time to read this Instructable.
I really appreciate it !
We have a be nice policy.
Please be positive and constructive.