nRF24 / RF24

OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
https://nrf24.github.io/RF24
GNU General Public License v2.0
2.2k stars 1.01k forks source link

NRF24 Comunication samples doesn't works #211

Closed Xenon7697 closed 8 years ago

Xenon7697 commented 8 years ago

I have plugged NRF24l01 exactly as writen. Power to 3.3V on power have 100uF and 100nF capacitor. But I have unreasonable incoming digits Sent response 4294967167 Sent response 4294967167 Sent response 4294954815 Sent response 4286578559 Sent response 1811939328 Sent response 4294471680 Sent response 4294966543 Sent response 4294967167 Sent response 2133917696 Sent response 0 Sent response 671105792 Sent response 0 Sent response 0 Sent response 4294967166 Sent response 4294967167

and can't make it work, how to solve this?

And there is Joystick example from: http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-ExampleSketches#js1

Packet Received - Sent response 0uS X= 0 Y= 0 Switch OFF Packet Received - Sent response 2020360192uS X= 16504 Y= 24624 Switch ON Packet Received - Sent response 4194303871uS X= -1 Y= -1 Switch ON Packet Received - Sent response 1749043720uS X= 16384 Y= 26688 Switch ON Packet Received - Sent response 4294967167uS X= -1 Y= -1 Switch ON Packet Received - Sent response 4294932753uS X= 29695 Y= -1 Switch ON Packet Received - Sent response 0uS X= 0 Y= 0 Switch OFF Packet Received - Sent response 2097152uS X= 0 Y= 0 Switch OFF Packet Received - Sent response 4294967119uS X= -3 Y= -1 Switch ON Packet Received - Sent response 4294967167uS X= -2 Y= -1 Switch ON Packet Received - Sent response 0uS X= 24800 Y= 112 Switch ON Packet Received - Sent response 2115584uS X= 16416 Y= 24896 Switch ON Packet Received - Sent response 0uS X= 0 Y= 0 Switch OFF Packet Received - Sent response 2137014336uS X= 32638 Y= 26876 Switch ON

What can be wrong?

wmarkow commented 6 years ago

So it works with two pro mini boards. It doesn't work with Uno vs Mega. I'm using the library with Uno and Pro Mini and Node MCU and the communication work fine between those three boards.

As @Allecsxx comented here (and he has also mentioned that other maniac library works) I can say that it may freeze on radio.begin(); on the Arduino Mega board.

Allecsxx commented 6 years ago

Yes.. it works for a little... But freeze after some time... Is not stable. But at least it is f'ing printing details which tmrh is not..... Whyyyyyyy?:(((

Allecsxx commented 6 years ago

Is not printing on. Pro mini either. Just a led that blinks ... when pressed a button from transmitter All i could make to work

Allecsxx commented 6 years ago

Can somebody give me an example of printdetails in serial monitor that proves good connections ? Also a bit elaborated?

Allecsxx commented 6 years ago

@Avamander

Don't know exactly how to determine on what libe the code get stuck. I can provide team viewer and you may see the problem clearly. I'm not that advanced.

Allecsxx commented 6 years ago

@Avamander

Managed to make printdetails to work. For some reason Read Only attribute under printf.h file makes all the problems. Untick Read Only and now is printing details on serial monitor.

Allecsxx commented 6 years ago

PRINT DETAILS FROM MEGA BOARD

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

Allecsxx commented 6 years ago

print details from UNO board

STATUS = 0x07 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=3 TX_FULL=1 RX_ADDR_P0-1 = 0x00000000f0 0x00000000f0 RX_ADDR_P2-5 = 0x01 0x1e 0x78 0xc0 TX_ADDR = 0x1e1e0f0300 RX_PW_P0-6 = 0x00 0x00 0x18 0x00 0x00 0x00 EN_AA = 0x00 EN_RXADDR = 0x00 RF_CH = 0x02 RF_SETUP = 0x1e CONFIG = 0x1e DYNPD/FEATURE = 0x00 0x00 Data Rate = 250KBPS Model = nRF24L01 CRC Length = 8 bits PA Power = PA_MIN

Allecsxx commented 6 years ago
**_CODE FOR UNO BOARD_**

