This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

problem communicating with NRF24L01+? How to choose pipeline address?

hello, im from india im using nrf24l01+ for my project to transmit and receive data between two arduinos. i tried all tutorial basic programs but i cant sucessfully send and recieve data finally i found out while creating the pipe between tx and rx we need to select a noise less channel how to select it and i need to know how to create the value for that pipe.?

  • Please try to follow the documention in the nRF24L01P product specification, for example the Appendix A.

    Usually noise shouldn't be able to completely block all package. It more likely issue with your configuration. Make sure you have set the TX address and the RX_ADDR_P0 on the PTX to match with the RX address on the PRX.

  • Thanks Hung bai we finally successful transmitted and received data . After changing address of Tx and Rx .

  • I'm glad that it works now. If the answer was correct, please mark it as accepted answer.

  • hello sir and i'm also facing another issue. My nrf24L01 is working but at certain time the TX is sending the data but the RX is not receiving it. after I'm changing the pipeline address it worked perfectly for 3 times and after that it is not working.Im adding the Tx and Rx code along with this help me to reslove it .

    Tx code
     // Transmitter Code
     // Pins Connection
     /*
       1 - GND
       2 - VCC 3.3V !!! NOT 5V
       3 - CE to Arduino pin 9
       4 - CSN to Arduino pin 10
       5 - SCK to Arduino pin 13
       6 - MOSI to Arduino pin 11
       7 - MISO to Arduino pin 12
       8 - UNUSED
    */
    
    
    
    /* import needed Libraries*/
    #include <SPI.h> // Call SPI Library 
    #include <nRF24L01.h> // Call NRE Version Library
    #include <RF24.h> // RF24 Header File
    
    
    /*-----( Declare Constants and Pin Numbers )-----*/
    #define CE_PIN   9
    #define CSN_PIN 10
    
    // NOTE: the "LL" at the end of the constant is "LongLong" type
    const uint64_t pipe = 0xB3B4B5B605; // Define the transmit pipe
    // you can Select Any 40 bit Address Instead of "E8E8F0F0E1"and put LL in the end of the Address
    
    
    /*-----( Declare objects )-----*/
    RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
    /*-----( Declare Variables )-----*/
    boolean sw;  // Intializing Variable
    boolean st;
    const int pb=2; //pin 2 ( Push button pin)
    
    void setup()   /****** SETUP: RUNS ONCE ******/
    {
      pinMode(pb,INPUT_PULLUP);// pin 2 as a Input
      radio.begin();//Intializing NRF24L01 Module
      radio.openWritingPipe(pipe);// For Transmitting Operation, Must OpenWritingPipe
      Serial.begin(115200);
      
    }//--(end setup )---
    
    
    void loop()   /****** LOOP: RUNS CONSTANTLY ******/
    {
     sw=digitalRead(pb);
      if(sw==true)
      {
        st=false;
        delay(1); // For Mechanical Switch Bouncing Effect.
        Serial.println("ON");
        radio.write( &st, sizeof(boolean) );
        
      }else
      {
         st=true;
        delay(1); // For Mechanical Switch Bouncing Effect.
        Serial.println("OFF");
        radio.write( &st, sizeof(boolean) );
      }
    
    }//loop end
    
    -------------------------------------
    Rx code
    
    // Reciever Code
    // Pins Connection for Arduino MEGA
    /*
       1 - GND
       2 - VCC 3.3V !!! NOT 5V
       3 - CE to Arduino pin 48
       4 - CSN to Arduino pin 49
       5 - SCK to Arduino pin 52
       6 - MOSI to Arduino pin 51
       7 - MISO to Arduino pin 50
       8 - UNUSED
    */
     // Pins Connection for Arduino UNO If used UNO, don't forgetChange CE & CSN Pins to any pins such as pin 9 & pin 10
     /*
       1 - GND
       2 - VCC 3.3V !!! NOT 5V
       3 - CE to Arduino pin 9
       4 - CSN to Arduino pin 10
       5 - SCK to Arduino pin 13
       6 - MOSI to Arduino pin 11
       7 - MISO to Arduino pin 12
       8 - UNUSED
    */
    
    /*-----( Import needed libraries )-----*/
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    /*-----( Declare Constants and Pin Numbers )-----*/
    #define CE_PIN   9
    #define CSN_PIN 10
    
    // NOTE: the "LL" at the end of the constant is "LongLong" type
    const uint64_t pipe = 0xB3B4B5B605; // Write Same Address of Transmitter
    
    
    /*-----( Declare objects )-----*/
    RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
    /*-----( Declare Variables )-----*/
    int rec=0;  // Received Value placed in it.
    const int led=7; // LED pin
    
    void setup()   /****** SETUP: RUNS ONCE ******/
    {
      pinMode(led,OUTPUT);
      radio.begin();
      radio.openReadingPipe(1,pipe);// Open Reading Pipe to Receiving data
      radio.startListening(); // Start listening on the pipes opened for reading.
      Serial.begin(115200);
      Serial.println("Start");
    }//--(end setup )---
    
    
    void loop()   /****** LOOP: RUNS CONSTANTLY ******/
    {
      if ( radio.available() )//If Available Receiving data 
      {
        // Read the data payload until we've received everything
        bool done = false;
        while (!done)
        {
          // Fetch the data payload
          done = radio.read( &rec, sizeof(unsigned int) );
          if(rec==LOW)
            {
              digitalWrite(led,HIGH);
              Serial.println("ON");
              //delay(50);
            }else
            {
              digitalWrite(led,LOW);
              Serial.println("OFF");
            }
        }
      }
      
    }//--(end main loop )---
    
  • I'm not very familiar with the Arduino code. Could you try to send random data instead of true and false ? Device stops working after 3 times doesn't make much sense. if you change the address would it work again for 3 times ?

Related