nrf24l01 & Arduino Mega & ESP32S

Viewed 11

I have two modules of nrf24l01 and an Arduino MEGA & ESP32S. Mega is the transmitter and ESP32S is the receiver.

Issue:

I'm transmitting a simple message. Receiver is getting radio.available() but when printing the message, it's empty. I suspect that it's radio noise or something. I have been trying other solutions and it didn't work, so I reverted back to the extremly basic implementation.

Actual:

No actual communication, radio is empty despite having radio.available()

Expected:

Hello World showing up.

Code - Transmitter:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  delay(1000);
}

Code - Receiver:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(4, 5); // CE, CSN
const byte address[6] = "00001";

void setup() {
  Serial.begin(115200);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}
void loop() {
  if (radio.available()) {
    char text[32] = "s";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

The NRF24l01 have the following pins

enter image description here

Mega connection:

  • GND => GND
  • VCC => 3.3V
  • CE => PIN 7
  • CSN => PIN 8
  • SCK => PIN 52
  • MOSI => PIN 51
  • MISO => PIN 50
  • IRQ - NOT CONNECTED

enter image description here

ESP32S connection:

  • GND => GND
  • VCC => 3.3V
  • CE => PIN D4
  • CSN => PIN D5
  • SCK => PIN D18
  • MOSI => PIN D32
  • MISO => PIN D19
  • IRQ - NOT CONNECTED

enter image description here

0 Answers
Related