Can't get NRF24L01 to communicate

Hi, @Stumpy_L

An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

Have you got the gnd ofthe NRF connected to the Arduinos?

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

1 Like

Thanks @TomGeorge the schematic is in a previous comment. Yes I have all the grounds, the 5V PS, two Nanos and two NRF24l's connected together.

I did a small test this morning and something doesn't seem right to me. In the receiver system I tested the "if (radio.available())" statement. I added a "Serial.println("Available")" statement inside of that if loop. I didn't turn the 5V supply on, I then took the NRF24L off of the breakout board and disconnected the MISO & MOSI wires with all 3 test the "if (radio.available())" function was still true as "Available" prints on the monitor.

Shouldn't that not be true?

Thanks again

Which comment all I saw was a fuzzy frizzy. You might want to google to find out what an annotated schematic is. Schematics are the language of electronics.

Indeed, I really think that it should be false if you even didn't wired the module
Can you try to connect both arduino together with SPI directly, without the radio module?
Try to make it work so we'll be sure that the SPI works on both arduino
Fix one arduino as sender and the other as receiver, the once it work you make the opposite

If this work, we'll focus on the module, otherwise it means that there is a problem with your arduino tho

Thanks @Anthony_P I can give that a try, I do believe I have hardware issues, more than likely more than 1 faulty component.

@gilshultz I have been using electronics as well as designing and programming automation controls for large industrial machines for over 45 years, I know a thing or two about schematics. Did I provide a standard schematic with ISO symbols, no, did I provide a graphical drawing showing the components with the connection points clearly label for each wire, all 7 of them, yes. I didn't label them as there are only two components and I assumed you would know which was which.

Let's go back to my original post. I said I believe I had hardware problems but before I order all new components I wanted someone to double check two things. Will the two programs I provided work? Have you looked at those yet? And is the pin to pin list I have the correct way to wire these two modules together. Two simple generic questions that no one has answered yet.

1 Like

Hello again
You're right, we didn't answer to those questions
I don't have access to my arduino so I can't affirm the program are good; but you said you used them before
However, if you want to be sure to have a working code, use one coming from the basic library SPI. They work for sure!

About your wiring, it's complicated to say if yes or not they are well wired because sometimes the constructor swap MISO and MOSI. I assume you supply them correctly, but maybe the constructor made "a mistake" about the data wires... That is why I want you to try the SPI communication directly with the boards wired together!

Did you try it?

@Anthony_P I did try swapping the MOSI and MISO pins before but it didn't help, I will try that again and try having them talk directly to each other, hopefully sometime in the next couple of days.

thanks

Take the code from the example in the library pls! And yes, make a break with the radio module until the communication between the two arduinos works in SPI

@Anthony_P Finally something that works. I loaded a master slave example that has a pushbutton and a LED on each unit. When you press the button on one unit the LED on the other lights, it works for both ways of communication. I loaded the codes into 2 nanos and 2 Unos and it works just fine.

I will now compare this code to my NRF24 code to see if there are differences. If not then there is a problem with the NRF24's

Thanks for sticky with me on this
John

If the code works, then there is no problem with the module, it means there is a mistake in YOUR code

Try to keep everything in the exact same place, not even touching the wires (to avoid bad contacts) and upload your code

Keep my in touch!

1 Like

@Anthony_P yes either the code or my NRF24 modules. I'll work on the code either tonight or tomorrow morning.

I'll let you know what I find out.

Thanks

@Anthony_P sorry it's taken me sometime to get back to you but I finally got it to work. Was still having problems with the code, I bought new hardware but here's what I did.

I saw on another video to make the leads from the NRF24L01 to the Arduino as short as possible so I did that, see the attached picture. I also ran the RF24 libraries scanner example, that worked after I shortened the leads. I Picked a channel that had no interference on it, using the "radio.setChannel(96);" command and set the baud rate, "radio.setDataRate(RF24_1MBPS);".They didn't have either one of these in the examples. Once I did that it worked fine.

Thanks for your help
John

1 Like

Hello
I'm happy for you if this works now!

Can you please mark this topic as solved by choosing a post that is the solution
Better even if you could share your code here so that people will try it if needed

I will when I get home

Thanks

Here are the 2 programs that I used to test the NRF24L01, One sends the message "Hello World" the other receives it and prints it on the serial monitor, see post #32 above for the 2 items I did to fix my problem.

Thanks to those who offered help.

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.setDataRate(RF24_1MBPS); //added to original example
  radio.setChannel(96);  //added to original example
  radio.setPALevel(RF24_PA_MIN);
  radio.openWritingPipe(address);
  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.setDataRate(RF24_1MBPS); //added to original example
  radio.setChannel(96);  //added to original example
  radio.setPALevel(RF24_PA_MIN);
  radio.openReadingPipe(0, address);
  radio.startListening();
 }

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

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.