Issue with SIM808 and reader RFID RC522

We have a big problème to make function my GPS “SIM808 Module” and read my TAG RFID “MRC522”
together.

I can make function well both of them separated but together i can only read a TAG RFID.

I used arduino MEGA 2560 attached to :

  • SIM808 with UART serial2
  • MRC522 with SPI
  • DHT11 to Pin 4

I want when i read a TAG RFID, I GET the UID, GPS location

My code

#include <DFRobot_sim808.h>
#include <dht11.h>
#include <SPI.h>
#include <RFID.h> 

DFRobot_SIM808 sim808(&Serial2);//Connect RX,TX,PWR,

#define DHT11PIN 4 // broche DATA -> broche 4
dht11 DHT11;

#define SS_PIN 53
#define RST_PIN 5
RFID rfid(SS_PIN, RST_PIN); 

// Setup variables:
    int serNum0;
    int serNum1;
    int serNum2;
    int serNum3;
    int serNum4;

int delais=30000;
int heure;

void setup()
{
  Serial2.begin(9600);
  Serial.begin(9600);
  SPI.begin(); 
  rfid.init();
   
  //******** Initialize sim808 module *************

  delay(3000);

  if( sim808.attachGPS())
      Serial.println("Open the GPS power success");
  else 
      Serial.println("Open the GPS power failure");
    }

  void loop() {

      if (rfid.isCard()) {
        if (rfid.readCardSerial()) {
                         /* With a new cardnumber, show it. */

                serNum0 = rfid.serNum[0];
                serNum1 = rfid.serNum[1];
                serNum2 = rfid.serNum[2];
                serNum3 = rfid.serNum[3];
                serNum4 = rfid.serNum[4];
               
                //Serial.println(" ");
                Serial.println(F("Un colis a été détecté"));
                Serial.print(F("Identité du colis : "));
                 Serial.print(rfid.serNum[0],HEX);
                Serial.print(rfid.serNum[1],HEX);
                Serial.print(rfid.serNum[2],HEX);
                Serial.print(rfid.serNum[3],HEX);
                Serial.print(rfid.serNum[4],HEX);
                Serial.println(" ");

                  //************** Get GPS data *******************
   if (sim808.getGPS()) {
    Serial.print(sim808.GPSdata.day);
    Serial.print("/");
    Serial.print(sim808.GPSdata.month);
    Serial.print("/");
    Serial.print(sim808.GPSdata.year);
    Serial.print("\n");
    heure=sim808.GPSdata.hour+1;
    Serial.print(heure);
    Serial.print(":");
    Serial.print(sim808.GPSdata.minute);
    Serial.print(":");
    Serial.print(sim808.GPSdata.second);
    Serial.print("\n");
    Serial.print("latitude :");
    Serial.println(sim808.GPSdata.lat,6);
    sim808.latitudeConverToDMS();
    Serial.print("latitude :");
    Serial.print(sim808.latDMS.degrees);
    Serial.print("\^");
    Serial.print(sim808.latDMS.minutes);
    Serial.print("\'");
    Serial.print(sim808.latDMS.seconeds,6);
    Serial.println("\"");
    Serial.print("longitude :");
    Serial.println(sim808.GPSdata.lon,6);
    sim808.LongitudeConverToDMS();
    Serial.print("longitude :");
    Serial.print(sim808.longDMS.degrees);
    Serial.print("\^");
    Serial.print(sim808.longDMS.minutes);
    Serial.print("\'");
    Serial.print(sim808.longDMS.seconeds,6);
    Serial.println("\"");
    Serial.print("speed_kph :");
    Serial.println(sim808.GPSdata.speed_kph);
    
      DHT11.read(DHT11PIN);
      Serial.print("Humidité (%): ");
      Serial.print((float)DHT11.humidity, 2);
      Serial.print("\n");
      Serial.print("Température (°C): ");
      Serial.println((float)DHT11.temperature, 2);   
          
     }
    
             } 
          } 
  
}

I think you need a sim808.init() in setup().

cattledog:
I think you need a sim808.init() in setup().

I had tested without sim808.init() and he worked well we can get our position GPS.

But when we put the module SIM808 with RFID-RC522 we can't get any thinks only l'UID of TAG.

Please don’t double post in two languages