Persistent problem with the NRF24L01+

Hi everyone,

First i would like to thank Robin that has provided a structured tutorial to follow in the configuartion of these modules. I have been try to set up the wireless comunication between these two NRF24 modules with the amplifier and antenna for a couple of weeks now without any success.

I tried first with the Radiohead library and then with the RF24 library suggested in the tutorial, using the examples frovided for simple RX and simple TX.

The setup is made by two Arduino nano clones, two NRF24 with the antenna and the amplifier mounted on top of the two adapter boards with the voltage regulator. The power is supplied to one of the arduinos (transmitter) and the 2 NRF24 adapter board from an external 5 V power supply for stability reasons. The current rating of the power supply is equal to 600 mA. Both arduinos have a common ground with the NRF modules.

I have first checked the wiring and then the connection with Robin's script:

16:57:33.810 -> DYNPD/FEATURE	 = 0x00 0x00
16:57:33.810 -> Data Rate	 = 1MBPS
16:57:33.858 -> Model		 = nRF24L01+
16:57:33.858 -> CRC Length	 = 16 bits
16:57:33.905 -> PA Power	 = PA_MAX
16:57:33.905 -> ARC		 = 0
16:57:33.951 -> 
16:57:33.951 -> 
16:57:33.951 -> AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
16:57:33.997 ->  and 250KBPS data rate
16:57:33.997 -> 
16:57:33.997 -> SPI Speedz	 = 10 Mhz
16:57:34.043 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
16:57:34.090 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
16:57:34.136 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
16:57:34.183 -> TX_ADDR		 = 0xe7e7e7e7e7
16:57:34.183 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
16:57:34.276 -> EN_AA		 = 0x3f
16:57:34.276 -> EN_RXADDR	 = 0x03
16:57:34.323 -> RF_CH		 = 0x4c
16:57:34.323 -> RF_SETUP	 = 0x27
16:57:34.323 -> CONFIG		 = 0x0e
16:57:34.370 -> DYNPD/FEATURE	 = 0x00 0x00
16:57:34.370 -> Data Rate	 = 250KBPS
16:57:34.418 -> Model		 = nRF24L01+
16:57:34.418 -> CRC Length	 = 16 bits
16:57:34.465 -> PA Power	 = PA_MAX
16:57:34.465 -> ARC		 = 0

2nd Module

16:59:37.232 -> SPI Speedz	 = 10 Mhz
16:59:37.279 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
16:59:37.324 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
16:59:37.371 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
16:59:37.417 -> TX_ADDR		 = 0xe7e7e7e7e7
16:59:37.464 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
16:59:37.511 -> EN_AA		 = 0x3f
16:59:37.511 -> EN_RXADDR	 = 0x03
16:59:37.557 -> RF_CH		 = 0x4c
16:59:37.557 -> RF_SETUP	 = 0x07
16:59:37.557 -> CONFIG		 = 0x0e
16:59:37.603 -> DYNPD/FEATURE	 = 0x00 0x00
16:59:37.603 -> Data Rate	 = 1MBPS
16:59:37.650 -> Model		 = nRF24L01+
16:59:37.650 -> CRC Length	 = 16 bits
16:59:37.698 -> PA Power	 = PA_MAX
16:59:37.698 -> ARC		 = 0
16:59:37.698 -> 
16:59:37.698 -> 
16:59:37.698 -> AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
16:59:37.792 ->  and 250KBPS data rate
16:59:37.792 -> 
16:59:37.792 -> SPI Speedz	 = 10 Mhz
16:59:37.840 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
16:59:37.887 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
16:59:37.934 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
16:59:37.981 -> TX_ADDR		 = 0xe7e7e7e7e7
16:59:37.981 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
16:59:38.028 -> EN_AA		 = 0x3f
16:59:38.074 -> EN_RXADDR	 = 0x03
16:59:38.074 -> RF_CH		 = 0x4c
16:59:38.121 -> RF_SETUP	 = 0x27
16:59:38.121 -> CONFIG		 = 0x0e
16:59:38.121 -> DYNPD/FEATURE	 = 0x00 0x00
16:59:38.167 -> Data Rate	 = 250KBPS
16:59:38.167 -> Model		 = nRF24L01+
16:59:38.214 -> CRC Length	 = 16 bits
16:59:38.214 -> PA Power	 = PA_MAX
16:59:38.260 -> ARC		 = 0

The results seems ok so i proceeded to upload the code for simple transmission:

