NRF24LO1+ with Arduino Nano Not working

Hi All,

I have been having some problems getting some NRF24LO1+ modules to communicate with each other. I am using two Arduino Nanos wired as the right image shows.

At first I was able to upload the code to both Arduinos however didn't get the data through on the receiving module, at best I would get a range of random "?" Below is the script I am running. I have also tried using the RF24 Getting started libraries to no avail.

Transmitter

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


RF24 radio (7, 8); // CNS, CE

byte addresses[6] = ("0");

void setup() {
 Serial.begin(9600);
 delay(1000);
 radio.begin();
 radio.setChannel(115);
 radio.setPALevel(RF24_PA_MIN);
 radio.setDataRate( RF24_250KBPS );
 radio.openWritingPipe(addresses);
 delay(1000);
}

void loop() {
 const char text[] = "Hello World";
 radio.write(&text, sizeof(text));
 Serial.print(text);
 delay(1000);
 
}

Receiver

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


RF24 radio (7, 8); // CNS, CE

byte addresses[6] = ("0");

void setup() {
 Serial.begin(9600);
 delay(1000);
 radio.begin();
 radio.setChannel(115);
 radio.setPALevel(RF24_PA_MIN);
 radio.setDataRate( RF24_250KBPS );
 radio.openReadingPipe(1, addresses[0]);
 radio.startListening();
}

void loop() {
   if (radio.available()) {
     char text[32] = "Available";
     radio.read(&text, sizeof(text));
     Serial.println(text);
   }
}

I am running the NRF24s on a powered breadboard set to 3.3v with a 100uf capacitor to get the cleanest power supply I can.

As mentioned I'm not getting anything in my serial monitor other than time stamps and the occasional series of seemingly arbitrary characters.

Any ideas on things to try next to get the modules talking?

@amanbasra, do not cross-post. Threads merged.

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) make sure there is sufficient distance between the two nRF24s so that the signal does not overwhelm the receiver - try 3 metres separation. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

...R

Robin2:
Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) make sure there is sufficient distance between the two nRF24s so that the signal does not overwhelm the receiver - try 3 metres separation. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

...R

That thread is very helpful thanks!

I've gone through the articles and followed it through to check the connection. On one of the arduinos I am gettiing the following

12:25:32.192 -> CheckConnection Starting
12:25:32.192 -> 
12:25:32.192 -> FIRST WITH THE DEFAULT ADDRESSES after power on
12:25:32.267 ->   Note that RF24 does NOT reset when Arduino resets - only when power is removed
12:25:32.338 ->   If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
12:25:32.447 ->      communicating with the nRF24
12:25:32.484 -> 
12:25:32.484 -> STATUS = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
12:25:32.553 -> RX_ADDR_P0-1 = 0x7f7f7fffff 0xffffffffff
12:25:32.587 -> RX_ADDR_P2-5 = 0xfe 0xfe 0xff 0xfe
12:25:32.624 -> TX_ADDR = 0x7f7f7fffff
12:25:32.624 -> RX_PW_P0-6 = 0xfe 0xff 0xff 0xfe 0xfe 0xff
12:25:32.699 -> EN_AA = 0xfe
12:25:32.699 -> EN_RXADDR = 0xfe
12:25:32.735 -> RF_CH = 0xfe
12:25:32.735 -> RF_SETUP = 0xfc
12:25:32.769 -> CONFIG = 0xfe
12:25:32.769 -> DYNPD/FEATURE = 0xfe 0xff
12:25:32.806 -> Data Rate = 1MBPS
12:25:32.842 -> Model = nRF24L01
12:25:32.842 -> CRC Length = 16 bits
12:25:32.879 -> PA Power = PA_MAX
12:25:32.917 -> 
12:25:32.917 -> 
12:25:32.917 -> AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
12:25:32.988 ->  and 250KBPS data rate
12:25:32.988 -> 
12:25:32.988 -> STATUS = 0x7f RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
12:25:33.057 -> RX_ADDR_P0-1 = 0xffffffffff 0x7e7e7e7efe
12:25:33.094 -> RX_ADDR_P2-5 = 0xff 0xfe 0xfe 0xff
12:25:33.129 -> TX_ADDR = 0xffffffffff
12:25:33.165 -> RX_PW_P0-6 = 0xfe 0xfe 0xff 0xff 0xfe 0xfe
12:25:33.200 -> EN_AA = 0xfe
12:25:33.235 -> EN_RXADDR = 0xfe
12:25:33.235 -> RF_CH = 0xff
12:25:33.274 -> RF_SETUP = 0xff
12:25:33.274 -> CONFIG = 0xff
12:25:33.310 -> DYNPD/FEATURE = 0xff 0xfe
12:25:33.343 -> Data Rate = 1MBPS
12:25:33.343 -> Model = nRF24L01
12:25:33.377 -> CRC Length = 16 bits
12:25:33.414 -> PA Power = PA_MAX
12:25:33.414 -> 
12:25:33.414 ->