/*
* Getting Started example sketch for nRF24L01+ radios
* This is a very basic example of how to send data from one node to another
* Updated: Dec 2014 by TMRh20
*/

#include <SPI.h>
#include "RF24.h"
#include <printf.h>
/****************** User Config ***************************/
/***      Set this radio as radio number 0 or 1         ***/
bool radioNumber = 1;

/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7 & 8 */
RF24 radio(7,8);
/**********************************************************/

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

// Used to control whether this node is sending or receiving
bool role = 0;

void setup() {
  Serial.begin(115200);
  Serial.println(F("RF24/examples/GettingStarted"));
  Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));

  radio.begin();
printf_begin();
  // Set the PA Level low to prevent power supply related issues since this is a
 // getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default.
  radio.setPALevel(RF24_PA_LOW);

  // Open a writing and reading pipe on each radio, with opposite addresses
  if(radioNumber){
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1,addresses[0]);
  }else{
    radio.openWritingPipe(addresses[0]);
    radio.openReadingPipe(1,addresses[1]);
  }

  // Start the radio listening for data
  radio.startListening();
  radio.printDetails();
}

void loop() {

/****************** Ping Out Role ***************************/  
if (role == 1)  {

    radio.stopListening();                                    // First, stop listening so we can talk.

    Serial.println(F("Now sending"));

    unsigned long start_time = micros();                             // Take the time, and send it.  This will block until complete
     if (!radio.write( &start_time, sizeof(unsigned long) )){
       Serial.println(F("failed"));
     }

    radio.startListening();                                    // Now, continue listening

    unsigned long started_waiting_at = micros();               // Set up a timeout period, get the current microseconds
    boolean timeout = false;                                   // Set up a variable to indicate if a response was received or not

    while ( ! radio.available() ){                             // While nothing is received
      if (micros() - started_waiting_at > 200000 ){            // If waited longer than 200ms, indicate timeout and exit while loop
          timeout = true;
          break;
      }      
    }

    if ( timeout ){                                             // Describe the results
        Serial.println(F("Failed, response timed out."));
    }else{
        unsigned long got_time;                                 // Grab the response, compare, and send to debugging spew
        radio.read( &got_time, sizeof(unsigned long) );
        unsigned long end_time = micros();

        // Spew it
        Serial.print(F("Sent "));
        Serial.print(start_time);
        Serial.print(F(", Got response "));
        Serial.print(got_time);
        Serial.print(F(", Round-trip delay "));
        Serial.print(end_time-start_time);
        Serial.println(F(" microseconds"));
    }

    // Try again 1s later
    delay(1000);
  }

/****************** Pong Back Role ***************************/

  if ( role == 0 )
  {
    unsigned long got_time;

    if( radio.available()){
                                                                    // Variable for the received timestamp
      while (radio.available()) {                                   // While there is data ready
        radio.read( &got_time, sizeof(unsigned long) );             // Get the payload
      }

      radio.stopListening();                                        // First, stop listening so we can talk   
      radio.write( &got_time, sizeof(unsigned long) );              // Send the final one back.      
      radio.startListening();                                       // Now, resume listening so we catch the next packets.     
      Serial.print(F("Sent response "));
      Serial.println(got_time);  
   }
 }

/****************** Change Roles via Serial Commands ***************************/

  if ( Serial.available() )
  {
    char c = toupper(Serial.read());
    if ( c == 'T' && role == 0 ){      
      Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK"));
      role = 1;                  // Become the primary transmitter (ping out)

   }else
    if ( c == 'R' && role == 1 ){
      Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK"));      
       role = 0;                // Become the primary receiver (pong back)
       radio.startListening();

    }
  }

} // Loop
Allecsxx commented 6 years ago
**_CODE FOR MEGA BOARD_**

/*
* Getting Started example sketch for nRF24L01+ radios
* This is a very basic example of how to send data from one node to another
* Updated: Dec 2014 by TMRh20
*/

#include <SPI.h>
#include "RF24.h"
#include <printf.h>
/****************** User Config ***************************/
/***      Set this radio as radio number 0 or 1         ***/
bool radioNumber = 0;

/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7 & 8 */
RF24 radio(7,8);
/**********************************************************/

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

// Used to control whether this node is sending or receiving
bool role = 0;

