Berchy
Berchy

Reputation: 41

nrf24l01 Transmission problems

I've been reading a lot of questions and answers regarding nrf24l01 and Arduinos while I was trying to figure out my problem. I'm fairly sure no one had this issue yet but I might be wrong. Here is my problem:

If I upload the sending code to the UNO and the receiving code to the NANO I keep getting errors. And nothing gets transmitted. However, if I do the opposite and I upload the sending code to the NANO and the receiving code to the UNO, everything is fine... I've been scratching my head for a couple days without any idea and I would like to get input from other people because I ran out of ideas...

I tried different nrf24l01 modules (I got about 20) to see if one was fried. Still the same thing. Tried changing to different pins... still the same thing. Changed the code to get it simpler and simpler to narrow down.. still the same thing. Maybe it requires more power to scan than send a package and the 3.3v from the Nano is not enough? I highly doubt..

I'm really curious if you guys can figure this one out. I think I provided a lot of info. If you need more feel free to ask.

Here is my set-up:

Arduino Nano:

Wiring

And here is the log from the printDetails() function:

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0

RX_ADDR_P0-1 = 0xb01dfacece 0xb01dfacece

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

TX_ADDR = 0xb01dfacece

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

EN_AA = 0x3f

EN_RXADDR = 0x02

RF_CH = 0x73

RF_SETUP = 0x07

CONFIG = 0x0e

DYNPD/FEATURE = 0x00 0x00

Data Rate = 1MBPS

Model = nRF24L01+

CRC Length = 16 bits

PA Power = PA_MAX

Arduino Uno:

Wiring

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0

RX_ADDR_P0-1 = 0xb01dfacece 0xb01dfacece

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

TX_ADDR = 0xb01dfacece

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

EN_AA = 0x3f

EN_RXADDR = 0x02

RF_CH = 0x73

RF_SETUP = 0x07

CONFIG = 0x0e

DYNPD/FEATURE = 0x00 0x00

Data Rate = 1MBPS

Model = nRF24L01+

CRC Length = 16 bits

PA Power = PA_MAX

Here is the Receiver code:

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

RF24 myRadio (7,8);
const uint64_t pipe = 0xB01DFACECEL;
struct package
{
  int id=0;
  int code = 0;
  char text[100] = "";
};

typedef struct package Package;
Package data;

void setup() {
 Serial.begin(115200);
 printf_begin();
 delay(1000);

 myRadio.begin();
 myRadio.setChannel(115);
 myRadio.openReadingPipe(1,pipe);
 myRadio.printDetails();
 myRadio.startListening();

 Serial.println("Set-Up Done");
 delay(1000);
}

void loop() {
  if(myRadio.available())
 {
  while(myRadio.available())
   {
     myRadio.read(&data, sizeof(data));
     Serial.print("\nPackage");
     Serial.println(data.id);
     Serial.println(data.code);
     Serial.println(data.text);
   }
 }
 delay(500);
}    

Here is the Sending code:

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

RF24 myRadio (7,8);
const uint64_t pipe = 0xB01DFACECEL;

struct package
{
  int id=1;
  int code = 2;
  char text[100] = "text";
};

typedef struct package Package;
Package data;

void setup() {
 Serial.begin(9600);
 printf_begin();
 delay(1000);

 myRadio.begin();
 myRadio.setChannel(115);
 myRadio.openWritingPipe(pipe);
 myRadio.setRetries(15,15);
 myRadio.printDetails();
 myRadio.stopListening();

 Serial.println("Set-Up Done");
 delay(1000);
}

void loop() {
   if(!myRadio.write(&data, sizeof(data)))
   {
    Serial.println("error!!");
    myRadio.printDetails();
   }
   Serial.print("\nPackage");
   Serial.println(data.id);
   Serial.println(data.code);
   Serial.println(data.text);
   data.id += 1;
   data.code += 1;
   delay(3000);
}

Upvotes: 1

Views: 12566

Answers (2)

Rhys Clarke
Rhys Clarke

Reputation: 87

Try putting a 10uf capacitor across the +3.3v and gnd of each of the nRF24L01 module.

If that dosen't work, run the nrf24l01 off its own supply, 3.3v but have seen these peak at 1A! sending bursts. and the poor Nano's 3.3V comes from the FT232 chip, only 50mA is available.

Upvotes: 0

DrPepper50
DrPepper50

Reputation: 36

Try putting a 10uf capacitor across the +3.3v and gnd of each of the nRF24L01 module.

These modules need a lot of sending power which the capacitor helps with. I hope it works for you.

Upvotes: 2

Related Questions