problem using nrf24l01 , clone?.

Hi,
i bought 2 nrf24l01 modules about 2 months ago , yesterday i tried testing them out , and nothing really happened i searched the internet found mine are clones i think i bought each one by 4$ not really sure, both don’t have the map behind to indicate where is vcc , gnd …extra , saw the original ones has it , the chip has this written on it 1715AH that’s why i thought it’s clones and called si24r1.
i tried to run a code to transmit and receive data but nothing happened really the serial communication kept failing , i tried the GettingStarted example from RF24 library but i kept getting
Got Payload 0… just kept going in my serial communication , i didn’t really understand what was triggering it
sometimes i can write T as fast as i can when the serial monitor appears but i get a failed to transmit.

STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN

and then Got Payload 0… just keep going

this is how the serial monitor looks like.
so how may i solve this? , and how to know this nrf24l01 is original for sure?.
Thank you for your time <3 .

Have a look at this Simple nRF24L01+ Tutorial.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

…R

Thank you for helping, i apologize for not replying fast enough i had other things to do.
ok so i deleted the library and downloaded the Tmrh20 you mentioned in the tutorial

note: i have an original uno and a clone (one that has red LEDs) i don’t know if that has anything to do with it but i had to mention it.

so this is everything happened in each arduino (i tested both nrf on each arduino).
the original one:
first nrf:
transmitting : it does transmit and (acknowledge receive) even if the other nrf isn’t connected! .
receiving : it does the data received over and over so fast.
communication : everything was 0x00.

second nrf:
transmitting: does nothing the serial monitor just shows (simpleTX starting)
same receiving and communication.

the clone one:
first nrf:
transmitting : just a (simpleTX starting) that’s it.
receiving : (simpleRX starting) nothing else.
communication : as i see it does communicate becuase almost 95% doesn’t has 0x00.

second nrf:
transmitting : simpleTx starting.
receiving : simpleRX starting.
communication : same as first.

i referred to them as original and clone just because i got different results for each
Thank you for your time <3.

Your descriptions are very confusing.

You can't test a single nRF24 on its own - you must have another one working with which it can communicate. If things are not working then you need to tell us exactly what program was on each Arduino and post a sample of the output from each Arduino.

Have you tried the connection test program in my tutorial? - IIRC it is on Reply #29

Have you read my comment on the expected output from the SimpleRx program - how does your output compare with that?

Wireless problems can be very difficult to debug and swapping things around willy nilly does not help.

...R

i know i did test both of them i didn’t test only one by itself of course , wherever i mention the nrf as transmitter the other one is a receiver and vice versa
i couldn’t really understand whats going on by myself so i couldn’t describe it perfectly.

forget what i mentioned above in the last comment.

let me try make it simpler :
(both are working at the same time one transmitting , one receiving)

original uno as transmitter shows this on the serial monitor (the LED TX does flash on the arduino which means it’s transmitting)

SimpleTX starting
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed
Data Sent Message 0 Tx failed

just keeps going and nothing else

the clone uno as receiver shows this (nothing flashes on the arduino)

SimpleRX Starting
Data Received Message 0

nothing else
-----------so now consider this
original arduino as receiver shows this

SimpleRX Starting

nothing else

clone arduino as transmitter shows this

SimpleTX Starting

nothing else

and both of them does communicate with the nrf last 4 hours i don’t know what was wrong but the original arduino wasn’t communicating with the nrf.
hope that was a good explanation.
excuse my poor knowledge about communications.
Thank You for your time <3.

I'm still confused. Maybe if you "attach" names to your modules (such as nRF24-A and nRF24-B) and re-write it I will be able to follow your description.

You have not said whether you tried my connection test program.

I have a Mega clone that cannot provide enough 3.3v current for an nRF24. If you suspect that problem then power the nRF24 from a pair of AA alkaline cells (3v) making sure that the battery GND is connected to the Arduino GND.

...R

yes i did test the connection program on reply #29
i thought saying both are communicating with the nrf would clarify that i tested them but anyway i did test them
and i didn’t see 0x00 on both of them only like a very few things.
at my last reply i didn’t replace the nrf so no need for nrf-A and nrf-B at the first attempt i linked the original uno as transmitter and the clone as receiver
the second attempt i linked the originla uno as receiver and the clone as transmitter.
in both attempts i didn’t swap the nrfs.
Thank You for your time <3.

EDIT : it worked!.
i just used batteries to supply the nrf on the other arduino and it worked , thank you so much , but if you have a knowledge about it , may i know about it please? i know the original uno pin output 40mA each in total 200mA
the nrf i believe should use 12mA
so what’s going on in the clone?
i don’t really use batteries often so how much current does an AA battery provide? i don’t have a multimeter at the moment so i couldn’t see how much does it provide.
do i need to consider anything working with them? , especially now with the nrf that it might damage it after a few hours maybe?.

