Hi, I'm trying to connect 2 ESP32 Wroom to nrf24L01 modules, but at the receiver end I'm not getting any expected output at all. The connection diagram is attached, which is the same for both Tx and Rx.
I have added the code for them and modified code for both Tx and Rx and output in serial monitor can be seen in the snippet with 3 different color arrow marks.
I would like to know
- Is it possible to do this with ESP32, or would I need a modification in the rf24 library?
- Are the connections proper?
-------Update--------
-
I think the ESP32 Rx is receiving something from the tx, because as in the Rx code, it enters the radio.available section, but all data type values sent from Tx (even if a string, float or int ) comes as 0. I think if no radio data would've been available (please check pic with the Tx, Rx and serial monitor image with the 3 arrows) , then it would've entered the else section in void loop() and printed "No radio" right?
-
In the snippet picture with Tx, Rx and serial monitor, I have changed the address of Tx and Rx to the same one (0xE0E0F0F0) and still get same 0 output in serial monitor. Weird thing is even if I set the address of Rx and Tx to different ones, I still get same output as in the pic. So does this mean radio.available is capturing some random data?
-
As per the link at Optimized high speed nRF24L01+ driver class documentation: examples/old_backups/GettingStarted_HandlingFailures/GettingStarted_HandlingFailures.ino
I tried putting radio.printDetails and am getting unrelated values in the registers (as shown in one of the screenshots attached) Does this mean it's HW connection problem?
I would really appreciate any help regarding this to connect 2 ESP32 Wroom with the nrf24L01 radio module
Preformatted text
//-------------TX---------
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(4, 5); // CE, CSN
const uint64_t address1 = 0xE8E8F0F0E1LL;
int counter = 2; // just checking with counter start 2
float temperature;
float humidity;
struct MyData
{
int counter;
float temperature;
float humidity;
};
MyData data;
void setup() {
Serial.begin(115200);
radio.begin();
radio.openWritingPipe(address1);
//radio.setPALevel(RF24_PA_MIN);
}
void loop(void) {
Serial.println("send ...");
data.counter = counter;
//Set random values as sensors are not connected yet
data.temperature = 10;
data.humidity = 36;
radio.write(&data, sizeof(MyData));
Serial.print("counter is ");
Serial.println(counter);
counter=counter+1;
delay(1000);
}
//------RX --
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(4, 5); // CE, CSN
const uint64_t address1 = 0xE8E8F0F0E1LL;
struct MyData
{
int counter;
float temperature;
float humidity;
};
MyData data;
void setup() {
Serial.begin(115200);
radio.begin();
radio.openReadingPipe(0, address1);
//radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
if (radio.available()) {
radio.read(&data, sizeof(MyData));
Serial.println("Packet No.");
Serial.println(data.counter);
Serial.println("temperature =");
Serial.println(data.temperature);
Serial.println("humidity= ");
Serial.print(data.humidity);
Serial.println();
delay(1000);
}
else{
Serial.println("No radio");
}
}