Operating conflict between GPS and RFID reader

Good evening

I am currently working on a project that will allow me to keep track of it at a distance from certain objects.

My equipment:

  • Arduino mega 2560
  • SIM808 GSM / GPS / GPRS EVB-V3.2.4
  • RFID-RC522
  • DHT11

I use the following links:

  • UART serial link with SIM808: serial2 17 (RX), 16 (TX) and the library DFRobot_SIM808
  • SPI link with RFID-RC522: RST_PIN 5 and SS_PIN 53 and the RFID and SPI libraries
  • Pin 4 with DHT11

I tested each module separately and they are all functional (Display of GPS positions / TAG RFID reader / temperature / humidity), my problems start when I try to make the GPS work with the RFID reader together I can read UID tags RFID but the GPS no longer works.
I have done several research and some people talk about a conflict between the UART protocol and the SPI, personally I will not know what to do.

Knowing that my objective is that when reading an RFID TAG I recover the UID / GPS coordinates / TEMP / HUMI.

My code is as follows:

#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);   
          
     }
    
             } 
          } 
  
}

You have worked in the best way, running each subsystem one by one. Suppose You remove the RFID and run the Arduino mega 2560, SIM808 GSM / GPS / GPRS EVB-V3.2.4 and the DHT11. Does that work?

Railroader:
You have worked in the best way, running each subsystem one by one. Suppose You remove the RFID and run the Arduino mega 2560, SIM808 GSM / GPS / GPRS EVB-V3.2.4, and the DHT11. Does that work?

Thanks, Railroader for your replay

Yes that’s right Arduino mega 2560 worked well with SIM808 and DHT11, we can have the position of GPS and temperature/humidity as well as Arduino with RFID we can have the UID TAG.

but when I tried to make them together the SIM808 and DHT11 didn’t work we can only read the UID TAG.

Let's see if I understand You.
Does Mega+SIM808+DHT11 work together?
It looks like a collision. Subsystems use some common resource, interrupt, pin, timer..... The RFID competes/collides/knocks out both of SIM808 and DHT11.

Let's hope some more knowing helper is reading this and steps in. It's above my knowledge to point out the fault.

Railroader:
Let's see if I understand You.
Does Mega+SIM808+DHT11 work together?
It looks like a collision. Subsystems use some common resource, interrupt, pin, timer..... The RFID competes/collides/knocks out both of SIM808 and DHT11.

Let's hope some more knowing helper is reading this and steps in. It's above my knowledge to point out the fault.

Mega+SIM808+DHT11 work together
Mega+RFID+DHT11 work together
but Mega+SIM808+RFID+DHT11 only the RFID work

How about Mega+ RFID + SIM808?