serial monitor showing the connected networkI am replicating a project that will read the RFID card or tag data, store that into a mysql database and display the data via PHP.

I am using NodeMCU, RC522 RFID reader and Ardunio IDE to do that.

Below is the Arduino code. It successfully connects with WiFi (that I can see via serial monitor) but gives no response when I touch the RFID card to the reader and there is no display of the card UID in the PHP web app.

I can't find the error. The owner of the project suggested that the nodeMCU might be faulty which isn't the case and now i am at loss. Please help.

//NodeMCU and RFID libraries--------------------------
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN  D2  //D2
#define RST_PIN D1  //D1

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

/* Set these to your desired credentials. */
const char *ssid = "TECNO CAMON 15";
const char *password = "d6364e300f59";
const char* device_token  = " 4c9fc9995e7f9c6d ";

String URL = ""; //computer IP or the server domain
String getData, Link;
String OldCardID = "";
unsigned long previousMillis = 0;

void setup() {
  SPI.begin();  // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
  WiFi.mode(WIFI_OFF);        //Prevents reconnection issue (taking too long to connect)
    Serial.print("Connecting to ");
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());  //IP address assigned to your ESP
void loop() {
  if (millis() - previousMillis >= 15000) {
    previousMillis = millis();
  //look for new card
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;//got to start of loop if there is no card present
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;//if read card serial(0) returns 1, the uid struct contians the ID of the read card.
  String CardID ="";
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    CardID += mfrc522.uid.uidByte[i];
  if( CardID == OldCardID ){
    OldCardID = CardID;
//  Serial.println(CardID);
//************send the Card UID to the website*************
void SendCardID( String Card_uid ){
  Serial.println("Sending the Card ID");
    HTTPClient http;    //Declare object of class HTTPClient
    //GET Data
    getData = "?card_uid=" + String(Card_uid) + "&device_token=" + String(device_token); // Add the Card ID to the GET array in order to send it
    //GET methode
    Link = URL + getData;
    http.begin(Link); //initiate HTTP request   //Specify content-type header
    int httpCode = http.GET();   //Send the request
    String payload = http.getString();    //Get the response payload

//    Serial.println(Link);   //Print HTTP return code
    Serial.println(httpCode);   //Print HTTP return code
    Serial.println(Card_uid);     //Print Card ID
    Serial.println(payload);    //Print request response payload

    if (httpCode == 200) {
      if (payload.substring(0, 5) == "login") {
        String user_name = payload.substring(5);
    //  Serial.println(user_name);

      else if (payload.substring(0, 6) == "logout") {
        String user_name = payload.substring(6);
    //  Serial.println(user_name);
      else if (payload == "succesful") {

      else if (payload == "available") {

      http.end();  //Close connection
  • Can you get RFID to work without all the Wifi stuff? If you haven't tried, simplify everything down to a "blink"-like sketch for RFID, and debug that.
    – Mat
    Commented Nov 11, 2020 at 13:44
  • I have done the blink sketch and it works. The problem is when I connect it to the NODEMCU and want to scan the rfid card so that it registers on the php web app, nothing happens
    – Wayne 254
    Commented Nov 11, 2020 at 14:26
  • @Wayne254 please add the serial monitor messages to your post
    – jsotola
    Commented Nov 11, 2020 at 17:42
  • @jsotola I have added the serial monitor showing the connected network
    – Wayne 254
    Commented Nov 12, 2020 at 1:47
  • 1
    thanks ... no picture of text please ... some of us cannot see the picture ... add the actual text
    – jsotola
    Commented Nov 12, 2020 at 2:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.