The transmitter side seems to transmit as on the serial monitor i get:

SimpleTx Starting
18:11:17.409 -> Data Sent Message 0  Acknowledge received
18:11:18.389 -> Data Sent Message 1  Acknowledge received
18:11:19.414 -> Data Sent Message 2  Acknowledge received
18:11:20.397 -> Data Sent Message 3  Acknowledge received
18:11:21.422 -> Data Sent Message 4  Acknowledge received
18:11:22.402 -> Data Sent Message 5  Acknowledge received
18:11:23.386 -> Data Sent Message 6  Acknowledge received
18:11:24.415 -> Data Sent Message 7  Acknowledge received
18:11:25.392 -> Data Sent Message 8  Acknowledge received
18:11:26.421 -> Data Sent Message 9  Acknowledge received
18:11:27.400 -> Data Sent Message 0  Acknowledge received
18:11:28.380 -> Data Sent Message 1  Acknowledge received
18:11:29.408 -> Data Sent Message 2  Acknowledge received
18:11:30.390 -> Data Sent Message 3  Acknowledge received
18:11:31.425 -> Data Sent Message 4  Acknowledge received
18:11:32.407 -> Data Sent Message 5  Acknowledge received
18:11:33.385 -> Data Sent Message 6  Acknowledge received
18:11:34.412 -> Data Sent Message 7  Acknowledge received
18:11:35.394 -> Data Sent Message 8  Acknowledge received
18:11:36.421 -> Data Sent Message 9  Acknowledge received

The recieving side tho is stuck at:

18:12:41.267 -> SimpleRx Starting

The problem with the recieving side seems to carry on to other examples such as the "getting started" in the RF24 library where by switching from transmitter mode to reciever mode the module does not output anything.
Same with the Radiohead library with the server-client example.

As a simple sanity check here, does the transmitter output show "Acknowledge received" or "Tx failed" if you power off the receiver?

OK, i guess it is important for the troubleshooting effort to list the variations that i am trying on my end.

Each configuration starts by removing the external power to the NRF24 modules so they reset.

1 - Transmitting with the reciever off. With no common gound between arduino and NRF24 transmitter

18:52:08.062 -> Data Sent Message 2  Tx failed
18:52:09.092 -> Data Sent Message 2  Tx failed
18:52:10.076 -> Data Sent Message 2  Tx failed
18:52:11.104 -> Data Sent Message 2  Tx failed
18:52:12.133 -> Data Sent Message 2  Acknowledge received
18:52:13.115 -> Data Sent Message 3  Acknowledge received
18:52:14.144 -> Data Sent Message 4  Tx failed
18:52:15.216 -> Data Sent Message 4  Tx failed
18:52:16.245 -> Data Sent Message 4  Tx failed
18:52:17.278 -> Data Sent Message 4  Tx failed
18:52:18.261 -> Data Sent Message 4  Tx failed
18:52:19.292 -> Data Sent Message 4  Acknowledge received
18:52:20.267 -> Data Sent Message 5  Acknowledge received
18:52:21.301 -> Data Sent Message 6  Acknowledge received
18:52:22.280 -> Data Sent Message 7  Tx failed
18:52:23.356 -> Data Sent Message 7  Tx failed
18:52:24.387 -> Data Sent Message 7  Acknowledge received
18:52:25.411 -> Data Sent Message 8  Acknowledge received
18:52:26.395 -> Data Sent Message 9  Acknowledge received
18:52:27.372 -> Data Sent Message 0  Acknowledge received
18:52:28.362 -> Data Sent Message 1  Acknowledge received
18:52:29.395 -> Data Sent Message 2  Acknowledge received
18:52:30.376 -> Data Sent Message 3  Tx failed
18:52:31.503 -> Data Sent Message 3  Tx failed
18:52:32.486 -> Data Sent Message 3  Acknowledge received
18:52:33.519 -> Data Sent Message 4  Acknowledge received
18:52:34.502 -> Data Sent Message 5  Acknowledge received
18:52:35.486 -> Data Sent Message 6  Acknowledge received
18:52:36.473 -> Data Sent Message 7  Acknowledge received
18:52:37.501 -> Data Sent Message 8  Acknowledge received
18:52:38.480 -> Data Sent Message 9  Tx failed
18:52:39.509 -> Data Sent Message 9  Tx failed
18:52:40.493 -> Data Sent Message 9  Tx failed
18:52:41.572 -> Data Sent Message 9  Tx failed
18:52:42.596 -> Data Sent Message 9  Tx failed
18:52:43.625 -> Data Sent Message 9  Tx failed
18:52:44.656 -> Data Sent Message 9  Tx failed
18:52:45.635 -> Data Sent Message 9  Acknowledge received
18:52:46.665 -> Data Sent Message 0  Acknowledge received

