NRF24L01 module not sending data.

im trying to send a simple hello msg to another NRF module but the message is not being sent. the code im using is below and every time i try to send a message it displays not sent message in serial print. PLease help

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  if(!radio.write(&text, sizeof(text))){
    Serial.println("not sent");
  }
  else{
    Serial.println(text);
  }
  delay(1000);
}

The best advice that I can give is to follow Robin2's simple rf24 tutorial to get the radios to work.

Check your wiring. Your program "works" for me, at least as far as printing the Hello World message rather than not sent.

I have not tried receiving the message

groundFungus:
The best advice that I can give is to follow Robin2's simple rf24 tutorial to get the radios to work.

Tried that in first place. It didnt worked

Did you try Robin's connection test sketch ?

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

How are you powering the NRF?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

How are you powering the NRF?

Thanks.. Tom.. :slight_smile:

Vcc-3.3v
Gnd-Gnd
CE-9
Csn-10
SCK-13
MOSI-11
MISO-12

Hi,
Please a schematic, also have you got a 10uF capacitor across the 3.3V supply, the 3.3V regulator on the controller sometimes need this to deal with the surge current when the NRF starts to Tx.

What about your receiver?

What model Arduino are you using?

Thanks.. Tom.. :slight_smile:

shaikhhammadali:
Tried that in first place. It didnt worked

Then you have done something wrong or one of your nRF24s is faulty.

First thing is to try the connection test program on both Arduinos. If that does not work then nothing will work.

The connection test does not test the wireless part of the nRF24 and a common problem is an inadequate 3.3v power supply. Try powering your nRF24s with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you still cannot get my first example program to work then please post the exact programs that YOU uploaded to your Arduino and also provide a sample of the output from each Arduino.

...R

TomGeorge:
Hi,
Please a schematic, also have you got a 10uF capacitor across the 3.3V supply, the 3.3V regulator on the controller sometimes need this to deal with the surge current when the NRF starts to Tx.

What about your receiver?

What model Arduino are you using?

Thanks.. Tom.. :slight_smile:

HI tom
yes i have got a capacitor on both Modules.
im using arduino NANO for transmitting and a UNO for receiving.

BTW i just saw that if on code i define CE and CSN as 7 and 8 respectively and my NRF is physically connected to PIN 9 and 10.
on the above condition the nrf is transmitting a hello world msg.
Can you help me with this?

1 Like

Connect CE and CSN on the NRF24s to the that you use when creating the instance of the radio object. You cannot hope to make the program work if you do not do that

Once again, have you tried Robin's connection test program ?

Hi,
Which NRF modules are you using, the standard or the plus version?

Tom.. :slight_smile:

UKHeliBob:
Connect CE and CSN on the NRF24s to the that you use when creating the instance of the radio object. You cannot hope to make the program work if you do not do that

Once again, have you tried Robin's connection test program ?

yes I have tried Robins connection test.

TomGeorge:
Hi,
Which NRF modules are you using, the standard or the plus version?

Tom.. :slight_smile:

Standard...i guess

Hi,
How close are they together?
Try spacing them apart.
Tom.. :slight_smile:

TomGeorge:
Hi,
How close are they together?
Try spacing them apart.
Tom.. :slight_smile:

im just trying to send data, not working on recieving it.
if the data is sent from one NRF then ill work on the other nrf

shaikhhammadali:
yes I have tried Robins connection test.

Boy, this is hard work.

What was the result ?

Hi,
Can you post a picture of your project so we can see your component layout?

Thanks.. Tom.. :slight_smile:

hi tom
i have told you everything about connection and layout.
im attaching a pic but i dont think a pic will help you to understand the layout

I can assure you that Robin2's code does work. I have used his code many times. If it did not work for you, you most likely have a hardware problem.

One thing to note is that a reset of the Arduino that a rf24 that is connected to will not reset the radio. After you upload new code to the Arduino, power cycle the Arduino to reset the radio. I found that that is often necessary.