Problem with transferring array value of RFID card using the NRF24l01

hello everyone
I’m a beginner to the this kind of coding. if there anybody can help me with this. please.

I want to transfer the value of RFID card read using the RDM6300 from the first Arduino (uno) to my second Arduino (mega) using the nrf24l01. i’m using the array to store the value and i want to transfer all the value to other Arduino but the my other Arduino cant read all the data in the array.

example
my output from serial monitor of the first Arduino(Uno) which connected to RDM6300:

2 49 57 48 48 52 52 50 52 53 57 50 48 3
2 49 57 48 48 52 52 50 52 53 57 50 48 3
2 49 57 48 48 52 52 50 52 53 57 50 48 3
2 49 57 48 48 52 52 50 52 53 57 50 48 3
2 49 57 48 48 52 52 50 52 53 57 50 48 3
2 49 57 48 48 52 52 50 52 53 57 50 48 3
2 49 57 48 48 52 52 3 2 49 57 48 2 49
57 2 49 57 52 2 49 2 49 57 48 3 2 49
57 48 48 52 52 2 49 2 49 57 48 2 49 2
49 57 2 49 57 48 48 2 49 57 2 49 57 2
49 2 49 57 48 2 49 48 2 49 57 48 48 52
57 2 49 57 48 2 49 2 49 57 3 2 2 49
57 2 49 57 48 2 49 48 2 49 57 48 48 2
49 57 2 49 57 48 2 -1 -1 -1 -1 -1 -1 -1

*as shown the bold number only is the correct id number. i don’t know why rdm6300 cannot read the card number for continuous time

my output from serial monitor of second Arduino(mega):

0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 49 57 48 0 0 0 0 0 0 0 0 0 0
2 49 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
49 2 49 57 48 2 0 0 0 0 0 0 0 0
49 57 2 49 57 0 0 0 0 0 0 0 0 0
49 2 49 57 0 0 0 0 0 0 0 0 0 0
57 2 49 0 0 0 0 0 0 0 0 0 0 0

*also as u can see the number display is different. it suppose to display the same number as in the first serial monitor regardless the wrong card number read by RDM6300.

anybody can help me? plss. i’m currently working on project which really need this function to work correctly.:frowning:

I’ve attached my coding here.

nrf24l01_transmitter.ino (979 Bytes)

nrf24l01_receiver.ino (555 Bytes)

For short programs please include the code in your post (using the code button </> ) so we don’t have to download them - like this

TX

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

SoftwareSerial Rfid = SoftwareSerial(2,4);
RF24 radio(7,8); // CE, CSN
//RF24 radio2(3,4);
const byte address[6] = "00001";

int id;
int idnum[14];
int decide=-1;

void setup() {
  Serial.begin(9600);
  Rfid.begin(9600);

  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  


}
void loop() {

    radio.stopListening();
    RFID();
       
}

void RFID()
{
    if(Rfid.available() >0 ){
   //while(Rfid.available() > 0 )
   //{
    //delay(50);

    if(decide == -1)
  {
      for (int z = 0; z < 14; z++)
      {
       id = Rfid.read();
       idnum[z]= id;
       radio.write(idnum,z);
       Serial.print(idnum[z]);
      Serial.print(" ");
          
      }
      Serial.println(); 
      decide=0; 
      delay(50);
 }
  else
  {
   decide = -1;
    delay(50);
  }
 Rfid.flush();
}
//}
}

RX

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(6, 7); // CE, CSN
const byte address[6] = "00001";
int idnum[14]={0};


void setup() {
 Serial.begin(9600);
 
 radio.begin();
 radio.openReadingPipe(0, address);
 radio.setPALevel(RF24_PA_MIN);
 radio.startListening();
}
void loop() {
 if (radio.available()) {
    for (int z = 0; z < 14; z++)
   {
     radio.read(idnum,z);
     Serial.print(idnum[z]);
     Serial.print(" ");
     delay(50);
   }
   Serial.println();
 }
 delay(50);

}

…R

Don't send the array element by element. Send the complete array (assuming it does not exceed 32 bytes) as a single message.

Have a look at the examples in this Simple nRF24L01+ Tutorial

Don't have any delay()s in the Receiver - it should be listening all the time. manage the timing in the Transmitter

...R

sorry because u have to download it. its my first time using this forum.

i have try to send the complete array and its work but it only one array data at a time.
is it possible for the to transfer all set of array at a time.

example: int IDnumber[14]= {2,49,57,48,48,52,52,50,52,53,57,50,48,3}.

this is the number read from the rfid reader and i store it in array IDnumber. i want to transfer all the 14 data in the array at a time to the other arduino using the nrf24l01. is it possible? because u say cant transfer element by element.

beginneruser:
is it possible for the to transfer all set of array at a time.

example: int IDnumber[14]= {2,49,57,48,48,52,52,50,52,53,57,50,48,3}.

That should be possible. An array of 14 ints is 28 bytes long and an nRF24 message is a max of 32 bytes

You could try

radio.write(&IDnumber, sizeof(IDnumber));

and you need a matching array in the receiver program.

If that does not help then please post the program that represents your best attempt and tell us in detail what it actually does and what you want it to do that is different. Then we can focus on the parts you need help with rather than wasting time on things that you can do.

...R