Adding aditional RFID cards

I am doing a Arduino project for developing a low cost bus tracking system using nodemcu esp8266 and rfid rc522. But i am unable to read additional cards. 3 additional card i have brought for this with numbers 0012686088(193,37640),0013678254(208,46766),0009881374(150,50974).

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN D2 //–> SDA / SS is connected to pinout D2
#define RST_PIN D1 //–> RST is connected to pinout D1
MFRC522 mfrc522(SS_PIN, RST_PIN); //–> Create MFRC522 instance.
byte readcard[4];
char str[32] = “”;
String StrUID;
int Led_OnBoard = 2; // Initialize the Led_OnBoard

const char* ssid = “rkm”; // Your wifi Name
const char* password = “”; // Your wifi Password

const char *host = “”; //Your pc or server (database) IP, example : , if you are a windows os user, open cmd, then type ipconfig then look at IPv4 Address.

void setup() {
// put your setup code here, to run once:
pinMode(Led_OnBoard, OUTPUT); // Initialize the Led_OnBoard pin as an output
WiFi.mode(WIFI_OFF); //Prevents reconnection issue (taking too long to connect)
WiFi.mode(WIFI_STA); //This line hides the viewing of ESP as wifi hotspot

WiFi.begin(ssid, password); //Connect to your WiFi router

// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
digitalWrite(Led_OnBoard, LOW);
digitalWrite(Led_OnBoard, HIGH);

digitalWrite(Led_OnBoard, HIGH);
//If connection successful show IP address in serial monitor
Serial.println(“Connected to Network/SSID”);
Serial.print("IP address: ");
Serial.println(WiFi.localIP()); //IP address assigned to your ESP

void loop() {
int readsuccess = getid();

// put your main code here, to run repeatedly:
HTTPClient http; //Declare object of class HTTPClient
String LdrValueSend, postData;
int ldrvalue=analogRead(A0); //Read Analog value of LDR
LdrValueSend = String(ldrvalue); //String to interger conversion

//Post Data
postData = “ldrvalue=” + LdrValueSend;

http.begin(“”); //Specify request destination
http.addHeader(“Content-Type”, “application/x-www-form-urlencoded”); //Specify content-type header

int httpCode = http.POST(postData); //Send the request
String payload = http.getString(); //Get the response payload

//Serial.println(“LDR Value=” + ldrvalue);
Serial.println(httpCode); //Print HTTP return code
Serial.println(payload); //Print request response payload
Serial.println(“LDR Value=” + LdrValueSend);

http.end(); //Close connection
int getid() {
if(!mfrc522.PICC_IsNewCardPresent()) {
return 0;
if(!mfrc522.PICC_ReadCardSerial()) {
return 0;

Serial.print("THE UID OF THE SCANNED CARD IS : ");

for(int i=0;i<4;i++){
readcard_=mfrc522.uid.uidByte*; //storing the UID of the tag in readcard*_
* array_to_string(readcard, 4, str);
StrUID = str;_
return 1;_
//----------------------------------------Procedure to change the result of reading an array UID into a string------------------------------------------------------------------------------//_
void array_to_string(byte array[], unsigned int len, char buffer[]) {
for (unsigned int i = 0; i < len; i++)_
_ byte nib1 = (array >> 4) & 0x0F;
byte nib2 = (array >> 0) & 0x0F;
buffer[i*2+0] = nib1 < 0xA ? ‘0’ + nib1 : ‘A’ + nib1 - 0xA;
buffer[i*2+1] = nib2 < 0xA ? ‘0’ + nib2 : ‘A’ + nib2 - 0xA;
buffer[len2] = ‘\0’;


Edit your post and insert code tags!

But i am unable to read additional cards.

A description of that problem would help us to help you.