void setup() {
  Serial.begin(115200);
  Serial.println(F("RF24/examples/GettingStarted"));
  Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));

  radio.begin();
printf_begin();
  // Set the PA Level low to prevent power supply related issues since this is a
 // getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default.
  radio.setPALevel(RF24_PA_LOW);

  // Open a writing and reading pipe on each radio, with opposite addresses
  if(radioNumber){
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1,addresses[0]);
  }else{
    radio.openWritingPipe(addresses[0]);
    radio.openReadingPipe(1,addresses[1]);
  }

  // Start the radio listening for data
  radio.startListening();
  radio.printDetails();
}

void loop() {

/****************** Ping Out Role ***************************/  
if (role == 1)  {

    radio.stopListening();                                    // First, stop listening so we can talk.

    Serial.println(F("Now sending"));

    unsigned long start_time = micros();                             // Take the time, and send it.  This will block until complete
     if (!radio.write( &start_time, sizeof(unsigned long) )){
       Serial.println(F("failed"));
     }

    radio.startListening();                                    // Now, continue listening

    unsigned long started_waiting_at = micros();               // Set up a timeout period, get the current microseconds
    boolean timeout = false;                                   // Set up a variable to indicate if a response was received or not

    while ( ! radio.available() ){                             // While nothing is received
      if (micros() - started_waiting_at > 200000 ){            // If waited longer than 200ms, indicate timeout and exit while loop
          timeout = true;
          break;
      }      
    }

    if ( timeout ){                                             // Describe the results
        Serial.println(F("Failed, response timed out."));
    }else{
        unsigned long got_time;                                 // Grab the response, compare, and send to debugging spew
        radio.read( &got_time, sizeof(unsigned long) );
        unsigned long end_time = micros();

        // Spew it
        Serial.print(F("Sent "));
        Serial.print(start_time);
        Serial.print(F(", Got response "));
        Serial.print(got_time);
        Serial.print(F(", Round-trip delay "));
        Serial.print(end_time-start_time);
        Serial.println(F(" microseconds"));
    }

    // Try again 1s later
    delay(1000);
  }

/****************** Pong Back Role ***************************/

  if ( role == 0 )
  {
    unsigned long got_time;

    if( radio.available()){
                                                                    // Variable for the received timestamp
      while (radio.available()) {                                   // While there is data ready
        radio.read( &got_time, sizeof(unsigned long) );             // Get the payload
      }

      radio.stopListening();                                        // First, stop listening so we can talk   
      radio.write( &got_time, sizeof(unsigned long) );              // Send the final one back.      
      radio.startListening();                                       // Now, resume listening so we catch the next packets.     
      Serial.print(F("Sent response "));
      Serial.println(got_time);  
   }
 }

/****************** Change Roles via Serial Commands ***************************/

  if ( Serial.available() )
  {
    char c = toupper(Serial.read());
    if ( c == 'T' && role == 0 ){      
      Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK"));
      role = 1;                  // Become the primary transmitter (ping out)

   }else
    if ( c == 'R' && role == 1 ){
      Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK"));      
       role = 0;                // Become the primary receiver (pong back)
       radio.startListening();

    }
  }

} // Loop
Allecsxx commented 6 years ago

Victoryyyyy...

Sorted out.

Added radio.setAutoAck(false);

Finally after 5 days :)))

Avamander commented 6 years ago

That's called "having a clone nRF", cheaping out spent five days of your time... Also the printDetails() output indicates that the module is not detected properly, but it might be your extremely crappy clone being really picky and non-standard about everything. Basically this library is tuned to give the maximum performance when using actual nRF24L01(+), using something other than the original modules is clearly as you can see both limiting (no more auto-ack for you) and a waste of time.

Allecsxx commented 6 years ago

Sorry ... But i couldn't identify a genuine one as it was my first NRF prototype. I will follow this for the future. Add this problem to library docs so other people will not f'ing waste 5 days like me. Now that everything is sorted i can pretty much play arround with simple sketchs until i will fully understand the way this library works.

All works fine now... And going back i will definitely apologies for getting the library guilty, definitely it works but unlucky i had different behavior of my prototypes than all issues found on google. Thanks

Allecsxx commented 6 years ago

Also a good point will be some info to help people identify cheap clone nrfs...

