Need help getting my nRF24L01 module to work

I could use some help identifying why my module or code is not working. I am using two Arduino Uno's rev3.

Here is my pin configuration:

Module --> Arduino uno rev3
GND --> GND (on digital pin side)
Vcc --> 3.3V
Sck --> pin 13
MISO --> pin 12
MOSI --> pin 11
CSN --> pin 10
CE --> pin 9

I am using this code for the Transmitter:

//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

// Define pins
#define CE_PIN 9
#define CSN_PIN 10

// Create RF24 radio object
RF24 radio(CE_PIN, CSN_PIN);

//address through which two modules communicate.
const byte address[6] = "1Node";

void setup() {
  
  while (!Serial)
    ;
  Serial.begin(9600);
  

  radio.begin();

  //set the address
  radio.openWritingPipe(address);

  //Set module as transmitter
  radio.stopListening();
}
void loop() {
  //Send message to receiver
  const char text[] = "Hello World";
  bool pie = radio.write(&text, sizeof(text));
  Serial.println(pie);
  Serial.print("Data sent: ");
  Serial.println(text);
  

  delay(1000);
}

And the following for the Receiver:

//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

// Define pins
#define CE_PIN 9
#define CSN_PIN 10

// Create RF24 radio object
RF24 radio(CE_PIN, CSN_PIN);

//address through which two modules communicate.
const byte address[6] = "1Node";

void setup()
{
  while (!Serial);
    Serial.begin(9600);
  
  if (!radio.begin()) {
    Serial.println(F("radio hardware is not responding!!"));
    while (1) {}  // hold in infinite loop
  }

  radio.begin();
  
  //set the address
  radio.openReadingPipe(0, address);
  
  //Set module as receiver
  radio.startListening();
  Serial.println("setup complete");
}

void loop()
{
  //Read the data if available in buffer
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    Serial.print("Data received: ");
    Serial.println(text);
  }
}

Describe this with useful information.

Also, show a photo of your wiring.

When TX and RX are involved, verify you have the correct direction (one man's tx is another man's rx)

When I send a message using radio.write() I get false, and I am not receiving a message on the receiving side.

Here is my wiring:

My Rx represents the Receiver, and Tx transmitter if that is what you mean by direction.

Some devices with a "tx" silkscreen are indicating "connect tx wire here" "transmit leaves here" and some devices are indicating "transmit enters here"... verify this with your radio devices' documentation.

That very close distance might be a reason for trouble.

2 Likes

Should radiobe initialized twice?

1 Like

The majority of problems with these modules reported here are caused by using an inadequate power supply. This is particularly the case when the high power modules are used

The first thing to try is to add an electrolytic capacitor across the power terminals of the RF module as close to them as possible. Do you have any such capacitors ?

To be honest this is not likely to solve the problem but is easy to try. A better solution is to use an external power supply for each RF module

As a halfway house you can use one of these breakout boards powered from a 5V pin on the Arduino

1 Like

I agree with @UKHeliBob

This may make it easier to understand:

Power Stability Issues with RF24 Radio Modules

As described in the RF24 Common Issues Guide, radio modules, especially the PA+LNA versions, are highly reliant on a stable power source. The 3.3V output from Arduino is not stable enough for these modules in many applications. While they may work with an inadequate power supply, you may experience lost packets or reduced reception compared to modules powered by a more stable source.

Symptoms of Power Issues:

  • Radio module performance may improve when touched, indicating power stability issues.
  • These issues are often caused by the absence of a capacitor, a common cost-saving omission by some manufacturers.

Temporary Patch :

  • Add Capacitors: Place capacitors close to the VCC and GND pins of the radio module. A 10uF capacitor is usually sufficient, but the exact value can depend on your circuit layout.
  • Use Low ESR Capacitors: Capacitors with low Equivalent Series Resistance (ESR) are recommended, as they provide better power stability and performance.

Adding the appropriate capacitors can greatly improve the reliability of your RF24 module by ensuring a stable power supply, thus minimizing packet loss and enhancing overall performance. A separate power supply for the radios is the best solution.

The problem is not an unstable signal but instead, a lack of one. Thanks for the info on how to solve a unstable signal that may be helpful if I can get the radios to actually send and receive.

the image was just for everyone to see my wiring and such, when testing they are at least a foot apart.

Have you tried improving the power supply to the modules ?

1 Like

ok, I checked this. My MOSI and MISO to the Arduino are correctly wired to the Arduino.

1 Like

I haven't. Would a battery pack work to test if the issue is insufficient power.

What type of battery pack do you have in mind ?

I have a 4 AA battery holder

ok I also measured the current and the voltage from the Arduino to the module, is it supposed to have current going while in receive mode but, not receiving any messages. What I got from my readings was a voltage of 3V and current while in Rx mode and not receiving messages of 0.00 mA.

That is also a very short distance. Several times too little distance has been a troubleing factor.