NRF24L01 not responding

Hi there!

I would like to build a mailbox notification system using two nrf24l01.
I started my first tests with just example sketches to get a basic communication between the two devices.

Here they are:

---- Sender (Arduino Pro Mini) ----

#include <SPI.h>
#include "src/RF24/RF24.h"

RF24 radio(5,6);

uint8_t payload = 0;

uint8_t deviceID[][6] = {"1Node"};
uint8_t pipe = 1;

void setup() 
{
  Serial.begin(115000);
  Serial.println("START");
  while(!radio.begin()) 
  {
    Serial.println("Radio not responding...");
  } 
  Serial.println("Radio init!");
  //radio.setChannel(100);
  radio.setPALevel(RF24_PA_LOW); //RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX
  radio.setDataRate(RF24_250KBPS); //RF24_2MBPS, RF24_1MBPS, RF24_250KBPS
  //radio.setPayloadSize(sizeof(payload));
  //radio.setRetries(0,15);
  radio.openWritingPipe(deviceID[0]);
  radio.stopListening();
}

void loop() 
{
  unsigned long start_timer = micros(); 
  bool report = radio.write(&payload, sizeof(uint8_t));  // transmit & save the report
  unsigned long end_timer = micros(); 
  if (report) 
  {
    Serial.print(F("Transmission successful! "));  // payload was delivered
    Serial.print(F("Time to transmit = "));
    Serial.print(end_timer - start_timer);  // print the timer result
    Serial.print(F(" us. Sent: "));
    Serial.println(payload);  // print payload sent
    payload += 1;          // increment float payload
  } else {
    Serial.println(F("Transmission failed or timed out"));  // payload was not delivered
  }
  Serial.println(payload);
  delay(2000);
}

----- Reciever (NodeMCU) -------


#include <SPI.h>
#include "src/RF24/printf.h"
#include "src/RF24/RF24.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 oled(128, 32, &Wire, -1);
RF24 radio(D3,D4);

uint8_t payload = 0;

uint8_t deviceID[][6] = {"1Node"};
uint8_t pipe = 1;

void setup() 
{
  Serial.begin(115200);
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextSize(1);
  oled.setTextColor(WHITE);
  oled.clearDisplay();
  oled.setCursor(0,15);
  oled.println(F("WAITING FOR RADIO..."));
  oled.display();
  delay(1000);
  Serial.println("START");
  
  while(!radio.begin()) 
  {
    oled.clearDisplay();
    oled.setCursor(0,15);
    oled.println("RADIO NOT RESPONDING");
    oled.display();
    delay(1000);
  } 

  radio.setPALevel(RF24_PA_LOW); //RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX
  radio.setDataRate(RF24_250KBPS); //RF24_2MBPS, RF24_1MBPS, RF24_250KBPS
  radio.openReadingPipe(pipe, deviceID[0]);
  radio.startListening();

  oled.clearDisplay();
  oled.setCursor(10,10);
  oled.println(F("RADIO INIT!"));
  oled.display();
  delay(1000);
}

void loop() 
{
  oled.clearDisplay();
  oled.setCursor(40,10);
  oled.println(F("WAITING..."));
  char buf[5];
  itoa(payload, buf, 10);
  oled.setCursor(10,20);
  oled.println(buf);
  oled.display();

  uint8_t recievedPipe;
  if (radio.available(&recievedPipe)) // is there a payload? get the pipe number that recieved it
  {              
    uint8_t bytes = radio.getPayloadSize();  // get the size of the payload
    radio.read(&payload, bytes);  
    // fetch payload from FIFO
    Serial.print(F("Received "));
    Serial.print(bytes);  // print the size of the payload
    Serial.print(F(" bytes on pipe "));
    Serial.print(pipe);  // print the pipe number
    Serial.print(F(": "));
    Serial.println(payload);  // print the payload's value
  }
  delay(200);
}

On the reciever side I always get: "Transmission failed or timed out". So nothing is recieved. The radios are a few centimeters apart from each other.
I use a 220uF cap on the sender and reciever side for the power supply to balance the current spikes. It does not work with or without.

What am Im doing wrong? :slight_smile:

Thanks in advance! :slight_smile:

Move them about 1meter or more apart.

Tom.. :smiley: :+1: :coffee: :australia:

This will overwrite 31 bytes of your memory, a very bad idea.

But that will only trash your program after a successful reception,
which does not happen.

Oh okay!
How should I handle this then? sizeof(uint8_t)? Since I know the payload size already?

I tried it but no luck... :frowning: Still not responding... :frowning:
Im using these modules with antenna:

I think the best way to handle unknown packets, is to use a buffer of 32 bytes,
which is the biggest possible packet size.

