Can't get NRF24L01+PA+LNA with Arduino UNO to work

Hi,

I have been messing with a couple of nrf24l01 devices together with Arduino UNO. I am using this setup example here: https://forum.arduino.cc/index.php?topic=421081

We have a 100 uF capacitor on both devices as well.

I am having a lot of issues that I can’t solve. Been browsing the internet a few days now and it is driving me crazy.

This is the code i have for the 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'};
//const uint64_t thisSlaveAddress = 0xE8E8F0F0E1LL;

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.setPALevel(RF24_PA_MIN);
    radio.enableDynamicPayloads();
    //radio.setChannel(119);
    //radio.setAutoAck(false);
    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 for 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'};
//const uint64_t slaveAddress = 0xE8E8F0F0E1LL;

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.setPALevel(RF24_PA_MIN);
    radio.setDataRate( RF24_250KBPS );
    radio.enableDynamicPayloads();
    //radio.setChannel(119);
    //radio.setAutoAck(false);
    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("Ack correct:" + radio.isAckPayloadAvailable());
        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;
}

When I run the verification test i get this:

Device 1:

Device 2:

And what I can tell there they look ok, it’s not mostly 0x00 or 0xFF.

When I run the Rx script it spams “Data received” but it does not print any content at all.

When I run the Tx script it stops when it tries to write but sometimes it manage to send and says that it got an act but when I try radio.isAckPayloadAvailable() it does not return anything at all.

I have checked that the everything is connected as the tutorial example many times and I have no clue where to go from here…

This is what I get when I run it:

Im currently trying to figure out if the SPI is working as it should, it there something that you need to change, like clock rate or something?

Please don’t post pictures of text - they are almost impossible to read - even after I enlarge them. Just copy and paste the text.

Apart from that thank you for a nice clear description of what you are trying.

I think your connection tests are showing 1MBPS in the “after” version when it should be 250kbps - which means the tests are NOT successful.

If you are using the high power nRF24 (with the external antenna) then it definitely needs a separate power supply. The Arduino 3.3v pin can’t provide enough current. That can also be a problem even with the low power nRF24s. Try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If the power supply is not the problem then almost certainly there is a wiring error - at least that has always been the problem when mine don’t work. I guess it’s possible that the nRF24 is faulty, but you would be very unlucky to have 2 faulty devices.

…R

After you address any power supply issues, a common cause of many NRF24L01 project failures, keep in mind in is far easier to develop using the regular low power modules, debug everything and then implement the distance with the high power devices as they are the same exact chipset.

Using two high power units might result in overloaded amplifiers and possible signal loss when using two PA units next to one another on the bench.

Robin2:
I think your connection tests are showing 1MBPS in the "after" version when it should be 250kbps - which means the tests are NOT successful.

Yes you are right I seems that I can not change the data rate at all. Ive heard that non plus units does not support 250kbps or something like that but I think I got a plus unit right. Anyway I can not change to 2MBPS either, it will always return 1MBPS..

Thank you so much for taking time to answer I will try to power them differently.

If you bought your nRF24s recently they are almost certainly the + variety.

First thing you MUST get working is the connection test program - with NO CHANGES from my example code.

One thing to watch out for - the nRF24 does not reset when the Arduino resets. The only way to reset the nRF24 is to turn the power off and on again. It's a good idea to do that after uploading a program.

...R