NRF24L01 is a Low power 2.4 GHz wireless RF Module from Nordic Semiconductors. It can operate with baud rates from 250 kbps up to 2 Mbps. If it is operated in an open space with a lower baud rate, it can reach up to 300 feet. So it is used in short range applications like Home Automation, Toys, Gaming Controllers and more.
The NRF24L01 Module can able to both transmit and as well as receive the data. It uses SPI protocol for communicating with Microcontrollers. Hence you can use the Module with Arduino on SPI Communication pins. We will see how to interface this module with an Arduino and control an LED from another Arduino. With a 1 Mhz spacing on 2400 Mhz – 2525 Mhz operating range (2.40Ghz – 2.525 GHz), it can give a possibility to have a network of 125 independently working modems in the same area. Each channel can have up to 6 addresses and can communicate with up to 6 other units at the same time.
Step 1: Features of NRF24L01
- Operating Voltage:9V to 3.6V
- Supply Voltage:3V
- Pin Voltage: 5V Tolerant (no need for Level Converters)
- Low-cost single-chip 2.4GHz GFSK RF transceiver IC
- Operating Range (open space): 300 feet (can increase up to 3000 feet using an external antenna)
In this tutorial, we will send and receive data using two NRF24L01 Module setup. One setup is for Transmitter side and another for Receiver side. We send commands as string “ON” (whatever message you want to send) on the transmitter side, The Receiver side we will print the same message on Serial Monitor that was sent from the other side.
To learn how to create a Baby Monitoring Project using NRF24L01 - Visit Here
Step 2: Pre-requisites
- Arduino Uno – 2 Nos. (can also use Nano)
- NRF24L01 Wireless RF Module – 2 Nos.Jumper Wires
- RF24 Library – https://github.com/tmrh20/RF24/
- SPI Library
Step 3: Pin Details
- GND – Ground
- VCC – Power Supply 3.3V (1.9V to 3.6V)
- CE – Chip Enable
- CSN – Chip Select Not
- SCK – Serial Clock for SPI Bus
- MOSI – Master Out Slave In
- MISO – Master in Slave Out
- IRQ – Interrupt Pin (active low)
The Module consumes 1.9V to 3.6 V, But the Pins can handle up to 5V tolerant.
Step 4: SPI Connections for Various Boards
If you are using Arduino Uno, Pro Mini, Nano or Pro Micro, then the SPI Pins are the same as the following circuit diagram. If you are using Arduino Mega then check the SPI pins that are mapped differently as per its hardware design. Check the SPI Library reference page for different SPI Pins on different board types here. Additionally, the Arduino boards have a separate ICSP header for compatible with Sheilds.
Step 5: The Circuit for the Transmitter Side and Receiver Side Are the Same for This Example.
The circuit for the transmitter side and receiver side are the same for this example.
Step 6: Code – Transmitter Side:
Step 7: Receiver
The receiver circuit is the same as our transmitter circuit in our project. So make connections as per the transmitter circuit and make sure to upload the correct code for the receiver.
Step 8: Receiver Code:
Step 9: Explanation:
The NRF24l01 can act as a transmitter and receiver. In the above code on the transmitter side, we send ‘ON’ text and the same will be displayed on the receiver side via Serial Monitor and Turns ON the LED Connected at Pin 4. The NRF24l01 can be identified by its address. It is mentioned in a number string. We used
const byte address = "00001";
We used ‘00001’ as the address here. You can assign any number string to set the address. The data is sent via a read/write pipe on the NRF24l01. It is a temporary buffer that holds the data to be sent or received.
Transmitter – Writing data to the Pipe:
Receiver – Reading data from the Pipe:
This is the simple transmitting and receiving setup for the NRF module. Alternatively, you can send sensor data from the transmitter side and according to the sensor values, you can perform some actions on the receiver side.
Step 10: Baby Monitoring Project Using NRF24L01
The extended version of this tutorial is covered in our blog. Make a Baby Monitoring Project using NRF24L01 Module.
Visit our blog for ' Baby monitoring project using this NRF24L01 Module'.
For more tutorials visit - FactoryForward Blog
Shop Online at FactoryForward India (Raspberry Pi, Arduino, Sensors, Robotic Parts, DIY Kits) and more.