Avamander commented 6 years ago

The https://github.com/nRF24/RF24/labels/counterfeits tag has plenty of issues about it and they contain information about the various problems one might encounter and how to recognize them. It's borderline impossible to detect actually bad clones visually unless you have those chip-under-epoxy-blob ones.

Allecsxx commented 6 years ago

Well ... If my SMonitor was at least printing details probably i was wasting less time. I don't understand why on Win8 Read Only print.f file will not be read by #include... I tried with older Arduino IDE... 1.6 and it wasn't working either. After reinstalled again last 1.8.5 still no luck... I don't know how it came in my head to untick Read Only but was a big big step forward.

LazyRen commented 6 years ago

I guess mine was also cheap-shitty clone too. Wasted 6 hours to figure out what was the problem. radio.setAutoAck(false); solved my issue too. Thanks for both of you above.

dunelo commented 6 years ago

where did you added radio.setAutoAck(false); ? Thanks :)

LazyRen commented 6 years ago

within void setup() {} right after radio.begin();

void setup() {
  Serial.begin(9600);
  while(!Serial);
  SPI.begin();
  // put your setup code here, to run once:
  radio.begin();
  radio.setAutoAck(false);
  radio.setChannel(115);
  radio.openReadingPipe(1, address);
  pinMode(output, OUTPUT);
//  radio.setRetries(3,5); // delay, count
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_250KBPS);
  radio.startListening();
  Serial.println("setup done");
}
PeterSek commented 6 years ago

Can you please post all your code And radio print output

On Wed, Jun 27, 2018, 17:18 LazyRen notifications@github.com wrote:

within void setup() {} right after radio.begin();