krom:
EDIT : it worked!.

Just as well because I was about to say that I could not make sense of the earlier part of your Reply #6 any more than your earlier Posts. :slight_smile:

i just used batteries to supply the nrf on the other arduino and it worked , thank you so much , but if you have a knowledge about it , may i know about it please? i know the original uno pin output 40mA each in total 200mA
the nrf i believe should use 12mA
so what's going on in the clone?
i don't really use batteries often so how much current does an AA battery provide? i don't have a multimeter at the moment so i couldn't see how much does it provide.
do i need to consider anything working with them? , especially now with the nrf that it might damage it after a few hours maybe?.

You have a whole pile of mixed up questions here.

A multimeter is not really suitable - you would need an oscilloscope to see very brief current demands over a few microsecs.

The power for the nRF24 does not come from the Arduino I/O pins (for which 40mA is the absolute max, by the way). Also note that the I/O pins produce 5v power unless you are using a 3.3v Arduino.

The power for the nRF24 comes from the 3.3v pin and its capability depends on the 3.3v regulator chip on the PCB.

AA cells can produce 1 or 2 amps for short periods.

If you don't want to use batteries then get an external 3.3v power supply or make one with an LD1117 3.3v regulator.

...R

so i managed to make a few sketches that worked fine , now i tried to do this.
i cant seem to see what i am doing wrong

this should read the value of a potentiometer and adjust the servo on the other arduino as well as turning on a led based on a button on the other arduino

this is on the original uno

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

Servo s;
int button = 4;
const byte theslave[5] = {"BBBBB"};
const byte slaveAddress[5] = {"AAAAA"};
int valueReceived;
unsigned long cMillis ;
unsigned long pMillis = 0;
int interval = 1000;
bool state;
bool test;
RF24 radio (9 , 10);
void setup() {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_2MBPS);
radio.openReadingPipe(1 , theslave);
radio.openWritingPipe(slaveAddress);
s.attach(3);
pinMode(button , INPUT_PULLUP);
}

void loop() 
{
cMillis = millis();
    if(cMillis - pMillis >= interval)
    { 
        radio.startListening();
        
        if(radio.available())
        {
           radio.read(&valueReceived , sizeof(valueReceived));
           Serial.print("you have received ");
           Serial.println(valueReceived);
           Serial.println("");
        }
        else Serial.println("No Radio Available");
        s.write(valueReceived);
        radio.stopListening();
        state = !digitalRead(button);
        test = radio.write(&state , sizeof(state));
        
        if(test) Serial.println("Data has been received from the slave");
        pMillis = cMillis;
  }
}

this is on the clone uno

#include<SPI.h>
#include<nRF24L01.h>
#include<RF24.h>
int interval = 1000;
int ReadingValue = A0;
RF24 radio (9 , 10);
const byte slaveAddress[5] = {"BBBBB"};
const byte theslave[5] = {"AAAAA"};
unsigned long cMillis ;
unsigned long pMillis = 0;
bool digital ;
bool test;
int LED = 3;
void setup() {
 Serial.begin(9600);
 radio.begin();
 radio.setDataRate(RF24_2MBPS);

 radio.openWritingPipe(slaveAddress);
 radio.openReadingPipe(1 , theslave);
 pinMode(ReadingValue , INPUT);
 pinMode(LED,OUTPUT);
}

void loop() 
{
cMillis = millis();
  if(cMillis - pMillis >= interval)
  { 
       radio.stopListening();
       int value = map(analogRead(ReadingValue) , 0 , 1023 , 0 , 180); 
       test = radio.write(&value , sizeof(value));
       Serial.println(value);
          
          if(test)Serial.println("Data has been received from the slave");
          else Serial.println("Failed");

       radio.startListening();
          
          if(radio.available())
          {
             radio.read(&digital , sizeof(digital));
             digitalWrite(LED ,digital);
             Serial.println(digital);
          }
       Serial.println("");
       pMillis = cMillis;
   }
}

the original can send to the clone it work perfectly when i press the button the led turn on ,
but it fails to transmit the data from the clone to the original
i managed to transmit data from the clone to the original when i was writing a one way transmitting and it worked perfectly i don’t know where i went wrong trying two way transmission.
if you have time help me out please <3.
i don’t know but i think it will be something so silly because i always miss the tiny things.
Thank You .

krom:
so i managed to make a few sketches that worked fine , now i tried to do this.
i cant seem to see what i am doing wrong

What pair of programs worked?

Have you started from the working pair and made minimal changes, testing after each change to make sure it still worked?

There is no other way to evolve a working wireless program.

A couple of days ago I started with my own SimpleTx and SimpleRx programs and very quickly had a pair of programs that allowed wireless control of a model train.

