NRF24l01 send and receive help

Hello
I am trying to teach myself how to use the NRF24l01 radio module and am running into issues. I am have set up the device using the guides in the following websites and neither have had success. I also tried the GettingStarted file in the RF24.h library with no luck either. I am also using the adapter for the module.

Basically my problem is I cant send or receive a signal. To start I have added checks in my code to tell is the signal was sent and it always says failure. Weirdly enough when I take the module out of the adapter I get the "message sent" message otherwise its "failure to send". Similarly when removing the ground pin the same problem arises.

When using the GettingStarted file from library, taking the ground pin out seems to actually send a signal although I guess this could be an error. Here is the code that I have been using to test sending capabilities, its pretty much the last minute engineers code with some added checks for send message failure. THanks in advance

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

//create an RF24 object
RF24 radio(9, 8);  // CE, CSN

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

void setup()
{
  Serial.begin(9600);
  radio.begin();
  
  //set the address
  radio.openWritingPipe(address);
  //pinMode(10,OUTPUT); not sure about this. I read somewhere it has to do with SPI
  //Set module as transmitter
  radio.stopListening();
}
void loop()
{
  Serial.println("Monitor Check");
  //Send message to receiver
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  const char *message = "Testing Message"; // The message to send
  bool result = radio.write(&message, sizeof(message)); // Send the message
  if (result) {
    Serial.println("Message sent successfully.");
  } else {
    Serial.println("Failed to send message.");
  }
  delay(1000);
}

first link is indian site. i mean don't trust them

Could be worth telling the forum which Arduino you are using ?

The nRF24L01.h library examples do work, so if they dont for you its likely a problem with the modules themselves or how you have them connected.

1 Like

Here are some tips from my time learning to get the rf24 radios to work.

If you read and, closely, follow Robin2's simple rf24 tutorial you should be able to get them working. That tutorial sure helped me. The code in the examples has been proven to work many many times. If it does not work for you, there is likely a hardware problem.

Run the CheckConnection.ino (look in reply #30 in the tutorial) to verify the physical wiring between the radio module and its processor (Arduino). This is especially useful if all you see is “Data received” repeating much more quickly then there is a problem - most likely theArduino is not communicating properly with its nRF24.

Make sure the rf24 power supply can provide enough current. This is especially true for the high power (external antenna) modules. I use homemade adapters like these. They are powered by 5V and have a 3.3V regulator on the board. Robin2 also has suggested trying with a 2 AA cell battery pack.

If using the high powered radios make sure to separate them by a few meters. They may not work too close together. Try the lower power settings.

Hi, @tdean_22

Can you please post images of your project?
So we can see your component layout.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Thanks for replies. I am using an Arduino UNO predominantly although have tested with my mega also with no luck.

Using the CheckConnection.ino file from Robin2's tutorial I got the case where the arduino was not communicating with the device. My test results are below. I dont really know what any of it means tho sorry.

CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
Note that RF24 does NOT reset when Arduino resets - only when power is removed
If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
communicating with the nRF24

SPI Speedz = 10 Mhz
STATUS = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1 = 0xffffffffff 0xffffffffff
RX_ADDR_P2-5 = 0xff 0xff 0xff 0xff
TX_ADDR = 0xffffffffff
RX_PW_P0-6 = 0xff 0xff 0xff 0xff 0xff 0xff
EN_AA = 0xff
EN_RXADDR = 0xff
RF_CH = 0xff
RF_SETUP = 0xff
CONFIG = 0xff
DYNPD/FEATURE = 0xff 0xff
Data Rate = 1 MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
ARC = 15

AND NOW WITH ADDRESS AAAxR 0x41 41 41 78 52 ON P1
and 250KBPS data rate

SPI Speedz = 10 Mhz
STATUS = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1 = 0xffffffffff 0xffffffffff
RX_ADDR_P2-5 = 0xff 0xff 0xff 0xff
TX_ADDR = 0xffffffffff
RX_PW_P0-6 = 0xff 0xff 0xff 0xff 0xff 0xff
EN_AA = 0xff
EN_RXADDR = 0xff
RF_CH = 0xff
RF_SETUP = 0xff
CONFIG = 0xff
DYNPD/FEATURE = 0xff 0xff
Data Rate = 1 MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
ARC = 15

With this I tried using an external power supply as shown to supply the module with the hope to provide enough current. Still no luck.

Additionally, I update my RF24.h library and still no luck. I am starting to wonder if my module is actually just fried and if I should get a new one.

Here is my set up finally, I don't think the wiring could possibly be wrong, ive reconnected it so many times now that it should have been right on at least one.

Any other suggestions welcome




When you ran the CheckConnection program, did you change the CE and CSN pins in the program to match your wiring?

Your wiring:

//create an RF24 object
RF24 radio(9, 8);  // CE, CSN

The CheckConnection program:

#define CE_PIN   9
#define CSN_PIN 10

I see that you are using the power adapters so the power should be OK.

You only posted the transmit code. Where is your receive code?

I suggest that you change your wiring to match the tutorial and use the power adapters and try the tutorial example code. That code is known to work.

oops my bad, the CE and CSN pins were wrong for the connection check, I have new results which look more promising.
SPI Speedz = 10 Mhz
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x4141417852 0x4141417852
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x4141417852
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1 MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
ARC = 5

AND NOW WITH ADDRESS AAAxR 0x41 41 41 78 52 ON P1
and 250KBPS data rate

SPI Speedz = 10 Mhz
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x4141417852 0x4141417852
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x4141417852
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x27
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250 KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
ARC = 5

In terms of the receiver, I didn't think it was needed just to send a signal so I haven't set one up yet. Does the transmitter need a receiver end to properly transmit data?

You need a rf24 receiver to pick up the signal transmitted by a rf24. Where else would the signal be going?

RF24 is not WiFi or Bluetooth even though it is 2.4GHz.

Please read Robin2's tutorial or the tutorials linked in your OP carefully.

AHAH what do you know it works. I think I skipped the part in the information about how there needs to be a receiver on the end to pick up the signal. Just to clarify, this is a quirk of the NRF module itself and not a general radio transmitter thing? For example, a walkie talkies can just send a signal without knowing there is another one on the same channel. I might just sound like an idiot here but its got me thinking

I am no expert on all things radio, but i can tell you that, it depends.

A transmitter will transmit even if there is no receiver. However, in order to see the transmission there must be a receiver. The receiver must be tuned to the same frequency (channel in rf24 case), have the right address (pipe) and speak the same protocol. So, even though a Bluetooth module is the same frequency as rf24, address and protocol are different so Bluetooth will not pick up rf24. Same with WiFi.

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