Can't get NRF24L01 to communicate

I've done a few projects using the NRF24L01 boards but today I can not get them to work, more than likely missing the obvious but would like you to check what I have been doing.

I use the attached code as a check to make sure the hardware I have is functional, I've used it before. I copied these off off the "Howtomechatronics" website. Other than a couple of Serial.print statements I have not modified them. They're a good basic setup, again just to prove it's working before incorporating it into my project. For my project I only need one way communications.

I have swapped out every component one at a time, including the dupont wires, to see if one of them is bad. I've tried powering them directly and using the the breakout adapters so I can use 5V, that is currently how I have them setup. I've tried both Uno's and Nanos.

Here are my connections
Uno/Nano ------------------- Breakout Board
5V ------------------------------- Vcc
GND ---------------------------- Gnd
Pin 7 ---------------------------- CE
Pin 8 ---------------------------- CSN
Pin 11 -------------------------- MOSI
Pin 12 -------------------------- MISO
Pin 13 -------------------------- SCK

I've also tried other programs. So I've replaced the programs and all hardware but still can't get them talking to each other. I may have multiple component failures.

So the questions are, should this code work? Do I have them connected properly?

Thanks
John

Transmitter code

/*
* Arduino Wireless Communication Tutorial
*     Example 1 - Transmitter Code
*                
* by Dejan Nedelkovski, www.HowToMechatronics.com
* 
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/

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

RF24 radio(7, 8); // 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";
  radio.write(&text, sizeof(text));
  //Serial.println(text);
  delay(1000);
}

Receiver code

/*
* Arduino Wireless Communication Tutorial
*       Example 1 - Receiver Code
*                
* by Dejan Nedelkovski, www.HowToMechatronics.com
* 
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/

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

RF24 radio(7, 8); // CE, CSN

const byte address[6] = "00001";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}

void loop() {
  //Serial.println("loop");
  if (radio.available()) {
    //Serial.print("available");
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

Where does controller power come from?

Both are plugged into USB ports, I opened two instances of the IDE so I could monitor both on the Serial monitors. I did read that they can use a lot of power and that a separate power supply may be needed. I do have both set to "RF24_PA_MIN" and the example video's show no external supply.

Do you think that is the problem?

Thanks

If the radios work you are indeed lucky. They are 3V3 items not 5V which you are supplying per your statement. Annotated schematics save a lot of questions. Rule #1 "A Power Supply the Arduino is NOT!" When transmitting these radios draw more power then most of the Arduinos can supply. With 5V powering them the current will go way up and probably fry them.

@gilshultz I'm using the adapter board which takes 5v and has the 3.3v regulator on it. I did mention that I am using the adapter and provided a pinout list from the Uno/Nano to the adapter, I can draw that out if it makes it clearer. @Railroader mentioned about the power supply and when I get home I will try an external supply.

Thanks

Actually the NRF24L01 only draws 10-15ma so can be powered from the Arduino. It is not near as bad as WiFi or Cellular devices for power.

Not all adapter boards have regulators on them. Let us know how the supply works out. Some people get by with the arduino but many do not. Not knowing what you have the external power supply is still my recommendation as others.

The 5V power supply does help but now there's a different problem. First, the breakout boards do have the 3.3v regulator as I measured 3.3v on the power pins of the NRF24's.

I now do get a response on the receiver nano but it's just a string of ??????????????. I added the timestamp to the serial monitor and for the most part the strings are 1 second apart, the time delay of the transmit of "Hello World". There are a few shorter strings as well at different times, basically reading garbage.

Would the transmitter not be sending "Hello World" correctly or is the receiver not decoding the text correctly?

Thanks for your help
John

One other thing that I thought was odd. When I first connected the power supply I didn't put a jumper from the 5V common to the GND's on the Nano's, usually you want everything too have the same common. When I connect the 5V common to the GND of the transmitter it stops, I don't see the messages scroll on the receiver monitor, unplug the GND and it starts again. I assume it's conflicting with the GND coming from the USB but this is the first I've had that problem.

Hello,
I've tried hardly to work with those components too and it appears that powering them directly by the arduino wasn't a good solution
Plus, you should really considere to add a capacitor the clothest you can of the radio module between the power pins (Vcc & GND) to be able to give all the current needed if there are some peaks. (Of course, if you power the module with an external source (which is highly recommended), don't forget to connect all the GND together)
Give it a try and tell me if this worked!

(sorry if there are spelling mistakes.... I'm french lol)

@Anthony_P , As explained above I did use an external power supply but when I tried connecting the Nano grounds to the supply it seems to halt. I'll look at how much ripple I'm getting and add a cap as well. Don't worry about the spelling, I've been programming large industrial machines, chemical processes and pharmaceutical systems for years, I'm also the worst speller in the world.
thanks for the input

How is powered the Nano?
Did you try to power ONLY the radio module with the external power supply (but still you connect all the GND together); the Nano board being supplied by your computer.
Also, did you add the capacitor? It can be a solution since when emitting there are some peak of current

Hi, @Stumpy_L

Can you please post circuit diagrams of your project?
Can you please post some images of your project?
So we can see your component layout.

Have you got the two NRFs close together?
If so, then spread them about 1 metre apart, they may be overloading each others Rx front end.

Tom.. :grinning: :+1: :coffee: :australia:

1 Like

@Anthony_P the Nanos are powered by the USB, I need to be able to use the serial monitor so I can see if they're working. I added a Serial print statement to the transmitter to make sure it is sending the text, and I need to monitor the receiver to see if I am getting the message. I have not added the capacitor yet, I will when I get home from work. I have the grounds of the NRF24's and the power supply together but it seems to cause problems when I also connect the Nano grounds, which doesn't seem right to me but will also look into that later.

@TomGeorge I did put a pinout listing on the original post but will get a schematic as well. I'll also take some pictures for you. The NRF24's are about 2 feet apart from each other but I can get some longer cables and get them further apart to see if that helps. I do have the power level to both set at minimum.

Thanks

It is indeed not normal that connecting all the GND together make all of this behaving oddly.
Maybe in this case the capacitor can fix this!

About what Tom said, it's true that you need to keep them at least 1m apart in order to not damage them (which is maybe already done...)

Keep us in touch!

An annotated schematic showing exactly how this is wired including all connections, power, ground and power sources. Also post links to each of the hardware devices that give technical data.

I think I have most of what you have been asking for, attached is the schematic, a couple of pictures of the setup, my output on the monitors and some of the links to the hardware I'm using.

A couple of notes, Fritzing doesn't have a power supply image, I find that surprising, and I could find a link to the supply I have but it does say on the bag it was in that it's a 1 amp supply. I have a few different Nano's but could only find a link to one of them, I probably bought the other at a store, they both are labeled as Nano. The NRF24's are 1 meter apart. Both Nano/NRF24 are wired the same so I only showed one on the schematic, the only common points are the power supply and I now do have all the GNDs including the Nanos connected. Looking at the monitor I do get "Hello World" every second on the transmitter side. I get the string of ????????? constantly, so the NRF24 must be available on the receiver side just not reading anything.

Let me know if you need any further info and thanks for your help.

nano https://www.amazon.com/gp/product/B07TTN2HMQ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

NRF24 https://www.amazon.com/gp/product/B00O9O868G/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

breakout board https://www.amazon.com/gp/product/B01IK9GCPE/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1





I'm sorry but are you saying that you are receiving, on the sender side, in the serial monitor, the message you try to send??
Is that you that want it to be printed or it has nothing to do here?

Another thing, in the serial monitor, when you see "newline", pls set it to "both [...]"
On the receiver side, when you get all those "?????", is this synchronize with the emitter or not?
I mean, could it be the message but misunderstood? :thinking:

And pls, where you can see "newline" in the serial monitor, set it to "both [...]"

@Anthony_P On the sending side I added a "Serial.println(text)" statement to show me that it is sending the message every second. On the receiving side I also added a "Serial.println(text)" statement to show what it is receiving. On the receiving side I get a constant string of "????????????" these are not synchronized to the 1 second send message.

I wasn't sure of what you wanted me to set "both" on the serial monitors but I have set them both to "Both NL & CR"

Thanks

1 Like

Sorry I do not spend time with fuzzy frizzy pictures. As you stated parts are missing.