Not just 0x00 or 0xff... does that suggest the arduino is communicating with the NRF successfully?

On the other arduino I am getting 0x00. I have tried attaching it to a battery power source with a 10uf capacitor. I've also tried using a different NRF module as well as using a different nano and even with a Uno. Still no results. [/code]

Update

I've managed to get what I believe to be a successful connection between the NRF and arduinos. The following is the result from them

Arduino Nano

13:20:16.940 -> FIRST WITH THE DEFAULT ADDRESSES aftCheckConnection Starting
13:20:18.568 -> 
13:20:18.568 -> FIRST WITH THE DEFAULT ADDRESSES after power on
13:20:18.643 ->   Note that RF24 does NOT reset when Arduino resets - only when power is removed
13:20:18.716 ->   If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
13:20:18.826 ->      communicating with the nRF24
13:20:18.863 -> 
13:20:18.863 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
13:20:18.900 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
13:20:18.937 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
13:20:18.974 -> TX_ADDR		 = 0xe7e7e7e7e7
13:20:19.012 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
13:20:19.084 -> EN_AA		 = 0x3f
13:20:19.084 -> EN_RXADDR	 = 0x03
13:20:19.118 -> RF_CH		 = 0x4c
13:20:19.118 -> RF_SETUP	 = 0x07
13:20:19.154 -> CONFIG		 = 0x0e
13:20:19.154 -> DYNPD/FEATURE	 = 0x00 0x00
13:20:19.187 -> Data Rate	 = 1MBPS
13:20:19.225 -> Model		 = nRF24L01+
13:20:19.225 -> CRC Length	 = 16 bits
13:20:19.262 -> PA Power	 = PA_MAX
13:20:19.262 -> 
13:20:19.262 -> 
13:20:19.262 -> AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
13:20:19.337 ->  and 250KBPS data rate
13:20:19.337 -> 
13:20:19.337 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
13:20:19.407 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
13:20:19.479 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
13:20:19.514 -> TX_ADDR		 = 0xe7e7e7e7e7
13:20:19.550 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
13:20:19.585 -> EN_AA		 = 0x3f
13:20:19.622 -> EN_RXADDR	 = 0x03
13:20:19.622 -> RF_CH		 = 0x4c
13:20:19.660 -> RF_SETUP	 = 0x27
13:20:19.660 -> CONFIG		 = 0x0e
13:20:19.695 -> DYNPD/FEATURE	 = 0x00 0x00
13:20:19.695 -> Data Rate	 = 250KBPS
13:20:19.695 -> Model		 = nRF24L01+
13:20:19.732 -> CRC Length	 = 16 bits
13:20:19.768 -> PA Power	 = PA_MAX

Arduino Uno