The radio.getPayloadSize(); is more useful in a dynamicPayload configuration,
it will return the fixed packet size in your configuration, which happens to be 32 by default.
I think the dynamicPayload feature is useful, it's faster and takes less bandwidth,
but it should be used on all nodes.

Make sure that the receiving side is connected correctly,
honestly, I do not understand the naming conventions of the NodeMCU SPI pins.
A radio.printDetails(); at the end of setup could give mode information.

Remember to pack structures on the ESP side, and remember the different variable sizes
on the different platforms, when you start exchanging real information in a struct.

1 Like

Please provide a schematic of both nodes.

Reciever (NodeMCU):

12:02:04.646 -> SPI Speedz	= 10 Mhz
12:02:04.646 -> STATUS		= 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
12:02:04.646 -> RX_ADDR_P0-1	= 0xe7e7e7e7e7 0x65646f4e31
12:02:04.646 -> RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
12:02:04.646 -> TX_ADDR		= 0xe7e7e7e7e7
12:02:04.646 -> RX_PW_P0-6	= 0x20 0x20 0x20 0x20 0x20 0x20
12:02:04.646 -> EN_AA		= 0x3f
12:02:04.646 -> EN_RXADDR	= 0x02
12:02:04.646 -> RF_CH		= 0x4c
12:02:04.646 -> RF_SETUP	= 0x23
12:02:04.646 -> CONFIG		= 0x0f
12:02:04.646 -> DYNPD/FEATURE	= 0x00 0x00
12:02:04.691 -> Data Rate	= 250 KBPS
12:02:04.691 -> Model		= nRF24L01+
12:02:04.691 -> CRC Length	= 16 bits
12:02:04.691 -> PA Power	= PA_LOW
12:02:04.691 -> ARC		= 0

Sender (Arduino Pro Mini):
printDetails not printing allthough the rf module is initialized. Seems to be a known issue:

Sure I will post one later! :slight_smile:

You will need a printf_begin(); to use it on a Nano, see the documentation.

https://nrf24.github.io/RF24/classRF24.html#adc95213ed4c8569a90eb33122e16cea6

The output of the nodeMCU looks ok, it should work.
RF24_PA_MIN would be worth a try, and/or more distance.

Remember to post the newest version of the sketches after changes.

1 Like

Ah now it prints the details. Thanks for the hint! :slight_smile:

Reciever (NodeMCU):

12:02:04.646 -> SPI Speedz	= 10 Mhz
12:02:04.646 -> STATUS		= 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
12:02:04.646 -> RX_ADDR_P0-1	= 0xe7e7e7e7e7 0x65646f4e31
12:02:04.646 -> RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
12:02:04.646 -> TX_ADDR		= 0xe7e7e7e7e7
12:02:04.646 -> RX_PW_P0-6	= 0x20 0x20 0x20 0x20 0x20 0x20
12:02:04.646 -> EN_AA		= 0x3f
12:02:04.646 -> EN_RXADDR	= 0x02
12:02:04.646 -> RF_CH		= 0x4c
12:02:04.646 -> RF_SETUP	= 0x23
12:02:04.646 -> CONFIG		= 0x0f
12:02:04.646 -> DYNPD/FEATURE	= 0x00 0x00
12:02:04.691 -> Data Rate	= 250 KBPS
12:02:04.691 -> Model		= nRF24L01+
12:02:04.691 -> CRC Length	= 16 bits
12:02:04.691 -> PA Power	= PA_LOW
12:02:04.691 -> ARC		= 0

Sender (Pro Mini):

12:29:40.459 -> SPI Speedz	= 10 Mhz
12:29:40.505 -> STATUS		= 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
12:29:40.505 -> RX_ADDR_P0-1	= 0x65646f4e31 0xc2c2c2c2c2
12:29:40.505 -> RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
12:29:40.505 -> TX_ADDR		= 0x65646f4e31
12:29:40.505 -> RX_PW_P0-6	= 0x20 0x20 0x20 0x20 0x20 0x20
12:29:40.505 -> EN_AA		= 0x3f
12:29:40.505 -> EN_RXADDR	= 0x03
12:29:40.505 -> RF_CH		= 0x4c
12:29:40.505 -> RF_SETUP	= 0x23
12:29:40.505 -> CONFIG		= 0x0e
12:29:40.505 -> DYNPD/FEATURE	= 0x00 0x00
12:29:40.505 -> Data Rate	= 250 KBPS
12:29:40.505 -> Model		= nRF24L01+
12:29:40.505 -> CRC Length	= 16 bits
12:29:40.505 -> PA Power	= PA_LOW
12:29:40.505 -> ARC		= 0

Connections seem ok on both sides,
so my guess is insufficient power on the 3.3V supply of the sender.

Thanks for your input!

I tried to run the sender on my bench power supply with 3.3v and still no luck. :frowning: Hope the modules are not broken somehow!? But then it wouldnt print the details I think.

