Problem with communication via two nRF24L01 + Extra Antenna

Hi!

I have been using the nRF24L01+ for a while now. I have made several posts and got very good advice on how to get them to work. But this module is driving me crazy :slight_smile: (fun project, but my brain never stops thinking, not crazy "crazy"). Everytime I connect the module its never working, I work on it for some days and get it to work, I note what I did to make it work everytime. But this time my notes are not enough. I cannot get them to work.. again. I made a test program that will work everytime I mount everything right so the program should not be a problem, I have scimatics on how to make it work. But it dont. I have the printDetails() here:

Transmitter:

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	= 0xb00b1e5000 0xc2c2c2c2c2
RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
TX_ADDR		= 0xb00b1e5000
RX_PW_P0-6	= 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA		= 0x3f
EN_RXADDR	= 0x03
RF_CH		= 0x4c
RF_SETUP	= 0x01
CONFIG		= 0x0e
DYNPD/FEATURE	= 0x00 0x00
Data Rate	= 1 MBPS
Model		= nRF24L01+
CRC Length	= 16 bits
PA Power	= PA_MIN
ARC		= 15

Reciver:

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 0xb00b1e5000
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	= 0x21
CONFIG		= 0x0e
DYNPD/FEATURE	= 0x00 0x00
Data Rate	= 250 KBPS
Model		= nRF24L01+
CRC Length	= 16 bits
PA Power	= PA_MIN
ARC		= 0

The code I am using is the following:
Reciver:

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

#define CE_PIN   9
#define CSN_PIN 10


// Create Radio and define pins
RF24 radio(CE_PIN, CSN_PIN);

// Create Radio channels
const uint64_t pAddress = 0xB00B1E5000LL;

//Radio recived array
int recivedDataArray[4];

void setup() {
  Serial.begin(115200);
  printf_begin();

  radio.begin();
  radio.openReadingPipe(1, pAddress);
  radio.setDataRate( RF24_250KBPS );
  radio.setPALevel(RF24_PA_MIN);
  radio.setChannel(0x34);
  radio.enableDynamicPayloads();
  radio.enableAckPayload();
  radio.setRetries(0, 15);
  radio.setAutoAck(true);

  radio.printDetails();

  radio.powerUp();
  radio.startListening();
}

void loop() {

  if (radio.available()) {
    radio.read( &recivedDataArray, sizeof(recivedDataArray) );
    Serial.println("Recieved array:");
    for (byte i = 0; i < 4; i++) {
      Serial.println(recivedDataArray[i]);
    }
    Serial.println();
  }
}

Transmitter:

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

#define CE_PIN   9
#define CSN_PIN 10


// Create Radio and define pins
RF24 radio(CE_PIN, CSN_PIN);

// Create Radio channels
const uint64_t pAddress = 0xB00B1E5000LL;

//Radio recived array
int dataArray[4];


bool newData = false;
String string;

void setup() {
  Serial.begin(115200);
  printf_begin();

  radio.begin();
  radio.openWritingPipe(pAddress);
  radio.setDataRate( RF24_250KBPS );
  radio.setPALevel(RF24_PA_MAX);
  radio.setChannel(0x34);
  radio.enableDynamicPayloads();
  radio.enableAckPayload();
  radio.setRetries(0, 15);
  radio.setAutoAck(true);

  radio.printDetails();

  radio.powerUp();
  radio.stopListening();

  dataArray[0] = 1000;
  dataArray[1] = 0;
  dataArray[2] = 0;
  dataArray[3] = 0;
}

void loop() {
  // check if data is available
  if (Serial.available() > 0) {
    // read the incoming string:
    String incomingString = Serial.readString();

    // prints the received data
    Serial.print("I received: ");
    Serial.println(incomingString);

    dataArray[0] = incomingString.toInt();

    Serial.println(dataArray[0]);


  }

  if (!radio.write( &dataArray, sizeof(dataArray))) {
    Serial.println("Transmittion failed");
  }
  else {
    Serial.println("Transmittion successful");
  }
}

I am suspecting the ARC value need to be the same. But I dont know.. If anyone could find something or have some tips it would be very appriciated! Thanks beforehand!

Best regards Max

1 MBPS in the transmitter and 250 KBPS in the receiver?

You need a good supply for these modules and often a minimum distance.

1 Like

Oops, missed that. I have been trying to get my two arduinos (pro mini and nano) to send data to each other and I swapped their code and it seems like the pro mini only works as a transmitter. It works flawless if the pro mini is a transmitter, unfortunatley I want the mini on my quadcopter so I need it to be a reciver. Any clue?

There is basically no difference between a receiver and a transmitter,
both receive and transmit if you use acknowledgments,
you can even have bi-directional data transfer in a single transaction.

Receiving needs a bit more energy, make sure you have a solid 3.3 V supply (best for both).

@Whandall They both are powered by the USB to the arduino, then a 3.3v regulator (https://www.amazon.se/gp/product/B07MY2NMQ6/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1) witch contains a couple capasitors. On the Nano I have a 47mF 16v capasitor after the 3.3v regulator. And it is super weird that it works one way but not the other.. What does ARC = 15 and ARC = 0 mean?

7.4.2 Auto Retransmission (ART)
The auto retransmission is a function that retransmits a packet if an ACK packet is not received. It is used
in an auto acknowledgement system on the PTX. When a packet is not acknowledged, you can set the
> number of times it is allowed to retransmit by setting the ARC bits in the SETUP_RETR register.

1 Like

I looked it up, but it doesnt seem to matter too much just to send and recive data. I will have a look at a module thats build for the nrf24 with ready capasitors. Because if I have this much trouble for the PA_MIN I suspect even more with PA_MAX witch is the goal. Thanks for the help! I will let keep you updated if it works!!

Hi @lordmax2

If you go for max power, you will need an external 3V3.
That is the safest and most reliable way to use an NRF24.

I think you would realise that the NRF24 needs a decent regulated power supply.
The UNO and especially the Nano cannot provide that.

Have you got a DMM?

Tom.... :smiley: :+1: :coffee: :australia:

1 Like

@TomGeorge Yeah, I have noticed that :smiley:. But I see so many tutorials and showcases on youtube that doesnt have a external 3V3 power source. My project is a drone that I actually made flying the other day, but I dismantled the drone to make sure I have everything working properly, So before I mounted everything on a drill hole PCB I tested everything, and after, it worked a few times but it behaved weirdly. When it was working for a little while it only recived a few data signals, I mean, it found data once every five seconds or so. But now I cannot get it to work at all (only the nano works as a reciver and the mini only works as a transmitter). My quadcopter motors are running on a 14.4V LiPo battery, so I am thinking that I can make use of that for some more power. I have updated the code in my main post. Also my ACK doesnt work for some reason but maybe that has to do with the same problem...

Hi,
Component layout around the NRF module may be having an effect, can you post a picture of your project so we can see your layout.

Most of the online tutorials and showcases, are just that, and not for longer operating project periods in most cases.
Just show and tell.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:


It is not beautiful :smile:. But here it is! This is the part that should be a receiver but only works as a transmitter.

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