Issues with nRF24L01 radio transceiver

Hi,
I am having dome problems with getting some nRF24L01's to communicate with eachother and have spent the entire night trawling the internet for solutions. I starting by using this code:

Sender:

/*
* 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] = "00001";

void setup() {
 radio.begin();
 radio.openWritingPipe(address);
 radio.setPALevel(RF24_PA_MIN);
 radio.stopListening();
}

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

Receiver:

/*
* 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] = "00001";

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);
 }
}

This printed empty strings really, really quickley with the ocasional set of random characters and 0's.
Whether i got empty strings seemed to depend on how close the modules were to eachother.
Even when they were 10mm apart it was mostly nothing coming through.
I then tried the code from Robin2 (Simple nRF24L01+ 2.4GHz transceiver demo - Exhibition / Gallery - Arduino Forum)
I used: simpleTx.ino and simpleRx.ino. This showed on the transmitter as :Data Sent Message 1 Tx failed
The receiver was showing : Data Received With nothing following it
I then tried using the checkCommunication.ino on reply #29 of the same page. This returned

⸮w⸮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		= 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	= 0xe7e7e7e7e7 0x4141417852
RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
TX_ADDR		= 0xe7e7e7e7e7
RX_PW_P0-6	= 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA		= 0x3f
EN_RXADDR	= 0x00
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		= 0


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	= 0xe7e7e7e7e7 0x4141417852
RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
TX_ADDR		= 0xe7e7e7e7e7
RX_PW_P0-6	= 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA		= 0x3f
EN_RXADDR	= 0x02
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		= 0

I plugged in the other module and ran the same test and got:

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		= 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	= 0x4141417852 0xc2c2c2c2c2
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	= 0x00
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	= 0x02
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

Running the test on the other arduino it is returning mostly 0xff.
While i have some experience with programing and electronics I am far
from brilliant im at the stage where I know of terms but not neccesaraly
what they mean.
This is the most complicated thing I have attempted so any help will be greatly apriciated.
In the likly event that i have forgoten to mention something please mention it to me,
its my first time on the fourm so please be gentle

Edit: Both power supplies have a 100micro farad capacitor on them to assist with power supply stability

@xeidit, you have done some strange formatting to your Post which makes it very difficult to read. Please correct it.

It's not clear how you did the connection tests. You should do one test with Arduino-A and nRF24-A and the other test with Arduino-B and nRF24-B so you can be sure both pairs work.

How are you powering the nRF24s? 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.

...R

HIya,

I sortedout the formating, idk what happened. I dont have a holder for the AA batteries so i used a bench power suppley. I tried transmitting with the NANO and i was receiveing nothing on the UNO. (Transmiting and receiving using the code from before). The serial output on the uno was:

SimpleTx Starting
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed

Then running the connection test on the NANO with the power supply.

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

Hopefully that sheds some more light on what is going on

xeidit:
I dont have a holder for the AA batteries

Get a couple. They are not expensive. The great advantage of a pair of AA cells is that you know they provide a good steady DC current. If the nRF24 won't work with a pair of AA cells then it won't work with any other power supply.

The connection test in Reply #2 has failed. The data rate has not been changed to 250 KPBS

There is no point trying anything else until you have successful connection tests with both Arduinos and their nRF24s.

...R

Il order a couple of holders, is there anything else i can do to improve my chances. Is it worth getting a new set of nRF24l01's, if it is, what is a reliable source of them?

Thanks for all the help :slight_smile:

xeidit:
Is it worth getting a new set of nRF24l01's,

If you can afford them they won't do any harm and they may be useful.

if it is, what is a reliable source of them?

I don't have any advice about that. In any case I don't even know what country you are in.

...R

Robin2:
If you can afford them they won't do any harm and they may be useful.

I don't have any advice about that. In any case I don't even know what country you are in.

Im in the uk, I was just wondering if you had any suppliers that you prefered.
So since the last post i have spent some time to make the connectors better, before i was using loads of individual male to female connectors. I have combined them into bigger connectors to try and make the connections more secure and the wireing less fiddley. I then ran the connection test using the uno on both sets of modules and cables. This time the result was different:

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        = 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    = 0x00
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    = 0x02
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

To be honest I have very little idea what any of it means however I do know that it is not 0, which means that it is connected properly.
Motivated by this I connected one of the modules up to the NANO with a 100uf capacitor between the 3.3v rail and ground. I ran the connection test and this time IT WORKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Continueing on I uploaded the transmitter code to the UNO and the receiver code to the NANO and that successfully transmitted the message. However on the serial monitor it is still showing "Tx failed" which I dont quite understand why its doing that. Either way it works so im not complaining.

I think the main takeaway from this is that: Take time to wire the module correctly, it cant go on a breadboard so its more difficult to do and that the capacitor is helpfull to power the module especially on the NANO.

Also, Robin I cant thank you enough. You have been so helpfull with this issue youre code is easy to use and follow. It is really good to know that people like you are out there :slight_smile:

IIRC I got my nRF24 modules from https://hobbycomponents.com

However on the serial monitor it is still showing "Tx failed" which I dont quite understand why its doing that.

Most likely it means that the Tx was able to send the message and the Rx was able to receive it but there was a problem because the acknowledgement from the Rx was not received by the Tx. That could be because the Rx failed to send it or because the Tx failed to receive it.

Do you have capacitors on the supplies for both nRF24s?

Try swapping the Tx and Rx programs between the Arduinos.

...R