void setup() { Serial.begin(9600); while(!Serial); SPI.begin(); // put your setup code here, to run once: radio.begin(); radio.setAutoAck(false); radio.setChannel(115); radio.openReadingPipe(1, address); pinMode(output, OUTPUT); // radio.setRetries(3,5); // delay, count radio.setPALevel(RF24_PA_MIN); radio.setDataRate(RF24_250KBPS); radio.startListening(); Serial.println("setup done"); }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nRF24/RF24/issues/211#issuecomment-400568433, or mute the thread https://github.com/notifications/unsubscribe-auth/AC_OkZYKRRvA3mREG3wumzPjut4LPmuZks5uAzGngaJpZM4HXWqB .

LazyRen commented 6 years ago

Sorry I do not have arduino anymore. Can't help you with print output. But here is the whole code. The thing is, it still doesn't work even after solving this problem. It sends properly but RF24 does not receive data properly(always receive 0). I believe it's due to hardware problem(noise on power).

#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//#include <RF24.h>

#define MAXQUEUE 10
constexpr uint8_t RST_PIN = 9;          // Configurable, see typical pin layout above
constexpr uint8_t SS_PIN = 10;         // Configurable, see typical pin layout above
//const byte address[6] = "00001";

MFRC522 mfrc(SS_PIN, RST_PIN);  // Create MFRC522 instance
LiquidCrystal_I2C lcd(0x3F, 16, 2);
RF24 radio(7, 8);

int cards[10], queue[10], cur, head, tail, qsize, curuser;
bool found;

void setup() {
  Serial.begin(9600);   // Initialize serial communications with the PC
  while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
  SPI.begin();      // Init SPI bus
  mfrc.PCD_Init();   // Init MFRC522
  mfrc.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details
  lcd.init();
  lcd.backlight();

 radio.begin();
 radio.setAutoAck(false);
 radio.setChannel(115);
 radio.openReadingPipe(1, address);
 radio.setPALevel(RF24_PA_MIN);
 radio.setDataRate(RF24_250KBPS);
 radio.stopListening();

  cur = head = tail = qsize = 0;
  Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
  lcd.setCursor(0, 0);
  lcd.print("Machine 1");
  lcd.setCursor(0, 1);
  lcd.print("Empty line!");
}

bool isExist(int id)
{
  for (int i = 0; i < MAXQUEUE; i++) {
    if (queue[i] == id)
      return true;
  }
  return false;
}

void push(int id)
{
  if (qsize >= MAXQUEUE)
    return;
  queue[tail] = id;
  tail = (tail+1) % MAXQUEUE;
  qsize++;
}

int pop()
{
  int id = queue[head];
  while(id == -1) {
    head = (head+1) % MAXQUEUE;
    id = queue[head];
  }
  queue[head] = -1;
  head = (head+1) % MAXQUEUE;
  qsize--;
  return id;
}

int top()
{
  int cur = head;
  for (int i = 0; i < MAXQUEUE; i++) {
    cur = (head+i) % MAXQUEUE;
    if (queue[cur] != -1)
      return queue[cur];
  }
  return -1;
}

void cancel(int id)
{
  for (int i = 0; i < MAXQUEUE; i++) {
    if(queue[i] == id) {
      queue[i] = -1;
      qsize--;
      return;
    }
  }
}

int cardNumber(int id) {
  for (int i = 0; i < cur; i++)
    if (cards[i] == id)
      return i+1;
  return -1;
}
void clearLCD()
{
  lcd.setCursor(0, 0);
  lcd.print("                ");
  lcd.setCursor(0, 1);
  lcd.print("                ");
}
void loop(){
  if ( !mfrc.PICC_IsNewCardPresent() || !mfrc.PICC_ReadCardSerial() ) {
                                               // 태그 접촉이 되지 않았을때 또는 ID가 읽혀지지 않았을때
    delay(500);                                // 0.5초 딜레이
    return;                                    // return
  }

  Serial.print("Card UID:");                  // 태그의 ID출력
  int cardID = 0;
  for (byte i = 0; i < 4; i++) {               // 태그의 ID출력하는 반복문.태그의 ID사이즈(4)까지
    cardID += mfrc.uid.uidByte[i];
//    Serial.print(mfrc.uid.uidByte[i]);        // mfrc.uid.uidByte[0] ~ mfrc.uid.uidByte[3]까지 출력
//    Serial.print(" ");                        // id 사이의 간격 출력
  }
//  Serial.println();
  Serial.println(cardID);
  found = false;
  for (int i = 0; i < cur; i++) {
    if(cards[i] == cardID) {
      found = true;
      break;
    }
  }
  if(!found)
    cards[cur++] = cardID;
  int cardnum = cardNumber(cardID);
  found = isExist(cardID);
  if (found) {// User finished workout or cancel reserve
    if (cardID == top()) {// finished workout
      pop();
      int nextID = top();
      int nextnum = cardNumber(nextID);
      // TODO printout cardnum
      Serial.print(cardnum);
      Serial.println(" finished workout");
      clearLCD();
      lcd.setCursor(0, 0);
      lcd.print(cardnum);
      lcd.setCursor(3, 0);
      lcd.print("finished");
      delay(3000);
      if (nextnum != -1) {
        curuser = nextnum;
        Serial.print(nextnum);
        Serial.println(" user's turn");
        clearLCD();
        lcd.setCursor(0, 0);
        lcd.print(nextnum);
        lcd.setCursor(3, 0);
        lcd.print("user's turn");
//        if (!radio.write(&nextID, sizeof(nextID))) {
//          Serial.println("Failed to write radio");
//        }
  }
      }
      else {
        clearLCD();
        lcd.setCursor(0, 0);
        lcd.print("Machine 1");
        lcd.setCursor(0, 1);
        lcd.print("Empty line!");
      }
    }
    else {// cancel reserve
      cancel(cardID);
      Serial.print(cardnum);
      Serial.println(" user canceled reservation");
      clearLCD();
      lcd.setCursor(0, 0);
      lcd.print(cardnum);
      lcd.setCursor(3, 0);
      lcd.print("canceled");
      delay(3000);
      clearLCD();
      lcd.setCursor(0, 0);
      lcd.print(curuser);
      lcd.setCursor(3, 0);
      lcd.print("user's turn");
    }
  }
  else {// reserve machine
    push(cardID);
    Serial.print(cardnum);
    Serial.println(" reserved this machine");
    clearLCD();
    lcd.setCursor(0, 0);
    lcd.print(cardnum);
    lcd.setCursor(3, 0);
    lcd.print("reserved");
    delay(3000);
    if (qsize == 1)
      curuser = cardnum;
    clearLCD();
    lcd.setCursor(0, 0);
    lcd.print(curuser);
    lcd.setCursor(3, 0);
    lcd.print("user's turn");
//    if (!radio.write(&cardID, sizeof(cardID))) {
//      Serial.println("Failed to write radio");
//    }
  }
}
Allecsxx commented 6 years ago

