That is not in Robin2's code, but should be in your sketch.
My sender is printing "send failed" and the receiver is printing "no message after one second".
Do you own some standard, tested NRF24L01+ modules?
That would allow to you to verify the setup and then test one module at a time.
Your intermittent problems point more in the direction of bad contacts/cables/solder joints.
I did manage to get a working setup some years ago with a pair that I marked as working. I am using them now.
I tried Robin2's code on the transmitter and receiver but nothing's working.
Anyone, any ideas?
I also have a PCB I designed for an RC car receiver. It has two L293D motor drivers along with a NRF24L01+ / NRF24L01+PA+LNA and Atmega328 chip. I tried to add a CH340 for programming but it doesn't seem to work. Would this work?
I tried it but it is not doing anything either. Because the onboard programmer doesn't seem to be working, I program the chip in an Arduino Uno, and then transfer it to the PCBA. I also designed an LED onto the PCB connected to an I/O, so that I can program it to light up when data is received.
New receiver code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define LEd A5
RF24 radio(8, 10); // nRF24L01 (CE, CSN)
const byte address[6] = "00001";
unsigned long lastReceiveTime = 0;
unsigned long currentTime = 0;
boolean connection = true;
// Max size of this struct is 32 bytes - NRF24L01 buffer limit
struct Data_Package {
byte j1PotX;
byte j1PotY;
byte j1Button;
byte j2PotX;
byte j2PotY;
byte j2Button;
byte pot1;
byte pot2;
byte tSwitch2;
};
Data_Package data; //Create a variable with the above structure
void setup() {
Serial.begin(9600);
pinMode(LEd, OUTPUT);
digitalWrite(LEd, HIGH);
Serial.println("");
Serial.println("");
if (radio.begin()){
Serial.println("RF started successfully!");
}
else {
Serial.println("RF start failed!");
digitalWrite(LEd, HIGH);
while(1);
}
radio.openReadingPipe(0, address);
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
radio.startListening(); // Set the module as receiver
resetData();
delay(5000);
digitalWrite(LEd, LOW);
}
void loop() {
// Check whether there is data to be received
if (radio.available()) {
radio.read(&data, sizeof(Data_Package)); // Read the whole data and store it into the 'data' structure
Serial.println("Radio received");
digitalWrite(LEd, HIGH);
delay(50);
digitalWrite(LEd, LOW);
connection = true;
lastReceiveTime = millis(); // At this moment we have received the data
}
// Check whether we keep receving data, or we have a connection between the two modules
currentTime = millis();
if ( currentTime - lastReceiveTime > 1000 ) { // If current time is more then 1 second since we have recived the last data, that means we have lost connection
resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for example if a drone has a throttle up and we lose connection, it can keep flying unless we reset the values
connection = false;
}
if (connection == true){
// Print the data in the Serial Monitor
// Serial.print("ARC: ");
// Serial.print(radio.getARC(););
Serial.print("j1PotX: ");
Serial.print(data.j1PotX);
Serial.print("; j1PotY: ");
Serial.print(data.j1PotY);
Serial.print("; button2: ");
Serial.print(data.tSwitch2);
Serial.print("; pot1: ");
Serial.println(data.pot1);
}
}
void resetData() {
// Reset the values when there is no radio connection - Set initial default values
data.j1PotX = 127;
data.j1PotY = 127;
data.j2PotX = 127;
data.j2PotY = 127;
data.j1Button = 1;
data.j2Button = 1;
data.pot1 = 0;
data.pot2 = 0;
data.tSwitch2 = 1;
}
Receiver PCB schematic:
Schematic_RC Car Receiver_2021-11-02.pdf (93.4 KB)
Did you wire the modules you did have working in the exact same way, with the exact same Arduinos and now the combination is not working ?
I'm not sure if it's the exact same Arduino, as I have several. Also, the receiver on my working setup a while ago was an Arduino, not an Atmega328 IC. I also don't remember how I wired them or what code I used.
My transmitter is a soldered PCB circuit so I would assume it would be quite stable. I also used a 3.3v regulator for powering the NRF24L01+PA+LNA instead of the Arduino Nano 3.3V pin on the PCB. This transmitter has worked before just fine.
It seems like the transmitter is still working fine as when I turn auto ack off, it says "radio.write successful!", and when auto ack is on, it says "radio.write failed!".
If the transmitter works, I would then assume the receiver(s) is not working. So I switched the breadboard and wires out for new ones and swapped out the transceiver. It is as though there is no data being sent.
Either setup (PCBA or breadboard) is not receiving the data despite everyones help. I did try everything everyone has said.
This is really frustrating! ![]()
It only means you successfully transferred a packet to the NRF and commanded it to send it once.
The chip tried, not more.
Oh. I wasn't sure what that meant. What about with auto ack on?
Do you think I should replace the NRF on the transmitter? I haven't because it has worked before, and it is soldered, so i would have to desolder it and try to solder on another one.
EDIT: Now the transmitter is saying "RF start failed!".
EDIT 2: I just finished soldering a 10µF cap right onto the transmitter 3.3v and GND. It seems to be working ok now.
Anyone, any ideas? It’s still not working.
Basically you have no reals clue, where the intermittent failure is caused,
and what exactly causes it.
If you still have any suspicious connections in your setup,
like breadboards, jumper wires or such,
then make the connections solid,
or exchange the whole node - at least for a test - with a correctly wired one.
I often use these
https://de.aliexpress.com/item/32879822052.html
to create test setups. They sport some level shifting,
but I never experienced any difference in the behaviour of the NRFs.
Oh.
Yes. And now it's not so intermittent either. There is NO data being received at all for anything I have tried, including the setup and code that partially worked for a little bit, before. I've added lots of serial debugging on both sides to see if I can pin the problem. I think that the transmitter is sending the data ok, but the receiver is not receiving it.
No. Now, both transmitter and receiver circuits are soldered onto PCBs, with all connections secure.
Also, I tried switching the Nano to an Uno on the receiver side. That didn't work either.
Thanks @Whandall for your help.
Here is the serial monitor output on the transmitter:
That is what is printed after the reset button is pressed.
Here is the serial monitor output on the receiver:

So it seems your PCB creates problems, but who knows,
the failing transmissions can have a lot of reasons.
I would
- proof that the sketches work correctly, by verifying them on known good hardware
- proof that on that hardware the high-power modules work also in all three configurations
- swap in the new nodes (one at a time) to find the failing configuration
How? Try receiving and transmitting on breadboards? I was still using my transmitter PCBA and just changing the receiver because the transmitter has worked several times before.
The problem is the last time I got It working, the receiver was on a breadboard. So I have no verifiable working receiver.
The modules I linked are €2.58, Nanos €2.48, delivered including tax.
I do not have to wait for any delivery, I have some of both around,
together with a wide variety of NRF24L01+ modules, so it would be easy for me.
Ok. So I should order the module you linked? It will just take a while for shipping, and I haven't ordered from Aliexpress before. That's why I'm hesitant.



