Issues with nrf24l01+

Hi, i want to build a simple remote controller for my rc car.
I choose a pair of nrf24l01+ antennas that i bought on Amazon to accomplish this task.

After reading @Robin2 's post about these devices i tried the communication with his sketch (Simple TX, simple RX) but it doesn't work.

I'm opening this post because i can't get out from this.

  • I have an Arduino UNO for the car and an Arduino Nano Every for controller.
  • The controller has a four AA battery pack so there is a good power supply to feed the antenna. (Car will be fed trough a Lipoly battery)
  • There are 5V adapter for both antennas.
  • I've tried the SimpleCheckConnection.ino of Robin2 and the result are these (i always build code, remove power/unplug usb and then reconnect):

Arduino Nano Every

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	= 0x000000001c 0x0000000070
RX_ADDR_P2-5	= 0x38 0x38 0x1c 0xc6
TX_ADDR		= 0x6c6c6c6cec
RX_PW_P0-6	= 0xe0 0x1c 0xe0 0x38 0x38 0x1c
EN_AA		= 0x3f
EN_RXADDR	= 0x1c
RF_CH		= 0x38
RF_SETUP	= 0x1c
CONFIG		= 0x0e
DYNPD/FEATURE	= 0x38 0x38
Data Rate	= 2 MBPS
Model		= nRF24L01+
CRC Length	= 16 bits
PA Power	= PA_HIGH
ARC		= 0

AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
and 1MBPS 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	= 0x000000001c 0x0000000070
RX_ADDR_P2-5	= 0x38 0x38 0x1c 0xc6
TX_ADDR		= 0x6c6c6c6cec
RX_PW_P0-6	= 0xe0 0x1c 0xe0 0x38 0x38 0x1c
EN_AA		= 0x3f
EN_RXADDR	= 0x1c
RF_CH		= 0x38
RF_SETUP	= 0x1c
CONFIG		= 0x0e
DYNPD/FEATURE	= 0x38 0x38
Data Rate	= 2 MBPS
Model		= nRF24L01+
CRC Length	= 16 bits
PA Power	= PA_HIGH
ARC		= 0

Arduino UNO

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 0xc2c2c2c2c2
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	= 0x03
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 1MBPS 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	= 0x03
RF_CH		= 0x4c
RF_SETUP	= 0x03
CONFIG		= 0x0e
DYNPD/FEATURE	= 0x00 0x00
Data Rate	= 1 MBPS
Model		= nRF24L01+
 CRC Length	= 16 bits
PA Power	= PA_LOW
ARC		= 0
  • I forced both antennas to set data rate to RF24_1MBPS and power amplifier to RF24_PA_LOW but the antenna connected to arduino nano doesn't do that.
  • Address is exactly the same of the sketch (const byte thisSlaveAddress[5] = { 'R', 'x', 'A', 'A', 'A' }; )
  • Both antennas has a 100uF capacitor between VCC and GND pin (soldered directly on the module)
  • I've already tried to upload the SimpleTx.ino and SimpleRx of Robin2, move the controller few meters away from car and check if car detect signal but doesn't work
  • I used jumper wires (direct from module to arduino for signal) and separated the power wires from the signal wires
  • I checked that MISO, MOSI, SCK, CE, CSN connection are right

Honestly i tried multiple solutions but no one worked for me. Only one time i got a successfully connection (and message delivered).

Probably one of two antenna is defective? (Maybe the one connected to arduino every?)

P.S: two meters away from me there is my WiFi router. I read from Robin2 post that can affect the transmission but i don't know; in any case the antenna connected to arduino nano doesn't change PALevel and DataRate....

do you have another UNO to try with (instead of the Every)?

Posting an annotated schematic as you have wired it will help a lot. POsting the completer program would also help.

Hi, there are my two schematics.

Car with arduino uno (i removed servo motors because actually are not connected)

Controller with arduino nano

Code is mainly a copy of Robin2's code. There are only difference in two lines: setPaLevel and setDataRate:

This is code for arduino nano (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_1MBPS);
    radio.setPALevel(RF25_PA_LOW);
    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;
}

This is code for arduino UNO (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_1MBPS);
    radio.setPALevel(RF24_PA_LOW);
    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;
    }
}

For check connection info code is this:

// 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 1MBPS data rate");
    Serial.println();
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.setDataRate(RF24_1MBPS);
    radio.setPALevel(RF24_PA_LOW);
    radio.printDetails();
    Serial.println();
    Serial.println();
}


void loop() {

}

Library version of RF24 is TMRh20 1.4.6 but i already tested with 1.1.7 with no result.

@J-M-L I have another arduino uno, i can try

worth checking to rule out a possible incompatibility issue with the Nano Every and TMRh20

just to be sure, you are plugging in your nRF24L01 this way, right?
image

Yes, i plugged the nrf24l01+ in that way

@ziosam There are some more suggestions of things you can try on the this post from @groundfungus.

Guys are we sure the CheckConnection output looks ok?

I thought the TX_ADDR of one device should match an RX_ADDR ... of the other, but perhaps I've misunderstood something if @ziosam has successfully exchanged a message. @groundFungus @J-M-L

I usually give different addresses to the modules

I've a couple of tutorials but they are in French, may be google translate can help out

1 Like

I already followed some of his steps (put antennas meters away and tried the lower PA level; i use the code of Robin2, i unplugged from USB or switched off power to reset after uploading code)

When i go home i'll try to change

_SPI.setClockDivider(SPI_CLOCK_DIV2);
Into
_SPI.setClockDivider(SPI_CLOCK_DIV4);

as @groundFungus writes.

Days ago i sent successfully only one message, then nothing ...

Also i think that address must be the same but this doesn't happens..

And you are definitely still getting the same Checkconnect outputs? It sounds like a hardware problem, but I'd expect Checkconnect to pick it up (says he who has never actually succeeded in sending even one message between two NRF24L01's).

Is it possible you put 5V across the NRF24L01+ boards at some point (as opposed to the adapters)?

Google Translate to English looks good to me.

I can't get the same TX and RX address on checkconnect output, also i can't force one of the two nrf24l01+ to change data rate and pa level (every time that i run Checkconnect.ino one of the module pick a random data rate and pa level even when i select one).

I'm sure that i didn't put 5V directly to the antenna: the first time i connect both antennas to arduino 3.3v pin; because i had problems (someone say that nrf24l01+ draws much more current than the value on the datasheet) i ordered 5V adapter to connect to 5V pin of arduino that can provide more current and check if issues disappear; issues didn't disappeared and then i decided to power the module with batteries but also there are problems...

I'll try the @J-M-L's tutorials; i think at this point that the problem is not the code but one of antenna that could be defective...

Sorry for my poor english

Your English is just fine

Power stability is important

Thanks!

Using 5V adapter, feed the module with batteries and place 100uF capacitor across VCC and GND is enough?

There are other steps to follow to stabilize the power?

should be good enough (and GND shared with the Arduino right?)

To agree with @J-M-L your English is fine.

Definitely sounds like one of the boards may have a hardware problem. Any chance you could get a third NRF24L01 and 5V adapter to test with that? It doesn’t have to be a high power one.

(But note previous comment about my practical experience with these devices!).

If you applied 5V to the power input if a rf24 modile, even briefly, it is likely killed.

I applied 3.3V to rf24 directly

5V only after plugging rf24 into 5V adapter (as shown on schematic)

1 Like