2 - Transmitting with reciever off and common ground (This should be the correct response with the reciever off I guess)

18:55:04.900 -> SimpleTx Starting
18:55:05.885 -> Data Sent Message 0  Tx failed
18:55:06.920 -> Data Sent Message 0  Tx failed
18:55:07.908 -> Data Sent Message 0  Tx failed
18:55:08.943 -> Data Sent Message 0  Tx failed
18:55:09.928 -> Data Sent Message 0  Tx failed
18:55:10.952 -> Data Sent Message 0  Tx failed
18:55:11.981 -> Data Sent Message 0  Tx failed
18:55:12.967 -> Data Sent Message 0  Tx failed
18:55:13.992 -> Data Sent Message 0  Tx failed
18:55:15.020 -> Data Sent Message 0  Tx failed
18:55:16.050 -> Data Sent Message 0  Tx failed
18:55:17.034 -> Data Sent Message 0  Tx failed
18:55:18.063 -> Data Sent Message 0  Tx failed
18:55:19.092 -> Data Sent Message 0  Tx failed
18:55:20.081 -> Data Sent Message 0  Tx failed
18:55:21.106 -> Data Sent Message 0  Tx failed
18:55:22.093 -> Data Sent Message 0  Tx failed
18:55:23.125 -> Data Sent Message 0  Tx failed
18:55:24.156 -> Data Sent Message 0  Tx failed
18:55:25.187 -> Data Sent Message 0  Tx failed
18:55:26.174 -> Data Sent Message 0  Tx failed
18:55:27.159 -> Data Sent Message 0  Tx failed
18:55:28.187 -> Data Sent Message 0  Tx failed
18:55:29.218 -> Data Sent Message 0  Tx failed
18:55:30.250 -> Data Sent Message 0  Tx failed
18:55:31.232 -> Data Sent Message 0  Tx failed
18:55:32.269 -> Data Sent Message 0  Tx failed

3 - Transmitting with reciever ON (Both transmitter and reciever with common ground to the NRF24 and the reciever arduino powered by external power supply)

18:55:04.900 -> SimpleTx Starting
18:55:05.885 -> Data Sent Message 0  Tx failed
18:55:06.920 -> Data Sent Message 0  Tx failed
18:55:07.908 -> Data Sent Message 0  Tx failed
18:55:08.943 -> Data Sent Message 0  Tx failed
18:55:09.928 -> Data Sent Message 0  Tx failed
18:55:10.952 -> Data Sent Message 0  Tx failed
18:55:11.981 -> Data Sent Message 0  Tx failed
18:55:12.967 -> Data Sent Message 0  Tx failed
18:55:13.992 -> Data Sent Message 0  Tx failed
18:55:15.020 -> Data Sent Message 0  Tx failed
18:55:16.050 -> Data Sent Message 0  Tx failed
18:55:17.034 -> Data Sent Message 0  Tx failed
18:55:18.063 -> Data Sent Message 0  Tx failed
18:55:19.092 -> Data Sent Message 0  Tx failed
18:55:20.081 -> Data Sent Message 0  Tx failed
18:55:21.106 -> Data Sent Message 0  Tx failed
18:55:22.093 -> Data Sent Message 0  Tx failed
18:55:23.125 -> Data Sent Message 0  Tx failed
18:55:24.156 -> Data Sent Message 0  Tx failed
18:55:25.187 -> Data Sent Message 0  Tx failed
18:55:26.174 -> Data Sent Message 0  Tx failed
18:55:27.159 -> Data Sent Message 0  Tx failed
18:55:28.187 -> Data Sent Message 0  Tx failed
18:55:29.218 -> Data Sent Message 0  Tx failed
18:55:30.250 -> Data Sent Message 0  Tx failed
18:55:31.232 -> Data Sent Message 0  Tx failed
18:55:32.269 -> Data Sent Message 0  Tx failed

1 - Transmitting with the reciever ON. With no common gound between arduino and NRF24 transmitter

