NRF24 modules not working.

Hello I am using two nrf24 modules with two Arduino uno and they are not working. my wires are GND -> GND, VCC -> 3.3V, CE -> 9, CSN-> 10, SCK-> 13, MO->11, MI -> 12. I followed the instructions on the Robin 2 tutorial. I have checked that my arduinos give the 3.3V and they do. I ran the code that checks connection and the connections are correct. This is the code

// 18 Mar 2018 - simple program to verify connection between Arduino
//      and nRF24L01+
//  This program does NOT attempt any communication with another nRF24

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

#include <printf.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);
    printf_begin();

    Serial.println("CheckConnection Starting");
    Serial.println();
    Serial.println("FIRST WITH THE DEFAULT ADDRESSES after power on");
    Serial.println("  Note that RF24 does NOT reset when Arduino resets - only when power is removed");
    Serial.println("  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not");
    Serial.println("     communicating with the nRF24");
    Serial.println();
    radio.begin();
    radio.printDetails();
    Serial.println();
    Serial.println();
    Serial.println("AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1");
    Serial.println(" and 250KBPS data rate");
    Serial.println();
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.setDataRate( RF24_250KBPS );
    radio.printDetails();
    Serial.println();
    Serial.println();
}


void loop() {

}

and I get this

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

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 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX

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

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 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x27
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX

the code that I am using for the nrf24 modules is this

Transmitter

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

Receiver

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

I got the info from here -> Simple nRF24L01+ 2.4GHz transceiver demo - Exhibition / Gallery - Arduino Forum

Thank you for being one of the few to give comprehensive information without having to be asked.

However you have not told us what actually happens when you run the programs. Please post a sample of the output from the two programs.

Are you using genuine Unos? I have a clone Mega which can't provide enough 3.3v current for an nRF24 whereas the genuine Mega (and genuine Unos) can.

If you suspect that the nRF24 may not be getting enough current try powering it from a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

...R

Hello Robin, thanks for the quick response, whenever I run the simple transmitter program i get this

Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed

repeatedly

and on the receiver side I just get

SimpleTx Starting

I am using two genuine Unos and when the nrf are connected to 3.3 volts the code that shows if connection is correct gives me the 0x00 which means that the connection is wrong. It only shows that the connection is right when I have it on the 5V pin. I have connected it to an external power source and set the power source to 3.3 V and the code still shows that the connection is wrong, it only starts to show that the connection is right after 4V, I have also made sure to connect the grounds of the arduino and power source. I have tried my other nrf 24 modules and I get the same problem, I had previously been using the nrf24 and they were not working until I set them on the 5V but now they stopped working.

Jonathan2003:
I am using two genuine Unos and when the nrf are connected to 3.3 volts the code that shows if connection is correct gives me the 0x00 which means that the connection is wrong. It only shows that the connection is right when I have it on the 5V pin.

I wonder if you have damaged your nRF24s? Or if one of them is faulty? Do you have a third one to try?

Have you tried the two nRF24s in opposite roles?

Have you briefly disconnected power (to restart the nRF24) after uploading the Arduino program?

Post a link so we can see exactly what modules you have?

Keep in mind that my connection-test program does not test the wireless part of the nRF24.

...R

I would test a different power source for the NRFs first.

If it still fails, you could try

 radio.setPALevel(RF24_PA_MIN);

maybe the modules are too close.

@Robin2:

Maybe it would be usefull to add

radio.setPALevel(RF24_PA_MIN);

to your example programs.

The default of MAX seems to hurt more than it helps, at least in the verification phase.

Whandall:
@Robin2:

Maybe it would be usefull to add

radio.setPALevel(RF24_PA_MIN);

to your example programs.

The default of MAX seems to hurt more than it helps, at least in the verification phase.

I have never included that in any of my programs and have never had a problem, even when the two nRF24s are a few inches apart on the desk beside me.

Have you found that setting PA_MIN solves a problem with the low power nRF24s?

...R

I never had the overpowering problem myself,
but high power modules seem to exihibit a near field blindness.

Whandall:
but high power modules seem to exihibit a near field blindness.

While I don't have any of the high power modules myself I have the impression from what I have read on various Threads that they do need to be separated by a considerable distance.

...R

