Can't get nRF24L01 work.

Hi everbody,

I’m making a project in which two Arduino UNO are communicating via RF through the nrf24L01 modules. As I said, I have two Arduino UNO, a 1uF capacitor between GND-VCC on each module, an external power supply that gives 220VAC – 3.3V 1A and I have used both popular libraries: TMR2h nrF24 an the normal one RF24-Master.

I’m not even trying to send/receive data because on the printDetails() I can clearly see that no addresses are given correctly due to it’s values are fixed to 0x00 or even 0xff. As I read in a lot of forums It’s suposed to be a pin connection but no way I tested and checked it many times. I’m a bit desperate because I’ve spent a lot of hours here and have no idea what else to check.

NOTE :
Initally I was following the tutorial 1-Day Project: Arduino and nRF24L01+ Data Transceiver - YouTube by Julian Ilett (I have the exactly the same connection pinout). The code I tested is the same in the video (the Joystick receiver/transmitter) but as long as It wasn’t working I continued trying with basic example tests:

Maniacbuc library: GitHub - maniacbug/RF24: Arduino driver for nRF24L01
Both codes attached.

The detailPrint() is:

/*******************/
RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS ‘T’ to begin transmitting to the other node

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1

/********************/

Thanks.

RF_RX.ino (1.97 KB)

RF_TX.ino (1.73 KB)

Okay, now I’ve tried with the Arduino 3.3V and it seems that now I have (at least) an associated RX/TX address. The output on transmitter is:

RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS ‘T’ to begin transmitting to the other node

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1

While on receiver:

RF24/examples/GettingStarted/

ROLE: Ping out

*** PRESS ‘T’ to begin transmitting to the other node

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1

THANKS

hello,

try this ( it is a good test).

make a at least 10 uf capacitor between vcc and ground .

I've recently started on this one: Getting Started with nRF24L01+ on Arduino | maniacbug. Same library same all. Detail print seem to be good at least but no way I have no idea why is printing the whole time:

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK

Now sending 4045...failed.

Failed, response timed out.

Now sending 5747...failed.

Failed, response timed out.

Can you focus on this example as I think I'm going through the correct way? Otherwise I need more specific advertisments.

Btw, I just have a 22uF and a 47uF left. Would them be good for this purpose?

hi,
if you have a chinese module you must use an extern alimentaion .you need a 3.3 v linaer regulator as :
-AMS 1117 ,
-2000uf and 1000uf capacitors
the first between Vin and ground and the second between the Vout and ground .

I said you again don't test your nrf with sketh like a getting started ,if you want really know if your module work use the pratic test (boton and led)

Have a look at this Simple nRF24L01+ Tutorial - the examples do work and they are as straightforward as I could make them.

It will be much easier to help if you try to get things going with code that I am familiar with.

...R

Hi Robin2,

I followed your tutorial earlier but now I’ve read it again and do it all again. Trying the SimpleTx/Rx.ino example the only thing I can see in output is: [SimpleRx Starting
]

