This circuit integrates an NRF24L01 module with an ESP32 microcontroller to establish a wireless communication link. The NRF24L01 is a 2.4GHz wireless transceiver that interfaces with the ESP32 through SPI (Serial Peripheral Interface). The ESP32 is programmed to receive data from the NRF24L01 module and output the received data to the Serial Monitor. The circuit is powered by a 3.3V supply, which is common to both the ESP32 and the NRF24L01 to ensure compatible logic levels.
/*
* This Arduino Sketch sets up an ESP32 to receive data from an Arduino Uno
* using the NRF24L01 module. The ESP32 is configured to receive data and
* print it to the Serial Monitor.
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
// NRF24L01 pin connections
#define CE_PIN 4
#define CSN_PIN 5
// Create an RF24 object
RF24 radio(CE_PIN, CSN_PIN);
// Address for the NRF24L01 communication
const byte address[6] = "00001";
void setup() {
// Start the serial communication
Serial.begin(115200);
// Initialize the NRF24L01 radio
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
// Check if data is available to read
if (radio.available()) {
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
}
}
The NRF24L01 module does not have its own code as it is a hardware module. It is controlled by the ESP32 through the SPI interface. The code provided above for the ESP32 includes the necessary commands to operate the NRF24L01 module.
This documentation provides an overview of the circuit, including the components used, their wiring, and the code that operates the ESP32 microcontroller to communicate with the NRF24L01 module.