Hi,

There are a couple of months since i ve moved to e32 ttl but u still remember a but,

Autoack false sorted out the problem for a day or two.

The whole problem was 3.3v. I had a shit 12v psu powering up arduino and from there a 3.3 power module to nrf. The whole issue was the shit noisy 12v psu which was so bad , more than what arduino 5v and thereafter 3.3v power module could handle with their capacitors filters Tried with capacitors on NRF module etc, didn't worked at all. So i replaced the 12v psu with a better one and cleared all problems. It worked with autoack true after.

Allecsxx commented 6 years ago

Also i tried to understand the print details, i remember Avamander gave me a link, or i google it , looked into for an hour and after that i could easily spot what was going wrong. I did had same thing... transmitter sending and printing good details but receiver not doing anything. All was about shit 3.3v. On mega there are some guys saying that pin 53 or 51 or 52(don t remember) needs to be output or something like that... but i can say that is not the problem. After having proper 3.3v i tested with initial code getting started and all worked perfect.

Allecsxx commented 6 years ago

My advice will be to change whatever Psu you have , a desk regulated psu will make your modules work

Allecsxx commented 6 years ago

I have this psu which sorted out the problem. Any psu like this will make your nrf modules work properly

https://www.amazon.co.uk/ReaseJoy-Laboratory-Regulated-Adjustable-Precision/dp/B06X9NNGQ5/ref=mp_s_a_1_1?ie=UTF8&qid=1530087531&sr=8-1-spons&pi=AC_SX236_SY340_QL65&keywords=bench+power+supply&psc=1#productDescription_secondary_view_div_1530087546770

Allecsxx commented 6 years ago

If it works with a desk psu on the prototyping stage and not working with your finished project psus than you have to look further and filter the noise.

dunelo commented 6 years ago

I also tried that! but i just used an old power adapter connected to a 3.3 volts regulator directly to the module. So i used 2 adapters for my two nrf modules and it worked so good, so consistent! BUT A FEW DAYS AFTER (maybe a week) i dont know why until now its not working!!!! OMG!!!! And now i don't know what the problem is. I'm so desperate haha. 'coz my head is so aching as hell. Also before i tried that power supply solution, (I'll just gonna share this) my project wont connect at first after 3 tries and then it will work so i thought its just the nature of the nrf to not connect at first and then after some time it won't work so i tried the power supply solution. HAHA

So right now, i'm thinking of what was the problem. Is it that the power adapter has too much noise? or my arduino needs more power like what you did.

HELP HAHAHA THANK YOUUUU

dunelo commented 6 years ago

Both my arduino (uno and Mega) are just powered by the usb cable from the computer/laptop

Allecsxx commented 6 years ago

The power adapter is definately. I had a power adapter aswell HAHA. Get a proper psu and it will work unstoppable. :))

Allecsxx commented 6 years ago

Usb from laptop will not supply enough current for arduino + nrf. Trust me , i tried with that aswell months ago and it didn't wanna work. I ve been agains all advices because i was looking into datasheets and believe the values of current draw of nrf and current supply of usb. Don t believe , lisen what i m saying... i spent days and days because of that. Get a proper psu and you will save time(days ) of fault finding.

dunelo commented 6 years ago

Grrrrrrrrr. HAHAHAH so what i need to do is to supply both my arduino and nrf (the power supply is connected to the arduino and also connected to my 3.3 regulator for my nrf)? With that proper psu..

Allecsxx commented 6 years ago

F.ck me.. i still remember the days lost (8 in the morning till 23 pm) for a couple of days trying to figure out what was the problem. I ve lost weight aswell in that time as i was so nervous that i didn't wanna have any food at all. :)) i was looking to the small nrf module and swearing it on all possible ways. I ve done very complicated projects in the past and i couldn't believe i m gonna get defeated by a small module ;:)))

Allecsxx commented 6 years ago

Power up arduinos with desk psu, connect vcc gnd from each arduino to 3.3 v nrf modules.

Allecsxx commented 6 years ago