alomar1997:
I followed your tutorial earlier but now I’ve read it again and do it all again. Trying the SimpleTx/Rx.ino example the only thing I can see in output is: [SimpleRx Starting

Post the actual code that YOU have uploaded to your two Arduinos and also post a photo of a pencil drawing showing how you have everything connected.
Post a sample of the output from both Arduinos.

Exactly what Arduinos are you using? Some of them don’t have enough 3.3v power
Have you got 10µF capacitors across Vcc and GND for the nRF24s
Are you using nRF24s with the PCB antenna or the high-power version with the external antenna?

…R

I post my code later. Here you have a brief schematic. Thanks!

Sorry, here you have the schematic attached. When it refers to the code it is the on you give me.

TX

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

RX

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

Thanks for your time.

WhatsApp_Image_2017-07-17_at_22_45_53_5_.jpg

You can not supply the NRFs via a resistor voltage divider.

bfd5848cce52e012581d5d765b9539c907411be1.jpg

this nrf power supply works very well for me

Hey, what about this regulator?

NOTE: Your 1117 regulator has a Vin of 5V and gives 3.3 or you have other input voltages.

Thanks and I hope this is the real problem.

I don't know but if you will try it you must add high capacitors.

People - please make your images visible on the forum so we don’t have to download them - see this Image Guide

Images from Reply #9

1e81437b9983c00fa7958fef91b1cbe9d9539203.jpg

6efba7240eb0068756d6adba79086ab13abec8cb.jpg

66849b6481207fca748bac17a00fa55e744d64d8.jpg

3e335add7496a548e56fcfe3d16d32d1d4cdbd3e.jpg

93932853dadf01946c304b8547ce398974a7a797.jpg

9d9cd375228b9f9792cad4952fdbafa5ed2ea75c.jpg

bfd5848cce52e012581d5d765b9539c907411be1.jpg

And from Reply #11

6ceb523d8ff14c3f0be86d2aef7c25126e40ccf8.png

And from Reply #12

af985fdcbe684a14f1889347f63308bbf5ec63e2.png

…R

A 1117 regulator should be fine for the 3.3v supply for the RF24. It can be fed from the Arduino 5v pin.

...R

I've recently bough a voltage regulator named LD33V and I did a circuit like this one (I don't have the 1117. I have LD33V):

Now I have a stable power supply that gives me 3.3V- 800mA.

Trying the same code that I posted on post #9 I have on the output serial something like

Data received 
Data received 
Data received ⸮
Data received 
Data received 
Data received 
Data received ⸮
Data received ⸮
Data received 
Data received ⸮
Data received 
Data received 
Data received 
Data received 
Data received 
Data received 
Data received 
Data received 
Data received 
Data received ⸮
Data received ⸮ 

I get data now but it's not readable at all. I'm attaching some pictures of the new power supply circuit. I have also added a 10uF capacitor on each nRF.

Capture 1

Capture 2

NOTE: While on the TX output I can see

Data Sent Message 0  Acknowledge received
Data Sent Message 1  Acknowledge received
Data Sent Message 2  Acknowledge received
Data Sent Message 3  Acknowledge received
Data Sent Message 4  Acknowledge received
Data Sent Message 5  Acknowledge received
Data Sent Message 6  Acknowledge received
Data Sent Message 7  Acknowledge received
Data Sent Message 8  Acknowledge received
Data Sent Message 9  Acknowledge received
Data Sent Message 0  Acknowledge received
Data Sent Message 1  Acknowledge received

once per second, in the RX one I see what I said but on a ultra high speed, not once per second. Robin2, can you deduce what's happening as it is a familiar code to you.

Thanks!

AFAIK the LD33 and the 1117 are the same thing.

Have you got one of them for each nRF24?

What happens if you de-power the receiver (Arduino and nRF24) and the power them on again to make sure that the nRF24 resets?

In fact do that for both Arduinos.

I have seen that very fast output in some of my tests but I can't remember what caused it - although it clearly was not because of data properly received. Is suspect you will get that output from the Rx even when the TX is off. I think it was sorted out by de-powering everything and getting the nRF24 to reset properly. Unfortunately the nRF24 does not have reset instruction or a reset pin.

...R

Yeah, I got two separate power supplies for each nRF. As you said, I disconnected both Arduinos from USB, and also the power supplies from 220V AC, reseted and uploaded both codes again and it seems that the same is happening.

I tried to move and touch while sending/transmitting all the pins from both Arduinos and it seems that data is changing. Now I'm having things like:

Data received p
Data received p
Data received ⸮
Data received 
Data received p
Data received p
Data received 
Data received 
Data received p
Data received ⸮
Data received 
Data received P
Data received 0

I don't know what else it can be. I checked GetStarted examples and it seems that both nRFs get a normal address code. What would you try? I'm open to any suggestion or supposition that you could have as I'm trying to solve this ASAP. Let me know all you could need please.

Thanks for your time.

Hey!

I've worked with these a lot in the past. If you look at this playlist:

I have a four-part series on the nrf24l01.

Antony...