Help Needed with my NRF24L01+ modules

I recently got into arduino coding and want to build an rc car using nrf24l01 module.
I refered to a lot of tutorials and tried a lot of codes but the 2 arduinos' wont communicate.
i tried this code

/*`Preformatted text`
  If your serial output has these values same then Your nrf24l01 module is in working condition :
  
  EN_AA          = 0x3f
  EN_RXADDR      = 0x02
  RF_CH          = 0x4c
  RF_SETUP       = 0x03
  CONFIG         = 0x0f
  
  This code is under public domain
  
  Last updated on 21/08/28 
  https://dhirajkushwaha.com/elekkrypt
 */

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

RF24 radio(7, 8);

byte addresses[][6] = { "1Node", "2Node" };


void setup() {
  pinMode(6, OUTPUT);
  digitalWrite(6, HIGH);
  radio.begin();
  radio.setPALevel(RF24_PA_LOW);

  radio.openWritingPipe(addresses[0]);
  radio.openReadingPipe(1, addresses[1]);
  radio.startListening();

  Serial.begin(9600);
  printf_begin();

  radio.printDetails();
}

void loop() {
  //  empty
}

and i got this reciever :

RX_ADDR_P0-1 = 0x65646f4e31 0x65646f4e32

RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6

TX_ADDR = 0x65646f4e31

RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20

EN_AA = 0x3f

EN_RXADDR = 0x02

RF_CH = 0x4c

RF_SETUP = 0x03

CONFIG = 0x0f

DYNPD/FEATURE = 0x00 0x00

Data Rate = 1 MBPS

Model = nRF24L01+

CRC Length = 16 bits

PA Power = PA_LOW

ARC = 0

transmitter :

RX_ADDR_P0-1 = 0x65646f4e31 0x65646f4e32

RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6

TX_ADDR = 0x65646f4e31

RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20

EN_AA = 0x3f

EN_RXADDR = 0x02

RF_CH = 0x4c

RF_SETUP = 0x03

CONFIG = 0x0f

DYNPD/FEATURE = 0x00 0x00

Data Rate = 1 MBPS

Model = nRF24L01+

CRC Length = 16 bits

PA Power = PA_LOW

ARC = 0

BUT , when i tried this code in transmitter

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

// Instantiate RF24 class with CE and CSN values
RF24 radio(7, 8);
// Address to devices comunicate each other (same in both)
const uint64_t pipe = 0xE8E8F0F0E1LL;
// A variable to hold some info
boolean info = false;

void setup() {
  // Setup serial output
  Serial.begin(9600);
  // Start RF
  radio.begin();
  // Setup the channel to work within, number 100
  radio.setChannel(100);
  // Open wite pipe
  radio.openWritingPipe(pipe);
}

void loop() {
  // it changes every interval
  info = !info;

  if (info) {
    Serial.print("Sending positive... ");
  } else {
    Serial.print("Sending negative... ");
  }

  // Send info over RF
  bool success = radio.write(&info, sizeof(boolean));

  if (success) {
    Serial.println("sent!");
  } else {
    Serial.println("fail!");
  }

  // Wait 2 seconds and repeat
  delay(2000);
}

Then the serial moniter was:

Sending positive... sent!

Sending negative... fail!

Sending positive... fail!

Sending negative... fail!

Sending positive... fail!

Sending negative... fail!

Sending positive... fail!

Sending negative... fail!

Sending positive... fail!

Sending negative... fail!

reciver code :

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

// Instantiate RF24 class with CE and CSN values
RF24 radio(7, 8);
// Address to devices comunicate each other (same in both)
const uint64_t pipe = 0xE8E8F0F0E1LL;
// A variable to hold some info
boolean info = false;

void setup() {
  // Setup serial output
  Serial.begin(9600);
  // Start RF
  radio.begin();
  // Setup the channel to work within, number 100
  radio.setChannel(100);
  // Open recept pipe
  radio.openReadingPipe(1, pipe);
  // Start to listen
  radio.startListening();
}

void loop() {
  // Wait until some data
  if (radio.available()) {
    Serial.println('A');
    // Read payload, and check if it finished
    radio.read(&info, sizeof(info));
    // Manage info
    if (info) {
      Serial.println("We received positive!");
    } else {
      Serial.println("We received negative!");
    }
  }
  // Wait a bit
  delay(50);
}

reciever serial monitor shows nothing

So Pls help me

I am using a base module for nrf24l01 which has an inbuilt capacitor according to the first code and result the connections are proper

People will want to see schematics of the transmitter and receiver, and more details of the Arduino (Uno Nano etc.) and RF24 modules before they can help you.

There is a really usefully piece of code from @Robin2 here https://forum.arduino.cc/t/simple-nrf24l01-2-4ghz-transceiver-demo/405123/30

(answer 30) which allows you do a basic check independently on both NRF24L01s to make sure they are working.

