NRFL01+ problems

Hello!

I am trying to send data from one arduino uno to another using the NRFL01+PA+LNA chip. I basically copy and pasted the code from this guide. I am using this RF24 library.

I made some modifications to the code from the guide (mostly adding things that allowed me to trouble shoot)

Transmitter code

#include <SPI.h>

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

RF24 radio(7, 8); // CE, CSN

const byte address[6] = "00001"; // the address the the module

const int buttonPin = 3;   //Button stuff
int buttonState = 0;

void setup() {

radio.begin();    // Radio stuff

radio.openWritingPipe(address);

radio.setPALevel(RF24_PA_MAX);

radio.stopListening();



Serial.begin(9600); 
pinMode (buttonPin, INPUT);    // button setup



}




void loop() {
buttonState = digitalRead(buttonPin);


if (buttonState == HIGH) {     //try to send if the button is pressed


const char text[] = "Hello World"; 

radio.write(&text, sizeof(text));




Serial.println ("done");  // testing in case of button problems


}
}

Receiver code

#include <SPI.h>

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

RF24 radio(7, 8); // CE, CSN

const byte address[6] = "00001"; // the address the the module



void setup() {

Serial.begin(9600);

radio.begin();               //Radio setup

radio.openReadingPipe(0, address);

radio.setPALevel(RF24_PA_MAX);

radio.startListening();

}



void loop() {

if (radio.available()) { // if nrf has any incoming data

Serial.println ("available"); // a test to see if the radio is available
char text[32] = "";

radio.read(&text, sizeof(text));

Serial.println(text);

delay(5);
}

}

So far I have not been able to get the radio to be available.
Is there a code thing that is not allowing the radios to connect? Could it be my environment (ex too much wifi signals)? Could it be like how I have the antennas orientated? Is there another thing that I am not thinking of?

Thanks!

it is a good idea after radio.begin() to check if it is connected, e.g.

 radio.begin();
  if (radio.isChipConnected())
    Serial.println("Receiver NF24 connected to SPI");
  else {
    Serial.println("NF24 is NOT connected to SPI");
    while (1)
      ;
  }

how have you connected the nRF24L01 to the UNO?

Probably not the issue, but if you are bench testing, set the power level to the minimum in both your setPALevel function calls.

The majority of problems with these modules that I have seen in the forum come down to a lack of sufficient current to power them

Exactly how are the radio modules powered in your project ?

if the devices are a few inch apart during your test don't set the PA level to max.

this is what the author states in the example

also in order to check if your wiring / power are adequate, you should test with one of the example of the library
RF24/examples/GettingStarted at master · nRF24/RF24 · GitHub

I suggest you solder a 4
uf electrolytic capacitor between vcc and gnd in both nrf24l01

Start with the basics:

  1. Does radio.begin() return true?

If not see RF24/COMMON_ISSUES.md at master · nRF24/RF24 · GitHub - it should tell you pretty much where the problem is.

It is most likely a wiring issue at this point.

Power supply def needs to be adequate.

And

move them a few meters away each from the other. I'd still advise using very low power.

a7

This is how I have the nRF24L01 connected

  • CE - 7
  • CSN - 8
  • MOSI - 11
  • MISO - 12
  • SCK - 13

The power comes from the 3.3v and gnd on the Uno.

That's not good enough - you need to be able to push at least 115 mA quickly.

You need a better and stable power source. Adding a cap next to the power pin can help too.

I added that code to my code and got a power supply that was giving the chip .23 amps. When I tested it the code showed that the chip was not connected to the arduino.

Did you join grounds? Give us details about the exact circuit and power supplies.

I am powering the arduino off of a computer usb port and the nrfl01 off of a separate power supply. I have not joined grounds. How would I do that?

I tested with another arduino and nrfl01 that I set up and isChipConnected is returning true. So I am going to triple check the wiring.

Not joining the grounds of the Arduino and the NRF module creates a floating reference between the devices, leading to voltage mismatch.

Without a common ground, the logic signals may not be interpreted correctly, causing communication failure.

This can also result in voltage spikes or current flowing through unintended paths, risking damage to sensitive components.

➜ To fix this, connect the ground of the Arduino to the ground of the NRF module to ensure both devices share a common reference, preventing signal issues and potential damage.

There was a broken chip. I switched it and the chips are connecting to the arduino but not sending data. I am working on setting up the chips

I am still not understanding the idea of joining grounds. Is one of these drawings close?

Both join the GND but don’t expect to be able to power the radio from the 3.3v pin of your arduino as depicted in the second drawing.

Read