NRF24L01 Connection issues following How to Mechatronics tutorial

I am attempting to follow a How To Mechatronics tutorial (https://howtomechatronics.com/tutorials/arduino/arduino-wireless-communication-nrf24l01-tutorial/, first part). I have an Arduino mega 2560 and an uno R3, each are properly wired.

My transmitter code:

/*
* Arduino Wireless Communication Tutorial
*     Example 1 - Transmitter Code
*                
* by Dejan Nedelkovski, www.HowToMechatronics.com
* 
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "12345";
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  Serial.println("Sent message!");
  delay(1000);
}

And my receiver code:

/*
* Arduino Wireless Communication Tutorial
*       Example 1 - Receiver Code
*                
* by Dejan Nedelkovski, www.HowToMechatronics.com
* 
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "12345";
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}
void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

I am not getting any compilation or runtime errors, but nothing is being received.

the text is in French but the code is just code. have a look at NRF24L01 example you could test to validate your wiring is correct

the example takes what you type on the Serial monitor on the emitter side (EMETTEUR) and sends it to the serial monitor on the receiver side (RECEPTEUR)

I wired up an Uno and a Mega with the wiring from the linked How to Mechatronics tutorial and loaded the transmit code to the Uno and the receive code to the Mega. The Mega receives just fine. One difference is that the rf24 on my Mega has its own 3.3V supply from a LM1117 3.3 supplied from the 5V line of the Mega. Insufficient power from the on board 3.3V regulators is a common problem when using these radios. Often putting a 10uF (or more) cap across the 3.3V supply to the radio (as close as possible to the radio) will help. They will supply a bit of extra current during brief high current demands. There are available adapters with the 3.3V regulators on them.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.