The good thing with desk psu is that you will see the draw current by your whole project and you will be able to create a psu after that will suit your project.

dunelo commented 6 years ago

okay then, I'll try that and i'll keep you updated in this thread. Thank you very much!!!!

PeterSek commented 6 years ago

Hi All, @dunelo ? I just came across this thread, had similar problems so perhaps I can help I am running x5 nrf24l01 nodes both low power and PA versions, Although I am using RF24 + RF24Network, the Netwoek lib also uses RF24 from here https://github.com/nRF24 My Master is mega2560 with hand wired nrf24 socket; nano rf24 shield (with nrf24 socket), ITead board with 1/4 rly both with nrf24 socket, generic Uno with hand wired nrf24 socket etc All board have ~10uF caps across nrf01 module +/- pins (on module itself or socket)

If anyone is battling with this can I suggest to go back to be ginning and investigate by eliminating the cause

In my case I had mixture of not so compatible clones, one in fact far faulty, 10uF cap, low power and 0.5-1m distance between modules did the trick; cover model with book to reduce EM

If still not working Please post your code and dump from pritnDetails for both radios

BTW here is Nano shield with RF24 socket https://www.ebay.com.au/itm/New-Nano-IO-Shield-Wireless-Sensor-Xbee-NRF24L01-for-Arduino-328p-7V-12V/151748100079?hash=item2354e43fef:g:99sAAOSwUnFZp5AQ

single power in for both Nano and RF24, I did add ~10-50uF cap under the rf24 socket Make sure you plug module the correct orientation

Hope this helps

Peter

On Wed, Jun 27, 2018 at 7:36 PM, dunelo notifications@github.com wrote:

okay then, I'll try that and i'll keep you updated in this thread. Thank you very much!!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nRF24/RF24/issues/211#issuecomment-400608669, or mute the thread https://github.com/notifications/unsubscribe-auth/AC_OkfMbYsHYB7N2J4bbOZMJvoUAmqRvks5uA1IygaJpZM4HXWqB .

--

Peter Sek PPPSek@gmail.com 0418 686 325

PeterSek commented 6 years ago

Alternatively esp8266, esp32, LoRa / Dragino Gateway if distance is important LoRa ~20km, or LoPy With Esp + Mosquit operating system or LoPy + PyCom/Micro Python you can connect for example to AWS/Cloud P;

On Wed, Jun 27, 2018 at 10:30 PM, Peter Sek pppsek@gmail.com wrote:

Hi All, @dunelo ? I just came across this thread, had similar problems so perhaps I can help I am running x5 nrf24l01 nodes both low power and PA versions, Although I am using RF24 + RF24Network, the Netwoek lib also uses RF24 from here https://github.com/nRF24 My Master is mega2560 with hand wired nrf24 socket; nano rf24 shield (with nrf24 socket), ITead board with 1/4 rly both with nrf24 socket, generic Uno with hand wired nrf24 socket etc All board have ~10uF caps across nrf01 module +/- pins (on module itself or socket)

