The NRF24L01 is a 2.4GHz RF wireless transceiver module that enables the easy addition of wireless communication to a wide range of applications. It operates in the globally available 2.4GHz ISM band and can be used for applications such as wireless keyboard and mouse receivers, home automation, remote controls, and various other wireless communication systems. Its low cost, low power consumption, and ease of use make it a popular choice among hobbyists and professionals alike.
Pin Number | Name | Description |
---|---|---|
1 | GND | Ground |
2 | VCC | Power supply (1.9 to 3.6V) |
3 | CE | Chip Enable (activates RX or TX mode) |
4 | CSN | Chip Select Not (SPI chip select) |
5 | SCK | Serial Clock (SPI clock) |
6 | MOSI | Master Out Slave In (SPI data input to NRF24L01) |
7 | MISO | Master In Slave Out (SPI data output from NRF24L01) |
8 | IRQ | Interrupt Request (active low, maskable interrupt signal) |
#include <SPI.h>
#include "RF24.h"
// Create an RF24 object
RF24 radio(9, 10); // CE, CSN pins
void setup() {
// Initialize the NRF24L01 module
radio.begin();
// Set the PA Level (transmit power)
radio.setPALevel(RF24_PA_LOW);
// Open a writing and reading pipe on each radio, with unique addresses
radio.openWritingPipe(0xF0F0F0F0E1LL);
radio.openReadingPipe(1, 0xF0F0F0F0D2LL);
// Start the radio listening for data
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
}
}
printDetails()
function provided by the RF24 library to check the configuration of the NRF24L01 module.Q: Can I use the NRF24L01 with a 5V microcontroller like Arduino UNO? A: Yes, but you will need to use a level shifter or voltage divider for the SPI lines, as the NRF24L01 operates at a maximum of 3.6V.
Q: How many NRF24L01 modules can communicate with each other? A: The NRF24L01 can have up to 6 receiver addresses, allowing one transmitter to communicate with up to 6 receivers in a star network topology.
Q: Can the NRF24L01 module transmit and receive at the same time? A: No, the NRF24L01 cannot transmit and receive simultaneously as it is not a full-duplex device. It can be quickly switched between transmission and reception modes, though.
Q: What is the maximum data rate of the NRF24L01?
A: The NRF24L01 supports data rates of 250kbps, 1Mbps, and 2Mbps. The data rate can be configured using the setDataRate()
function of the RF24 library.