18:52:08.062 -> Data Sent Message 2  Tx failed
18:52:09.092 -> Data Sent Message 2  Tx failed
18:52:10.076 -> Data Sent Message 2  Tx failed
18:52:11.104 -> Data Sent Message 2  Tx failed
18:52:12.133 -> Data Sent Message 2  Acknowledge received
18:52:13.115 -> Data Sent Message 3  Acknowledge received
18:52:14.144 -> Data Sent Message 4  Tx failed
18:52:15.216 -> Data Sent Message 4  Tx failed
18:52:16.245 -> Data Sent Message 4  Tx failed
18:52:17.278 -> Data Sent Message 4  Tx failed
18:52:18.261 -> Data Sent Message 4  Tx failed
18:52:19.292 -> Data Sent Message 4  Acknowledge received
18:52:20.267 -> Data Sent Message 5  Acknowledge received
18:52:21.301 -> Data Sent Message 6  Acknowledge received
18:52:22.280 -> Data Sent Message 7  Tx failed
18:52:23.356 -> Data Sent Message 7  Tx failed
18:52:24.387 -> Data Sent Message 7  Acknowledge received
18:52:25.411 -> Data Sent Message 8  Acknowledge received
18:52:26.395 -> Data Sent Message 9  Acknowledge received
18:52:27.372 -> Data Sent Message 0  Acknowledge received
18:52:28.362 -> Data Sent Message 1  Acknowledge received
18:52:29.395 -> Data Sent Message 2  Acknowledge received
18:52:30.376 -> Data Sent Message 3  Tx failed
18:52:31.503 -> Data Sent Message 3  Tx failed
18:52:32.486 -> Data Sent Message 3  Acknowledge received
18:52:33.519 -> Data Sent Message 4  Acknowledge received
18:52:34.502 -> Data Sent Message 5  Acknowledge received
18:52:35.486 -> Data Sent Message 6  Acknowledge received
18:52:36.473 -> Data Sent Message 7  Acknowledge received
18:52:37.501 -> Data Sent Message 8  Acknowledge received
18:52:38.480 -> Data Sent Message 9  Tx failed
18:52:39.509 -> Data Sent Message 9  Tx failed
18:52:40.493 -> Data Sent Message 9  Tx failed
18:52:41.572 -> Data Sent Message 9  Tx failed
18:52:42.596 -> Data Sent Message 9  Tx failed
18:52:43.625 -> Data Sent Message 9  Tx failed
18:52:44.656 -> Data Sent Message 9  Tx failed
18:52:45.635 -> Data Sent Message 9  Acknowledge received
18:52:46.665 -> Data Sent Message 0  Acknowledge received

The reciever also only outputs

19:06:55.876 -> SimpleRx Starting

in the serial monitor when i power the transmitter with the external power supply and the reciever via USB.

From What I can see i cannot initialize a server or reciever on from any library onto the arduino and have the serial monitor output something

I'm a bit confused by your term "common ground". You should have a common ground between the Tx Nano and the Tx NRF24L01. You should also have a common ground between the Rx Nano and the Rx NRF24L01.

It sounds like you are using the NRF24L01+LNA+PA variants. I can't recall off the top of my head what the default RF power settings are. There is a good chance that the RF level from the Tx module is overwhelming the receiver and effectively deafening it.

On both Nanos, you can try adding in:

radio.setPALevel(RF24_PA_MIN);

at the end of setup. This will put both of them into low RF power mode whilst you are working with them on the bench.

@lorenzo6880, There is absolutely no point in trying anything without a common GND between the Arduino and its nRF24.

Have you tried swapping the programs so that the Tx takes the role of Rx and vice versa - is the outcome identical?

Pleas confirm that you are using the code from my Tutorial with NO CHANGES.

...R

First, thanks for the quick reply Mark.

The explanation for common ground is exactly what you described. Both arduinos are connected to the - (negative) rail of the breadboard, where also the NRF24 modules are connected. Basically both arduinos and NRF24 modules are on the same ground.

Yes I am using the NRF24L01+LNA+PA version. and the modules are 30 cm apart.

I will try the extra line of code

At 30cm apart you are quite probably overloading the Rx NRF24L01 with RF. The 2 radio modules are effectively shouting at each other.

You need to reduce the amount of RF signal being received. Normally this isn’t an issue because the radio modules are generally some distance apart in normal use.

You can either:

  • Move the radio modules some distance apart
  • Reduce the transmit power on both the Tx and the Rx
  • Place some RF absorbing material between the Tx and the Rx