If anyone is battling with this can I suggest to go back to be ginning and investigate by eliminating the cause

  • go back to example eg pingpair_ack
  • only modify line to match your hw config RF24 radio(7,8);
  • Add these lines to lower power/speed (lowering speed is optional as it actually does not guarantee more reliability over the air, low power definitelly)
  • radio.begin();
  • radio.setRetries(15, 15); //vary (X, 15)
    • radio.setDataRate (RF24_250KBPS);*
    • radio.setPALevel(0); //I use config/variable here in my case but I am pretty sure value of 0 is low power, check docs and use enum for this; low power will consume little current*
  • ...
  • Add 10-50uF capacitor across +/- pins on nrf01 module; as close to module as possible (earlier in the post i saw someone added 1000u capacitor on cs/spi pins-I dont think this is good idea). Cap may be not required so can add it later if things dont work...
  • Add Serial.Printl("setup start/end"); and the beginning and end of Setup; of course Print must be after serial port is instantiated Serial.begin(115200); This to see if program stops anywhere on start up
  • Make sure printDetails is in place
  • ...
  • radio.startListening(); // Start listening
  • radio.printDetails(); // Dump the configuration of the rf unit for debugging (place just at the end of setup will do)
  • ...
  • Separate both modules physically as far as possible - important otherwise receiver is saturated
  • Upload same code to both boards
  • Run and inspect Print Details to see if Pipe Address are set, channel, Power and Speed (I noticed one of the ealier post Mega I think had all zeros in pipe IDs, Max Power etc indicating that module was not handshaking with controller
  • Use Serial to change Role
  • sit back
  • I think Power Supply shown on these pics should be ok for these small modules with low power set

In my case I had mixture of not so compatible clones, one in fact far faulty, 10uF cap, low power and 0.5-1m distance between modules did the trick; cover model with book to reduce EM

If still not working Please post your code and dump from pritnDetails for both radios

BTW here is Nano shield with RF24 socket https://www.ebay.com.au/itm/New-Nano-IO-Shield-Wireless- Sensor-Xbee-NRF24L01-for-Arduino-328p-7V-12V/151748100079?hash= item2354e43fef:g:99sAAOSwUnFZp5AQ single power in for both Nano and RF24, I did add ~10-50uF cap under the rf24 socket Make sure you plug module the correct orientation

Hope this helps

Peter

On Wed, Jun 27, 2018 at 7:36 PM, dunelo notifications@github.com wrote:

okay then, I'll try that and i'll keep you updated in this thread. Thank you very much!!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nRF24/RF24/issues/211#issuecomment-400608669, or mute the thread https://github.com/notifications/unsubscribe-auth/AC_OkfMbYsHYB7N2J4bbOZMJvoUAmqRvks5uA1IygaJpZM4HXWqB .

--

Peter Sek PPPSek@gmail.com 0418 686 325

--

Peter Sek PPPSek@gmail.com 0418 686 325

hazee007 commented 4 years ago

Hello guys i have been having this same problem for days now i am certain that my connections are correct cause i have connected with two different arduino uno with nrf24 as well as arduino nano and also esp32 and all are not working.. i noticed that if i touch a the MISO wire i gives so output like this Sent response 1056964608 Sent response 0 Sent response 16777216 Sent response 1061101312 Sent response 0 Sent response 0 Sent response 0 Sent response 514 Sent response 0 Sent response 1061101375 Sent response 0 Sent response 0 Sent response 17776399 Sent response 0 Sent response 33554432 Sent response 1057030671 Sent response 0 Sent response 1061109511 Sent response 16777216 Sent response 2134843199 Sent response 117653251 Sent response 0 Sent response 1065320255 Sent response 16777216 Sent response 2139094847 Sent response 251658240

and for transmitting part

Failed, response timed out. Now sending Failed, response timed out. Now sending Failed, response timed out. Now sending Failed, response timed out. Now sending Failed, response timed out. Now sending Failed, response timed out. Now sending Failed, response timed out. Now sending

this is my printDetails() output

RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS 'T' to begin transmitting to the other node

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0 RX_ADDR_P0-1  = 0x0000000000 0x0000000000 RX_ADDR_P2-5  = 0x00 0x00 0x00 0x00 TX_ADDR = 0x0000000000 RX_PW_P0-6  = 0x00 0x00 0x00 0x00 0x00 0x00 EN_AA = 0x00 EN_RXADDR  = 0x00 RF_CH = 0x00 RF_SETUP  = 0x00 CONFIG = 0x00 DYNPD/FEATURE  = 0x00 0x00 Data Rate = 1MBPS Model = nRF24L01 CRC Length = Disabled PA Power = PA_MIN Now sending 0 as payload

Got response 0, round-trip delay: 197645340 microseconds

Now sending 173 as payload

This means that the wiring is correct, ill be glad if anyone can help me with this.

Avamander commented 4 years ago

The printDetails() output means the module isn't connected. Next time open a new issue so each case can be individually handled.

hazee007 commented 4 years ago

Alright will do so now

PannagaS commented 4 years ago

Ok... Now it's quite... Thanks for help. Definitely there is a issue with the library. If at least somebody was ibterested to debug i would be keeping it... But as nobody is interested i will move on

Hey could you please share, what was the problem exactly and what was the solution that worked for you? & what library did you use? I am trying to make it work for days, no help... Please kindly help me!!!!

Avamander commented 4 years ago

A random issue is not the place for asking help with some different problem.