Nrf24l01 not working

I am beginner in arduino programming. I am working with nrf24l01 but the problem i am facing is that it is not working at all with uno and nano.
I have tried many examples available online but still the transmission between the two arduino is not happening. I have even soldered a 10uf capacitor to the modules and tried using different power source for nrf24l01.(tried these-base module,3.3v power source and a 5v 1A power source connected to base module). I am still not getting desired results please help.
Here is the code i am currently using for recieving

#include <SPI.h> 
#include <RF24.h
 #define CE 7
#define CSN 8
 const uint64_t ad= 0xE8E8F0F0E1LL; 
 RF24 radio(CE, CSN);
 void setup() 
{
 pinMode(8, OUTPUT); 
PinMode(7, OUTPUT);
 Serial.begin(115200); 
radio.begin(); 
radio.setChannel(108); 
radio.setDataRate( RF24_250KBPS );
 radio.setPALevel(RF24_PA_MIN);
 radio.openReadingPipe(1, ad); 
radio.startListening();
 } 
 void loop() 
{
  if(radio.available())
 {
 Unsigned long a=0; 
radio.read(&a,sizeof(a)); 
 Serial.println(a); 
delay(500);
}

And this code for transmitter

#include <SPI.h> 
#include <RF24.h>
 #define CE 7
#define CSN 8
 const uint64_t ad= 0xE8E8F0F0E1LL; 
 RF24 radio(CE, CSN);
 void setup() 
{
 pinMode(8, OUTPUT); 
PinMode(7, OUTPUT);
 Serial.begin(115200); 
radio.begin(); 
radio.setChannel(108); 
radio.setDataRate( RF24_250KBPS );
 radio.setPALevel(RF24_PA_MIN);
 radio.openReadingPipe(ad); 
 } 
 void loop() 
{
 int a=100; 
radio.write(&a,sizeof(a));
delay(500);
}

Please help me with if there is something wrong with my code and if i need to add more to it.

Does any of the modules get hot.
They are quite sensitive, without a reason my transmitter one stopped working,it had an internal short. If you check continuity between VCC and GND with a multimeter should not bleep.
They're meant to work with 3.3v

No they do not get hot.
I am currently using a base module to power those nrf24l01.
I am powering a 5v 500mA-1000mA to power the base modules.
But still they are not working.
I have 6-7 nrf modules but non seems to be working.

Have a look at this Simple nRF24L01+ Tutorial

...R

huron129:
I am beginner in arduino programming. I am working with nrf24l01 but the problem i am facing is that it is not working at all with uno and nano.
I have tried many examples available online but still the transmission between the two arduino is not happening. I have even soldered a 10uf capacitor to the modules and tried using different power source for nrf24l01.(tried these-base module,3.3v power source and a 5v 1A power source connected to base module). I am still not getting desired results please help.
Here is the code i am currently using for recieving

#include <SPI.h> 

#include <RF24.h
#define CE 7
#define CSN 8
const uint64_t ad= 0xE8E8F0F0E1LL;
RF24 radio(CE, CSN);
void setup()
{
pinMode(8, OUTPUT);
PinMode(7, OUTPUT);
Serial.begin(115200);
radio.begin();
radio.setChannel(108);
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_MIN);
radio.openReadingPipe(1, ad);
radio.startListening();
}
void loop()
{
 if(radio.available())
{
Unsigned long a=0;
radio.read(&a,sizeof(a));
Serial.println(a);
delay(500);
}




And this code for transmitter


#include <SPI.h>
#include <RF24.h>
#define CE 7
#define CSN 8
const uint64_t ad= 0xE8E8F0F0E1LL;
RF24 radio(CE, CSN);
void setup()
{
pinMode(8, OUTPUT);
PinMode(7, OUTPUT);
Serial.begin(115200);
radio.begin();
radio.setChannel(108);
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_MIN);
radio.openReadingPipe(ad);
}
void loop()
{
int a=100;
radio.write(&a,sizeof(a));
delay(500);
}





Please help me with if there is something wrong with my code and if i need to add more to it.

hi huron, check on this. super simple codes and library to communicate two arduino using nrf24l01.
you can find download link for the library on the comment.

modify this code :slight_smile:
here simple codes for tx:

