Nrf24l01 not transmitting a string

Since the past few days I've been trying to get two of my nrf24l01 modules to communicate with each other without any progress. I would greatly appreciate any help provided on this forum. Thank you for your time.

I have two nrf24l01 modules (which I bought from here: https://robu.in/product/2-4ghz-nrf24l01palna-sma-antenna-wireless-transceiver-communication-module-1km/) and two arduino nanos. Additionally, I'm using two AMS1117 3.3 V regulators which are fed 5V from my nano. The 3.3V outputs are then given to my radio modules.

I attached my radio module on a breadboard using a simple adapter I made. Then, the connections I made were as follows:

MOSI - D11
MISO - D12 (I also entangled MISO and MOSI wires)
SCK - D13
GND - GND
VCC - 3.3V from AMS
CE - D9
CSN - D10

I've also put a 10uf capacitor between each radio module's GND and VCC.

After all of this, when I ran radio.printdetails(), I got the following output for both radio modules:

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 = 0x65646f4e31 0x65646f4e32
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x65646f4e31
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x02
RF_CH = 0x4c
RF_SETUP = 0x03

Finally, once I was sure about the hardware setup, I tried using the following code suggested at Simple nRF24L01+ 2.4GHz transceiver demo

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

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

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

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

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

And on the transmitter side I got Tx failed and on the receiver side I got nothing displayed on the Serial monitor.

I would greatly appreciate it if you could help me solve my problem corresponding to these radio modules. I thank you again for your time and effort.

Nice code post. A schematic would make this much easier to solve. From your description you need to use a separate power supply for the radios. Doing what you have done is a kludge that works for some but there no assurances it will work for you. It is all over the internet and so are the associated problems.

My Crispy Critter Rules:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive to an Arduino!
Violating these rules tends to make crispy critters out of Arduinos.

char dataReceived[10]="123456789"; 

That means that the transmitter is not working. It is probably wired incorrectly.

You do not check any return values in the following, so you have no way of knowing whether the operations are successful:

    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
1 Like


Hey! Thanks for the reply. Here's a schematic of the modified connections. This time I'm using a 2S LiPo Battery to power both nrfs but still the text isn't transmitted properly. I'm getting data received but the actual data isn't being printed.

I also tried using the code from the following link: nRF24L01 – How It Works, Arduino Interface, Circuits, Codes

After updating the CE and CSN pins in the code, I still get blank data on receiver. Could you please point me in the right direction? Should I get a different radio module like the LoRa? Or is there something I'm missing?

Hey! Thanks for the reply. Here's the schematic.

I've quadruple checked that these are the connections. Could please point me in the right direction? Thanks a lot for your time.

Have you checked connection continuity and operating voltages? Do you have antennas?
Did you solder header pins to the radio modules, and check for solder bridges or bad joints?

If the setup is on a breadboard, those can be quite unreliable.

Post a photo of your setup.

I find several connections missing? Have you read the AMS-1117 data sheet, it is a very good read especially before using one in a project. This is on page 4: "Stability The circuit design used in the AMS1117 series requires the use of an output capacitor as part of the device frequency compensation.
The addition of 22µF solid tantalum on the output will ensure
stability for all operating conditions. " Note 2 capacitors is four missed connections times 2 regulator makes 8. Schematics help a lot.

I'm using one of these boards which I assume take care of the need for any capacitors:

Addionally, here are a few images of my setup. Please let me know if there are any problems (I haven't shown the lipo battery but that is connected to the breadboard when i'm testing the circuit)



Here are a few images of my setup. Please let me know if there are any problems (I haven't shown the lipo battery but that is connected to the breadboard when i'm testing the circuit)



Your photo shows that you are using one of the higher power nRF24L01 devices.

How close are the 2 modules? If they are too close, then the comms will fail.

Hey! Thanks for the reply. After your suggestion, I tried keeping the radio modules apart from each other (about 10 feet) as shown in the below images:


Also, I've tried soldering my capacitors directly on the nrf modules as shown:

However, on the receiver, radio.available is always false. The communication isn't working and I can't figure out why. One thing I noticed was that on my receiver arduino, the Tx led was lit but Rx wasn't and on the transmitter arduino, both Rx and Tx weren't lit. Does that imply anything? Thanks for your time once again.

One thing I noticed was that on my receiver arduino, the Tx led was lit but Rx wasn't and on the transmitter arduino, both Rx and Tx weren't lit. Does that imply anything?

One thing I noticed was that on my receiver arduino, the Tx led was lit but Rx wasn't and on the transmitter arduino, both Rx and Tx weren't lit. Does that imply anything? Thanks for your time once again.

Hey guys. I thank you all for your time. Finally, my radio modules seem to be communicating. I had three of them and one wasn't working. When I tested with the third radio module with the capacitor soldered on, the communication was smoothly working. For anyone else who stumbles into this problem, the guide posted here: nRF24L01's not communicating helped me determine the working condition of my nrf. You should give it a shot

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