Good luck.

... and following on from the suggestion by @sloopjohnt , when you have run the CheckConnection.ino sketch, go back up the discussion to post #2 and load the SimpleTx.ino and SimpleRx.ino sketches onto your 2 boards.

Also note that the nRF24L01+ boards require more power than the original board in the tutorial.

And, you may well find that you have to separate the 2 radios by a few feet.

I will take a SWAG and say you are powering the nrf24l0s by the Arduino. If so you are getting what I would expect. Use an external power supply.
Rule #1 A Power Supply the Arduino is NOT!
If this is not the case post an annotated schematic, not a frizzy picture. Be sure to show all of your connections including power, ground, and power supplies.

@markd833 Do you know if @Robin2 's stuff runs on the up-to-date RF24 library (1.4.1 I believe). I think he was recommending rolling back to 1.7.1 the last time I checked.

[much later edit - I meant 1.1.7 ....]

I have used Robin2's example code with the latest RF24 library version with no issues.

Here are the tips that I picked up while getting my radios to work and helping others:

If you read and, closely, follow Robin2's simple rf24 tutorial you should be able to get them working. That tutorial sure helped me. The code in the examples has been proven to work many many times. If it does not work for you, there is likely a hardware problem.

Run the CheckConnection.ino (look in reply #30 in the tutorial) to verify the physical wiring between the radio module and its processor (Arduino).

It is very important that you get the 3.3V supply to the radio modules to supply enough current. This is especially true for the high power (external antenna) modules. I use homemade adapters like these. They are powered by 5V and have a 3.3V regulator on the board. Robin2 also has suggested trying with a 2 AA cell battery pack.

If using the high powered radios make sure to separate them by a few meters. They may not work too close together. Try the lower power settings.

Reset the radios by cycling power to them after uploading new code. I have found that to help. They do not reset with the Arduino.

Switch to 1MB data rate to catch the not so cloned clones.
radio.setDataRate( RF24_1MBPS );

Also for some clones, change TMRh20's RF24.cpp line 44
_SPI.setClockDivider(SPI_CLOCK_DIV2);
Into
_SPI.setClockDivider(SPI_CLOCK_DIV4);

Have a look at the common problems page.

1 Like

Unfortunately, I've not played with nRF24s for a while now, so can't comment on the latest library. I've moved over to 433MHz RFM69 modules for all my tinkering.

@groundFungus indicates that there are no issues.

1 Like

@markd833 Thank you! To avoid going off topic I won't comment further here but its interesting you are now using RFM69.

Thanks for this @groundFungus .

Forgive my ignorance, but this data sheet NRF24L01+ indicates the maximum current needed to run the NRF24L01+ is 13.5 mA.

According to Stackexchange the max current which can be supported by the Uno Rev 3 on the 3.3 pin is 150 mA, although I have seen 50mA elsewhere.

13.5 << 50, so what's the problem?

Just trying to learn!

Yes, i know what the data sheet says. I also know, from experiences (mine and other's), that it takes more than 50mA when transmitting. I cannot explain the difference between the data sheet and empirical data. I have seen figures up to 300mA. Sometimes they will work from an Uno 3.3V with a 10uF to 100uF cap, somethimes not.. I just give them their own 3.3V with the adapter. That always seems to work. Especially with high power modules.

@groundFungus Wow ... obviously no chance of pulling 300mA on that pin without causing problems.

Thanks.

I found two problems long wires for nrf24l01 connection cause irregular data.
prob 2: i used this suggestion from a forum and added this line to my code

`

radio.setAutoAck(false);

`
and this solved 75% problems
also from my experience : i learnt that when i powered the nrf24l01 from arduino uno it worked fine
but when i used a 12 volt battery with a l298n motordriver(for converting 12v to 5 v) and then sent it to nrf24l01 , it didnt give proper results
another problem when i powered the nrf24l01 with arduino and other appliances like led and motor it overloads the arduino and it stops working
these were the experiences i gained.
thank u all for being active and to help me :slight_smile:

1 Like

Well if you want to go back to using FSK stuff, then dont forget that the LoRa modules do FSK as well.

1 Like

I think its worth testing the result of radio.begin(); with something like:

if (!radio.begin()) {
    Serial.println(F("radio absente!!"));
    while (true) ; // erreur
  }

[or your language of choice], as suggested in @J-M-L 's post from 2021. and elsewhere.

I think this begin method is not a void for a good reason: the device may not to be initialized reliably, and the libraries functioning is a bit random if it fails.

If the module is duff and does not initialise correctly, it would be understandable if the rest of the library routines do not work reliably.

1 Like

Only the older versions of the RF24 library return a bool value from the read() function. The new version read() returns void.

1 Like

Thank you for this. These Adafruit RFM96W LoRa Radio Transceiver's may be an especially good match to my application.

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