#include <SPI.h>
#include <nRF24L01p.h>

nRF24L01p transmitter(7,8);//CSN,CE

void setup(){
  delay(150);
  Serial.begin(115200);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  transmitter.channel(90);
  transmitter.TXaddress("Artur");
  transmitter.init();
}

String message;

void loop(){
  if(Serial.available()>0){
    char character=Serial.read();
    if(character=='\n'){
      transmitter.txPL(message);
      transmitter.send(SLOW);
      message="";
    }else{
      message+=character;
    }
  }
}

here for rx:

#include <SPI.h>
#include <nRF24L01p.h>

nRF24L01p receiver(7,8);//CSN,CE

void setup(){
  delay(150);
  Serial.begin(115200);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  receiver.channel(90);
  receiver.RXaddress("Artur");
  receiver.init();
}

String message;

void loop(){ 
  if(receiver.available()){
    receiver.read();
    receiver.rxPL(message);
    Serial.println(message);
    message="";
  }
}

@zakizakaria: Without posting your really strange library, the posted "solution" is misleading and will not compile.

Here is some super stripped-down code that will let you test that your NRF is (1) functional, and (2) hooked up correctly. It doesn't send any data packets or anything, and is just diagnostic to see if your radio and arduino can communicate. A lot of times, half the battle is just getting the wired connections correct and reliable.

Be sure you're using the libraries specified in the code, and set your CE/CSN pins to what you're using in your setup. Run this, and post the serial output.

#include <SPI.h> 
#include <nRF24L01.h>   //nRF2401 libarary found at https://github.com/tmrh20/RF24/
#include <RF24.h>          //nRF2401 libarary found at https://github.com/tmrh20/RF24/
#include "printf.h" 

const int pinCE = A0; 
const int pinCSN = 10;

RF24 wirelessSPI(pinCE, pinCSN);
 
const uint64_t pAddress = 0xB00B1E5000LL;            



void setup()  
{
  Serial.begin(9600);   
  printf_begin();       
  wirelessSPI.begin();          
  wirelessSPI.setAutoAck(1);          
  wirelessSPI.enableAckPayload();             
  wirelessSPI.setRetries(5,15);                 
  wirelessSPI.openWritingPipe(pAddress);        
  wirelessSPI.stopListening();
  wirelessSPI.printDetails();                  

}


void loop()  
{  
  
 
}

This is what I was looking for. Something to diagnose the module to confirm it's actually functional. When I run this I get the following output... I've

  • confirmed the connections
  • tried multiple nRF24 modules - brand new
  • I get the same output with no modules attached
  • tried 2 different Nano's - "ATmega328P (old Bootloader)"
  • Tried on-board and external 3.3v.
  • If I remove the board entirely I get the same output in the Serial Monitor

STATUS = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1 = 0xffffffff7f 0xffffffffff
RX_ADDR_P2-5 = 0xff 0xff 0x7f 0xff
TX_ADDR = 0xffffffffff
RX_PW_P0-6 = 0xff 0xff 0xff 0x7f 0xff 0xff
EN_AA = 0xff
EN_RXADDR = 0x7f
RF_CH = 0xff
RF_SETUP = 0x7f
CONFIG = 0xff
DYNPD/FEATURE = 0xff 0xff
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = 16 bits
PA Power = PA_MAX

Does anyone have any advice on how to proceed? :o

//Diagnostic Code

#include <SPI.h>
#include <nRF24L01.h> //nRF2401 libarary found at GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
#include <RF24.h> //nRF2401 libarary found at GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
#include "printf.h"

const int pinCE = A0;
const int pinCSN = 10;

RF24 wirelessSPI(pinCE, pinCSN);

const uint64_t pAddress = 0xB00B1E5000LL;

void setup()
{
Serial.begin(9600);
printf_begin();
wirelessSPI.begin();
wirelessSPI.setAutoAck(1);
wirelessSPI.enableAckPayload();
wirelessSPI.setRetries(5,15);
wirelessSPI.openWritingPipe(pAddress);
wirelessSPI.stopListening();
wirelessSPI.printDetails();

}

void loop()
{

}

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

...R

Does anyone have any advice on how to proceed?

The diagnostic output points to bad connection/bad module.
Most of the times it's bad wiring or flaky connections.