There may be other options as well.

As suggested I tried swapping the transmitter and reciever code between the 2 Arduinos and I am obtaining the same results presented above. The transmitter fails to send and the reciever is stuck at

19:06:55.876 -> SimpleRx Starting

I added the line of code suggested, so the code uploaded on the arduinos is now:

// SimpleTx - the master or the transmitter

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


#define CE_PIN   9
#define CSN_PIN 10

const byte slaveAddress[5] = {'R','x','A','A','A'};


RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataToSend[10] = "Message 0";
char txNum = '0';


unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second


void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTx Starting");

    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
    radio.setPALevel(RF24_PA_MIN);
}

//====================

void loop() {
    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
        prevMillis = millis();
    }
}

//====================

void send() {

    bool rslt;
    rslt = radio.write( &dataToSend, sizeof(dataToSend) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
    Serial.print(dataToSend);
    if (rslt) {
        Serial.println("  Acknowledge received");
        updateMessage();
    }
    else {
        Serial.println("  Tx failed");
    }
}

//================

void updateMessage() {
        // so you can see that new data is being sent
    txNum += 1;
    if (txNum > '9') {
        txNum = '0';
    }
    dataToSend[8] = txNum;
}
// SimpleRx - the slave or the receiver

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

#define CE_PIN   9
#define CSN_PIN 10

const byte thisSlaveAddress[5] = {'R','x','A','A','A'};

RF24 radio(CE_PIN, CSN_PIN);

char dataReceived[10]; // this must match dataToSend in the TX
bool newData = false;

//===========

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleRx Starting");
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.startListening();
    radio.setPALevel(RF24_PA_MIN);
}

//=============

void loop() {
    getData();
    showData();
}

//==============

void getData() {
    if ( radio.available() ) {
        radio.read( &dataReceived, sizeof(dataReceived) );
        newData = true;
    }
}

void showData() {
    if (newData == true) {
        Serial.print("Data received ");
        Serial.println(dataReceived);
        newData = false;
    }
}

Basically the tutorial code with the additional line to set the PA low.

I tried this and the reciever is still stuck at

19:06:55.876 -> SimpleRx Starting

At this point I am really confused, to be honest. Even if i quadruple checked the wires i will change wires and breadboad. Really do not know what is producing this behavior of the reciever not strarting

PS: i will try to move the module to another part of the room

I wonder if the problem (or one of the problems) lies with the fact that both setups are on the same breadboard?

Do you have a way of separating the 2 systems?

Maybe, I will try to rewire the two systems with indipendent external power supplies and breadboards tomorrow, on two different sides of the lab and check if there is any difference.

I am quite new to the Arduino world so thanks again for the help!

lorenzo6880:
The explanation for common ground is exactly what you described. Both arduinos are connected to the - (negative) rail of the breadboard,

You don't need to have the two Arduinos connected to a common GND - if you do they are not "wireless"

lorenzo6880:
I added the line of code suggested, so the code uploaded on the arduinos is now:

Don't make ANY changes to my Tutorial programs until after you get your system working.

...R

Hi, I have had finally sime time off to try again the two NRF24L01+ modules with the PA. As suggested I separated the two module; they are now on two different breadboards, with two indipendent external power supplies (5V to the adapter board of the NRF module). I made sure to put a common ground between Arduino and the relative NRF24L01.

-I clean installed the IDE removing all the data in AppData and Documents, reinstalled only the recommended version of the library on the IDE.
-I double checked the wiring and ran the “diagnostic test” from Robin’s tutorial to verify that the arduino and the NRF are “talking” correctly between each other.
-The code is exactly the one posted by Robin in his tutorial, copied and pasted both on the transmitter and the reciever

-I placed the two arduinos in two different tables of the same room to give them some distance (approximatly) 1.5 meters

  • I swapped the reciever arduino board with a spare one and same for the NRF24 reciever.

I am experiencing still the same problem. The reciever side is not able to recieve anything and does not print anything after:

17:47:54.374 -> SimpleRx Starting

Any idea?

lorenzo6880:
Any idea?

Not really, sorry.

Have you tried powering the nRF24s from a pair of AA alkaline cells (3v)?

Maybe one the nRF24s is faulty?

...R

I don't know, it may be that the boards i bought are bad, all 3. They come from the same supplier. I will proceed with my work using the HC-12 I recently recieved. Maybe in the future i will try order some other NRF24 and see what happens