...R

yes i did work it out slowly , i worked alot with it starting from the simpleTX and simpleRX it led me to this code
reply 8# i didn't write it out completely without testing it out , i slowly made sure that everything is fine and working when i mixed them up some witchery happened and i got stuck .
i will try to build everything again but i need some sleep now only thought of posting it here because i didn't know what i have done wrong , it's hundred time worse not knowing what's going on than getting an error.
Thank You.

krom:
yes i did work it out slowly , i worked alot with it starting from the simpleTX and simpleRX it led me to this code
reply 8# i didn't write it out completely without testing it out , i slowly made sure that everything is fine and working when i mixed them up some witchery happened and i got stuck .

Post the most advanced pair of programs that worked.

And also post the next version of the two programs - i.e. the first pair that don't work.

Then we will be able to see the change that broke the system.

...R

those are new and i have just written them.

transmitting code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9 , 10);
const byte slaveAddress[5] = {"BBBBB"};

char dataToSend[12] ={"Hello World"}; 

void setup() {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_2MBPS);
radio.openWritingPipe(slaveAddress);
radio.stopListening();

}

void loop() {
bool test;
test = radio.write(&dataToSend , sizeof(dataToSend) );
if(test)Serial.println("slave received the message");
else Serial.println("Failed");
delay(1000);

}

Receiving code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9 , 10);
const byte theslave[5] = {"BBBBB"};

char dataReceived [12];
void setup() {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_2MBPS);
radio.openReadingPipe(1 , theslave);
radio.startListening();
}

void loop() {
if(radio.available())
{
  radio.read(&dataReceived , sizeof(dataReceived));
  Serial.print("you received ");
  Serial.println(dataReceived);
}
else Serial.println("No Radio Available");
delay(1000);
}

so both of these worked as expected and on both arduino i switched the transmission and receiving on both of the arduinos and worked as expected.

now i tried a two way transmission

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9 , 10);
const byte slaveAddress[5] = {"BBBBB"};
const byte theslave [5] = {"AAAAA"};
char dataToSend[12] ={"Hello World"}; 
char dataReceived[3];
void setup() {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_2MBPS);
radio.openWritingPipe(slaveAddress);
radio.openReadingPipe(1 , theslave);


}

void loop() {


  // doesnt work
  //this should receive HI
radio.startListening(); 
if(radio.available())
{
  radio.read(&dataReceived , sizeof(dataReceived));
  Serial.print("you received ");
  Serial.println(dataReceived);
}
else Serial.println("No Radio Available");

delay(1000);

  // work
  //this should transmit Hello world
  radio.stopListening();
bool test;
test = radio.write(&dataToSend , sizeof(dataToSend) );
if(test)Serial.println("slave received the message");
else Serial.println("Failed");
Serial.println("");
delay(1000);

}
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9 , 10);
const byte theslave[5] = {"BBBBB"};
const byte slaveAddress[5] = {"AAAAA"};
char dataReceived [12];
char dataToSend[3] = {"HI"};
void setup() {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_2MBPS);
radio.openReadingPipe(1 , theslave);
radio.openWritingPipe(slaveAddress);

}

void loop() {

// doesnt work
// this should transmit HI
 radio.stopListening();
 bool test;
 test = radio.write(&dataToSend , sizeof(dataToSend) );
if(test)Serial.println("slave received the message");
else Serial.println("Failed");
  
delay(1000);

  // work
  // this should receive Hello World
  radio.startListening();
if(radio.available())
{
  radio.read(&dataReceived , sizeof(dataReceived));
  Serial.print("you received ");
  Serial.println(dataReceived);
}
else Serial.println("No Radio Available");

Serial.println("");
delay(1000);
}

now this is confusing the first few statements doesn’t work but after it switch the mode of the nrf it works perfectly so the conclusion is that the first mode doesn’t work but it works after it
oh and it’s save to say that i have tested your two way transmission on both of my arduino switching roles between them and it worked , probably i am doing something silly that i cant see
Thank You <3.

EDIT:
yea i knew it i was doing something silly that i don’t really understood so i carefully read your code about two way transmission when i am sending the data i didn’t switch back to listening mode so i can see that the data has been sent or not i was still in stoplistening mode as you can see in my code so of course it wont know if the data has been received.
tell me if i am correct or not at this point? , now this code works fine on both of arduinos i am adding things up and i will hope to not be as silly as this time

krom:
tell me if i am correct or not at this point? , now this code works fine on both of arduinos i am adding things up and i will hope to not be as silly as this time

Are you saying that you have corrected the missing switch-over to listening and your programs are now working as you require?

...R

yea i didn't start listening after i sent the data so that's why the nrf couldn't tell if the data has been received.
that's why it kept showing Failed on the serial monitor.