I was experiencing the same issues as Jonathan and after running the SimpleRx/TX code he posted I discovered I can only communicate unidirectionally. I can reliably send data to one module but I do not receive a reply back. I am using the long range modules so I set the power level to minimum since I am testing at close range, I added 10uF capacitors to the power pins on both modules, and I triple checked my wiring (I am using Arduino Nanos). I am still unable to communicate in the other direction. Is it possible that one of the modules is deffective? I only have two of them so I am unable to swap one of them out to determine which one is causing the problem. Any advice would be appreciated, many thanks!

Here are the modules I am using:

The high power modules need a separate 3.3v power supply.

...R

I am using these modules --->

3Pcs NRF24L01+ SI24R1 2.4G Wireless Power Enhanced Communication Receiver Module Sale - Banggood USA-arrival notice-arrival notice?

and this adapter ---->

Socket Adapter Module Board For 8 Pin NRF24L01+ Wireless Transceiver Module Sale - Banggood USA-arrival notice-arrival notice?

I have tried them in opposite roles but no success.

I haven't tried setting it to LOW but the nrF24 are about 1-2 feet apart in my desk, I will separate them and also test by setting it to low to see if that's the problem.

Jonathan2003:
and this adapter ---->

You did not mention the adapter before. I think it takes a 5v input and converts it to 3.3v for the nRF24

I have seen other Threads with similar adapters and I have no reason to think they cause a problem. But have you tried using the nRF24s without the adapter and powered with a pair of AA alkaline cells?

Apart from that, the only thing I can suggest is to get at least one more nRF24 in case one of the pair that you have is faulty. I think I have had 15 or 20 of them now and only one was faulty.

...R

So I ordered NRF24 from longrunner on Amazon. Although I dont have experieince with RF modules. I have ordered 9 of these modules and I can't seem to get any of them to work. Im sure some of them may work but I don't hae the right combination. I have read through the forums on wiring issues, capacitors, and sketches. I have ran voltage and conitnuity checks on all wiring.

Can someone post a for sure working sketch that will tell me if a module is any good at all. I can repost pictures of test. Im to the point where Im going to send them all back.

I have literally went through 80 percent of the sketches and a few others on the web.

Installed Older version of IDE and erased and reinstalled libraries.

Here I am.

Whos has something that I can for sure say if an indivual module is repsonding or not?

APPLICATION
Small temperature sensor network for an old seasonal employer to monitor temperatures.
Hardware : 2 nanos 1 knockoff and 1 Arduino brand and D18B20(which do operate correctly) 10uF capacitor 2 NRF24+Pa+LNA modules(longerunner)

Is there an better alternative to the NRF24. I have looked into XBEE but can not find a simplifed sensor network that has been put together.

danielmdavis1:
Can someone post a for sure working sketch that will tell me if a module is any good at all

The URL for this Simple nRF24L01+ Tutorial is in the first Post in this Thread.

...R

If you really had done all the research, you would not have to ask such a beginner question,
or hijack a thread to ask it.

First step would be to use printDetails to see if you can access the chip.

If that works reliably (breadboard is not an option) on your modules you can start checking
communication. Start with low power settings. Lower bitrates have longer reach.

A capacitor on the power pins of the module is a must for any module,
for the normal modules you can get away powered by an Arduino,
the modules with PA/LNA (often with arial, sometimes with ceramic element) need a separate power supply.

Robin2's tutorial has a connection test sketch and some examples.

If you really need the network functionality, you will have to figure that out yourself,
I'm not aware of a good tutorial or use of that functionality.

to danielmdavis1

noob here myself. have struggled with successes but still lots of anomolies/weirdnesses.

echo advice to use separate 3.3v supply, esp for LNA modules which supposedly require 100ma or so, but Arduino 3.3v pins only put out half that.

echo advice to use caps across + & - on 3.3v supply. Made a noticeable improvement for me.

In my programming and breadboarding I have used Serial.print's and LED's to give me status updates for each step of the program: "sending [data]" "data received [data]" etc. Doing so, I see it often happens that partial messages are received. I'm sending char strings rather than numbers. Further, instead of just relying on the auto ack, I have my receiving node programmed to send complete text-received back to sender. I think I got this from maniacbug protocol.

Another weirdness: sometimes my sending node can transmit, and according to serial monitor on receiving node, the message is correctly received, and full reply sent back to sending node, but sending node doesn't receive it so counts it as transmission fail.

echo advice from somewhere: look carefully at printout from printDetails(). If RX_ADDR & TX_ADDR are mostly 0's, your Arduino is not really communicating with the nRF24 module.

I too have a bunch of modules. One (at least) shows on printDetails as model "nRF24L01" ie. without the "+" suffix. In fact this module won't communicate with the others.

FWIW