13:21:11.822 -> CheckConnection Starting
13:21:11.822 -> 
13:21:11.822 -> FIRST WITH THE DEFAULT ADDRESSES after power on
13:21:11.822 ->   Note that RF24 does NOT reset when Arduino r⸮CheckConnection Starting
13:21:13.497 -> 
13:21:13.535 -> FIRST WITH THE DEFAULT ADDRESSES after power on
13:21:13.572 ->   Note that RF24 does NOT reset when Arduino resets - only when power is removed
13:21:13.643 ->   If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
13:21:13.716 ->      communicating with the nRF24
13:21:13.753 -> 
13:21:13.753 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
13:21:13.824 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
13:21:13.861 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
13:21:13.934 -> TX_ADDR		 = 0xe7e7e7e7e7
13:21:13.934 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
13:21:14.006 -> EN_AA		 = 0x3f
13:21:14.006 -> EN_RXADDR	 = 0x03
13:21:14.041 -> RF_CH		 = 0x4c
13:21:14.041 -> RF_SETUP	 = 0x07
13:21:14.078 -> CONFIG		 = 0x0e
13:21:14.078 -> DYNPD/FEATURE	 = 0x00 0x00
13:21:14.116 -> Data Rate	 = 1MBPS
13:21:14.116 -> Model		 = nRF24L01+
13:21:14.152 -> CRC Length	 = 16 bits
13:21:14.190 -> PA Power	 = PA_MAX
13:21:14.190 -> 
13:21:14.190 -> 
13:21:14.190 -> AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
13:21:14.265 ->  and 250KBPS data rate
13:21:14.303 -> 
13:21:14.303 -> STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
13:21:14.341 -> RX_ADDR_P0-1	 = 0xe7e7e7e7e7 0x4141417852
13:21:14.377 -> RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
13:21:14.415 -> TX_ADDR		 = 0xe7e7e7e7e7
13:21:14.451 -> RX_PW_P0-6	 = 0x00 0x20 0x00 0x00 0x00 0x00
13:21:14.489 -> EN_AA		 = 0x3f
13:21:14.526 -> EN_RXADDR	 = 0x03
13:21:14.526 -> RF_CH		 = 0x4c
13:21:14.563 -> RF_SETUP	 = 0x27
13:21:14.563 -> CONFIG		 = 0x0e
13:21:14.601 -> DYNPD/FEATURE	 = 0x00 0x00
13:21:14.637 -> Data Rate	 = 250KBPS
13:21:14.637 -> Model		 = nRF24L01+
13:21:14.675 -> CRC Length	 = 16 bits
13:21:14.675 -> PA Power	 = PA_MAX

These results are different from my initial 0x00 and 0xff combinations so I am taking that as a good sign. Correct me if I am wrong but I am now operating under the assumption that the connection between the arduinos and the NRF modules are working...

That being said using the SimpleRX and SimpleTX I am still having any success. Still seeing a fast stream of "Data Received" Again with the occasional series of "?????"

Any further ideas on what the issue could be?

amanbasra:
I am now operating under the assumption that the connection between the arduinos and the NRF modules are working...

That seems to be correct

Still seeing a fast stream of "Data Received"

That is definitely wrong. Assuming the transmission is once per second then the received message should appear once per second.

Do you get the fast "Data Received" when the Tx is disconnected?

Maybe there is a loose connection that worked when you did the connection test?

Have you some spare nRF24s in case one of them is faulty?

...R

Robin2:
That seems to be correct
That is definitely wrong. Assuming the transmission is once per second then the received message should appear once per second.

Do you get the fast "Data Received" when the Tx is disconnected?

Maybe there is a loose connection that worked when you did the connection test?

Have you some spare nRF24s in case one of them is faulty?

...R

I've managed to figure it out.

The connection to the NRF was successful however I hadn't updated the "SimpleRX/TX" to reflect the CE and CNS pins I was using (7, 8). I've managed to get it to work as well as sending data to a servo from a rotary encoder. Now to figure out IMU's!

Thanks for your help!