My benchpower supply shows me 10ma running the Pro Mini with the nrf24 attached. I think the the current spike of the nrf24 is too fast to see it there...

Not really sure what Im doing wrong.

Just found out about the pretty details:

Reciever

16:37:43.033 -> SPI Frequency		= 10 Mhz
16:37:43.033 -> Channel			= 76 (~ 2476 MHz)
16:37:43.033 -> Model			= nRF24L01+
16:37:43.033 -> RF Data Rate		= 1 MBPS
16:37:43.033 -> RF Power Amplifier	= PA_MIN
16:37:43.033 -> RF Low Noise Amplifier	= Enabled
16:37:43.033 -> CRC Length		= 16 bits
16:37:43.033 -> Address Length		= 5 bytes
16:37:43.033 -> Static Payload Length	= 32 bytes
16:37:43.079 -> Auto Retry Delay	= 1500 microseconds
16:37:43.079 -> Auto Retry Attempts	= 15 maximum
16:37:43.079 -> Packets lost on
16:37:43.079 ->     current channel	= 0
16:37:43.079 -> Retry attempts made for
16:37:43.079 ->     last transmission	= 0
16:37:43.079 -> Multicast		= Disabled
16:37:43.079 -> Custom ACK Payload	= Disabled
16:37:43.079 -> Dynamic Payloads	= Disabled
16:37:43.079 -> Auto Acknowledgment	= Enabled
16:37:43.079 -> Primary Mode		= RX
16:37:43.079 -> TX address		= 0xe7e7e7e7e7
16:37:43.079 -> pipe 0 (closed) bound	= 0x65646f4e31
16:37:43.079 -> pipe 1 ( open ) bound	= 0x3165646f4e
16:37:43.079 -> pipe 2 (closed) bound	= 0xc3
16:37:43.079 -> pipe 3 (closed) bound	= 0xc4
16:37:43.079 -> pipe 4 (closed) bound	= 0xc5
16:37:43.079 -> pipe 5 (closed) bound	= 0xc6

Sender:

16:40:15.203 -> SPI Frequency		= 10 Mhz
16:40:15.297 -> Channel			= 76 (~ 2476 MHz)
16:40:15.297 -> Model			= nRF24L01+
16:40:15.297 -> RF Data Rate		= 1 MBPS
16:40:15.297 -> RF Power Amplifier	= PA_MIN
16:40:15.297 -> RF Low Noise Amplifier	= Enabled
16:40:15.297 -> CRC Length		= 16 bits
16:40:15.297 -> Address Length		= 5 bytes
16:40:15.297 -> Static Payload Length	= 32 bytes
16:40:15.297 -> Auto Retry Delay	= 1500 microseconds
16:40:15.297 -> Auto Retry Attempts	= 15 maximum
16:40:15.297 -> Packets lost on
16:40:15.297 ->     current channel	= 0
16:40:15.297 -> Retry attempts made for
16:40:15.297 ->     last transmission	= 0
16:40:15.297 -> Multicast		= Disabled
16:40:15.297 -> Custom ACK Payload	= Disabled
16:40:15.297 -> Dynamic Payloads	= Disabled
16:40:15.297 -> Auto Acknowledgment	= Enabled
16:40:15.297 -> Primary Mode		= TX
16:40:15.297 -> TX address		= 0x3165646f4e
16:40:15.297 -> pipe 0 ( open ) bound	= 0x3165646f4e
16:40:15.297 -> pipe 1 ( open ) bound	= 0xc2c2c2c2c2
16:40:15.297 -> pipe 2 (closed) bound	= 0xc3
16:40:15.297 -> pipe 3 (closed) bound	= 0xc4
16:40:15.297 -> pipe 4 (closed) bound	= 0xc5
16:40:15.297 -> pipe 5 (closed) bound	= 0xc6

On the sender side: why are there 2 pipes open?

You ran the Pro Mini with 3.3V?

Do you own two of the standard modules?
These do work in proximity.

Sometimes touching the modules/antennas can make it work.

Pretty seems to be wrong.

I don't know, maybe a relict. NRFs need a power cycle to reset.

Its right, I changed these settings because I wanted the defaults :wink: except the PA level. :slight_smile:

As long as this is not the problem here Im fine :wink:

It can be a problem while developing, it does not occur in the application.
It's the sender and a reception setting, you program won't notice it.

I have still not seen the new code or any schematic.

You could try to switch off the LNA.

https://nrf24.github.io/RF24/classRF24.html#ab6a711a9cc14fb459a4a1698b8665d82

Okay, I replaced the antenna version of the nrf24 with a pcb antenna version and voilà: it works.

Seems the antenna version is defective or the power is not sufficient I suspect :frowning: