Help needed with MFCR522 and Sim900 communication

So I am trying to use both the MCFCR522 and the sim900 to develop a project so the when I use a NFC tag I will receive an SMS saying that I have been clocked in. But when I upload the command to the arduino there are no errors and no output also. I tried it in the void setup statement but I cannot read the NFC tags since it runs the program only once.

So my questions are do both the modules work together ? they work well separately so is this some kind of compatibility issue ? or Am I missing something entirely ?

The code that I am using is :

void setup() 
{
  //Begin serial communication between board and the IDE
  Serial.begin(9600);   
  SPI.begin();
  //Start coms with the mfrc522 module
  mfrc522.PCD_Init();
  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);

  Serial.println("Initializing..."); 
  delay(1000);
  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();
  Serial.println("Approximate your card to the reader...");
  Serial.println();

}

void loop() 
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }

  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "A3 03 A7 1D") 
  {
    Serial.println("Authorized access");
    mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
    updateSerial();
    mySerial.println("AT+CMGS=\"xxxxxxxxxx\"");//change Z xxxxxxxxxxx with phone number to sms
    updateSerial();
    mySerial.print(" Clocked in  ");
    updateSerial();
    mySerial.write(26);
    Serial.println();
    delay(3000);
  }
 
 else  if(content.substring(1) == "A3 48 E3 1B") {
      Serial.println("Authorized access");
    mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
    updateSerial();
    mySerial.println("AT+CMGS=\"xxxxxxxxxx\"");//change Z xxxxxxxxxxx with phone number to sms
    updateSerial();
    mySerial.print(" Clocked in  ");
    updateSerial();
    mySerial.write(26);
    Serial.println();
    delay(3000);
  }
  else{
    Serial.println("Please Try again");
  }
} 

//Serial to check if there is any incoming signal to the arduino from GSM module

void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

does nothing appear on the serial monitor? even "Initializing..."
upload a copy of the serial monitor output
what Arduino board are you using?
what is mySerial? SoftwareSerial, AltSoftSerial, Hardware serial, ?
upload a schematic showing the wiring?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.