A Digital Security Door Lock System with RFID: Enhancing Student Card (KTM) Capability for Door Unlock and Attendance Electrical Laboratorium based on IoT using NodeMCu 8266

Penelitian ini bertujuan untuk meningkatkan sistem keamanan suatu ruangan menggunakan RFID dan NodeMCu ESP8266 berbasis Internet of Thing’s sebagai media pengumpulan informasi yang dapat merekam jejak pengguna Laboratorium Teknik Elektro dengan memaksimalkan Kartu Tanda Mahasiswa sebagai akses masuk dan keluar. Sistem yang dirancang terdiri dari control circuit yang mengendalikan buka tutup pintu dengan dua lapis keamanan yaitu RFID dan Password, localhost web yang memantau, menampilkan dan merekam informasi status pengguna seperti membaca nomor kartu pengguna, nama, waktu masuk atau keluar, sehingga dapat meminimalisir kehilangan aset berharga didalam Laboratorium Teknik Elektro. Data informasi yang direkam terbagi menjadi 2 tempat penyimpan: 1). Google Spreadsheet sebagai 3rd platform IoT Clouds MQTT 2). Localhost xampp yang berada di PC Server.

Kata kunci :

Radio Frequency Identification,  NodeMCu ESP8266,  Internet of Thing’s, Google Spreadsheet, IoT Cloud MQTT, Localhost xampp.

0. Illustration
1. Dokumen
2. Alat / Bahan

3. Skematik Rangkaian

/* ---------------------------------------------------------------------------------------------------------------
 *  # File Name           : Access Control v3
 *  # TA Project          : Faiz Luthfi Nataiz
 *  # NIM                 : C1620201004
 *  # Judul TA            : A Digital Security Door Lock System
 *                          with RFID: Enhancing Student Card
 *                          (KTM) Capability for Door Unlock and
 *                          attendance Class based on IoT using
 *                          NodeMCu 8266
 *  # Deskripsi           : Perangkat elektronis yang digunakan untuk
 *                          absensi dan buka tutup pintu menggunakan
 *                          RFID dan fingerprint sensor. Dengan metode
 *                          MQTT dan OTA serta dapat diakses secara
 *                          localhost melalui penampil HMI touchscreen
 *                          panel (nextion 4.3 inch).
 *  
 *  Software Requirement
 *    - Arduino IDE v1.8.10
 *    - nextion setup v1.62.1
 *    - xampp x63 v3.2.4 Compiled Jun 5th 2019
 *    - 
 *  # Hardware Requirement
 *    - Input             : RFID MFRC522 China Clone
 *    - Output            : Nextion 4.3"
 *    - 3rd Platform      : Google Firebase, Google Spreadsheet
 *    - Methode           : OTA and MQTT
 *    - Aksesoris         : 5pcs LED 5mm as Indicator & Buzzer
 *                        : Relay Module 1 Ch
 *                        : RTC and Micro SD Card
 *  
 *  # Feature alat        :
 *    1. brightness (https://www.youtube.com/watch?v=AuFZNkD2osg)
 *    2. cek 4 led using hmi button (D0 ~ D8)
 *    3. showing network data (ip address and subnet mask)
 *    4. showing logbook record data RFID (absen hadir, pulang, istirahat/keluar)
 *    5. showing data
 *    
 *  # Editor              : Budhi Prayoga,ST,.M.Eng
 *  # Start Created       : 09.04.2020
 *  # Last Update         : 20.06.2021 | 18.06.2021 | 23.04.2021
 *  # Revisi              : 4.0
 *  # Version             : Beta
 *  # Platform            : 
 *    1. Hardware         : NodeMCu ESP8266 Lolin v3
 *    2. Core Version     :
 *    3. Development Env  : Arduino IDE 1.8.10
 *    4. Operating System : Win 7 x64
 *  # Library Version
 *    1. MFRC522 v1.4.4
 *    2. ESP8266 v2.5.2
 *    3. 
 *  # Setting in IDE  
 *    1. Module           : NodeMCu 1.0 (ESP-12E Module)
 *    2. Upload Speed     : 115200
 *    3. CPU Frequency    : 80MHz
 *    4. Flash Size       : 4M (No SPIFFS)
 *    5. Debug Port       : Disable
 *    6. Debug Level      : None
 *    7. lwIP Variant     : v2 Lower Memory
 *    8. VTable           : Flash
 *    9. Exception        : Disable
 *    10.EraseFlash       : Only Sketch
 *    11.SSL Support      : All SSL Chipher (more compatible)
 *    12.Programmer       : AVRISP mkII
 *    
 *  # Setting Preference in Arduino IDE
 *    File -> Preferences (Ctrl+Comma)
 *    1. Show verbose output : Compilation (check) and upload (Check)
 *    2. Display Line Number (Check)
 *    3. Enable Code Folding (Check)
 *    4. Additionals Board Manager Url
 *       https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
 *    5. Directory Preferences   
 *       C:\Users\User\AppData\Local\Arduino15\preferences.txt
 *   
 *  # Location
 *    1. Arduino : C:\Users\User\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\libraries
 *    2. ESP8266 : C:\Users\User\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266   
 * ---------------------------------------------------------------------------------------------------------------
 *  # Tutorial
 *    > Watch Dog
 *      0. WDT Timer Test Code Sample
 *         https://www.esp8266.com/viewtopic.php?p=57882#
 *         https://forum.makerforums.info/t/simple-watchdog-timer-a-simple-watchdog-timer-to-reset-the-esp8266-if-it-gets/56052/25
 *      1. Soft WDT Reset NodeMCu ESP8266 (google keyword : soft wdt reset esp8266 lolin)
 *         https://forum.arduino.cc/index.php?topic=442570.0
 *         https://community.blynk.cc/t/soft-wdt-reset/38353/4  Core v2.4.2
 *         https://github.com/miguelbalboa/rfid/issues/267      ESP SDK 2.1 or 2.2 / add a delay between SPI.begin() and init
 *      2. Theory (google keyword : watchdog esp8266 tutorial)   
 *         https://www.sigmdel.ca/michel/program/esp8266/arduino/watchdogs_en.html
 *         https://portal.vidadesilicio.com.br/watchdog-esp8266/
 *         https://github.com/esp8266/Arduino/pull/2533/files
 *         https://www.embedded.com/introduction-to-watchdog-timers/
 *         https://bigdanzblog.wordpress.com/2019/10/08/watch-dog-timer-wdt-for-esp8266/
 *         https://techtutorialsx.com/2017/01/21/esp8266-watchdog-functions/
 *      3. Disable WDT   
 *         https://www.esp8266.com/viewtopic.php?f=13&t=20206
 *      4. Reset Causes Boot Mode List
 *         https://www.esp8266.com/viewtopic.php?p=2096#p2112
 *    > RFID     
 *      1. What is RFID? How It Works? Interface RC522 RFID Module with Arduino
 *         https://lastminuteengineers.com/how-rfid-works-rc522-arduino-tutorial/
 *         https://circuits4you.com/2018/10/03/rfid-reader-rc522-interface-with-nodemcu-using-arduino-ide/
 *         https://www.hackster.io/mertarduino/access-control-system-everything-can-be-configured-via-web-1a4791
 *    > Nextion
 *      1. Basic Program
 *         https://acoptex.com/project/7069/basics-project-081d-esp8266-esp-12e-module-and-nextion-hmi-display-at-acoptexcom/
 *         https://acoptex.com/project/7069/basics-project-081d-esp8266-esp-12e-module-and-nextion-hmi-display-at-acoptexcom/
 *         https://randomnerdtutorials.com/nextion-display-with-esp8266-touchscreen-user-interface-for-node-red/
 *      2. Youtube
 *         NEXTION HMI DISPLAY WITH ARDUINO -Getting Started with LED ON/OFF
 *         https://www.youtube.com/watch?v=RbPfo8wW74I
 *      3. Install USB to TTL
 *         http://saptaji.com/2018/01/15/cara-menginstal-driver-usb-to-ttl-converter-pl2303/
 *         https://berbageilmu.blogspot.com/2017/05/solusi-driver-usb-pl2303-tidak-bisa-di.html
 *      4. Nextion TFT Touch Display Digital Clock v2.0 (Alarm Added) For NX4024K032_011 Nextion TFT
 *         https://www.youtube.com/watch?v=lOUyBH70O_w&t=0s
 *         GDrive : https://drive.google.com/drive/folders/1gAWsnSKJk_1CcJ7YAxWngYmkW97mF-_n
 *      5. Cara Print Out WiFi.localIP() di nextion
 *         https://forum.arduino.cc/t/how-to-print-out-the-esp-local-ip-on-nextion-display/597931/4
 *         https://circuits4you.com/2019/03/16/esp8266-ip-to-string-conversion/
 *    > SDK & Demos Espressif System
 *      https://github.com/espruino/Espruino/issues/1207
 *      https://www.espressif.com/en/support/download/sdks-demos?keys=&field_type_tid%5B%5D=14
 *    > Access Control Config via WEB
 *      https://www.hackster.io/mertarduino/access-control-system-everything-can-be-configured-via-web-1a4791
 *      https://github.com/esprfid/esp-rfid/releases
 *  # Library
 *    > MRFC522 1.4.4 :
 *    > Nextion 4.3   : https://github.com/itead/ITEADLIB_Arduino_Nextion
 *                      Make sure you edit the NexConfig.h file on the 
 *                      library folder to set the correct serial port for 
 *                      the display. By default it's set to Serial1, which 
 *                      most arduino boards don't have.
 *                      Change "#define nexSerial Serial1" to "#define nexSerial Serial"
 *  # Catatan :
 *    > Methode
 *      1. MQTT
 *      2. OTA
 *      3. xampp (web server apache dan database mysql
 *         CSS bootstrap, jquery, java script
 *         
 *    > Arduino Debugging
 *      1. https://www.circuito.io/blog/arduino-debugging/
 *      2. https://www.visualmicro.com/
 *      3. https://visualstudio.microsoft.com/downloads/
 *      4. https://docs.microsoft.com/en-us/visualstudio/releases/2019/system-requirements
 *      5. https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-Walkthrough-Start.html
 *    > Nextion Upload Data  
 *      Baudrate              : 115200
 *      Model                 : NX4827T043_011R(RTP)
 *      Firmware              : S151
 *      Device Serial Number  : D26670B15B253137
 *      CPUID                 : 61488
 *      Flash Size            : 16777216(16MB)
 *      Address               : 0
                                      +-----------+
  +-----------------------------------+ READ TAGS +-------------------------------------------+
  |                              +--------------------+                                     |
  |                              |                    |                                     |
  |                         +----v-----+        +-----v----+                                |
  |                         |MASTER TAG|        |OTHER TAGS|                                |
  |                         +--+-------+        ++-------------+                            |
  |                            |                 |             |                            |
  |                      +-----v---+        +----v----+   +----v------+                     |
  |         +------------+READ TAGS+---+    |KNOWN TAG|   |UNKNOWN TAG|                     |
  |         |            +-+-------+   |    +-----------+ +------------------+              |
  |         |              |           |                |                    |              |
  |    +----v-----+   +----v----+   +--v--------+     +-v----------+  +------v----+         |
  |    |MASTER TAG|   |KNOWN TAG|   |UNKNOWN TAG|     |GRANT ACCESS|  |DENY ACCESS|         |
  |    +----------+   +---+-----+   +-----+-----+     +-----+------+  +-----+-----+         |
  |                       |               |                 |               |               |
  |       +----+     +----v------+     +--v---+             |               +--------------->
  +-------+EXIT|     |DELETE FROM|     |ADD TO|             |                               |
          +----+     |  EEPROM   |     |EEPROM|             |                               |
                     +-----------+     +------+             +-------------------------------+


   Use a Master Card which is act as Programmer then you can able to choose card holders who will granted access or not

                                      PIN |GPIO | Actual Pin | Status
  
        static const uint8_t D0     = 16;     1 > D10 TX     x dipakai           LED 0 Indicator Upload + Reset
        static const uint8_t D1     = 5;      2 > D4         + dipakai           LED 1 Indicator Push Button when touched
        static const uint8_t D2     = 4;      3 > D9  RX     x dipakai           LED 2 Indicator Relay ON/OFF
        static const uint8_t D3     = 0;      4 > D2           dipakai           LED 3 Indicator LED + BUZZER
        static const uint8_t D4     = 2;      5 > D1           belum terpakai    
        static const uint8_t D5     = 14;     6 > x          x tidak ada         
        static const uint8_t D6     = 12;     7 > x          x tidak ada         
        static const uint8_t D7     = 13;     8 >            x tidak ada         
        static const uint8_t D8     = 15;     9 > S2         + belum terpakai
        static const uint8_t D9  RX = 3;     10 > S3         + belum terpakai
        static const uint8_t D10 TX = 1;     11 > x          x tidak ada
        static const uint8_t S1     = MOSI   12 > D6           dipakai           MFRC522 Biru   SPI MISO   
        static const uint8_t S2     = 9      13 > D7         + dipakai           MFRC522 Putih  SPI MOSI
        static const uint8_t S3     = 10     14 > D5           dipakai           MFRC522 Kuning SPI SCK    
                                             15 > D8         + dipakai           MFRC522 Hijau  SPI SDA / SS Pin 
                                             16 > D0         + dipakai           Buzzer
   
 Typical pin layout used:
 Source : https://github.com/miguelbalboa/rfid
 * ---------------------------------------------------------------------------------------------------------------------
 *             MFRC522      NodeMCu       Wemos D1 Mini Arduino       Arduino   Arduino    Arduino          Arduino 
 *             Reader/PCD   ESP8266       ESP9266       Mega          Nano v3   Leonardo   Pro Micro        Uno
 *                          Lolin v3                    Uno 101                 /Micro
 * Signal      Pin          Pin GPIO      Pin           Pin           Pin       Pin        Pin
 * ---------------------------------------------------------------------------------------------------------------------
 * RST/Reset   RST                        D3            9             5         D9         RESET/ICSP-5     RST
 * SPI SS      SDA(SS)      D8  (15)      D8            10            53        D10        10               10
 * SPI MOSI    MOSI         D7  (13)      D7            11 / ICSP-4   51        D11        ICSP-4           16
 * SPI MISO    MISO         D6  (12)      D6            12 / ICSP-1   50        D12        ICSP-1           14
 * SPI SCK     SCK          D5  (14)      D5            13 / ICSP-3   52        D13        ICSP-3           15
 * ---------------------------------------------------------------------------------------------------------------------
 */

//inisialisasi pin RFID MFRC522
#define SS_PIN 15    //D2
#define RST_PIN 10  //S3

#include "Nextion.h"
//#include <Nextion.h>  
#include <SPI.h>
#include <MFRC522.h>

#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>

MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
int statuss = 0;
int out = 0;

const int led0 = 16;    //D0 GPIO16 Indicator Upload + Reset  
const int ledPB = 5;    //D1 GPIO05 Indicator Push Button / Touch Button when pressed
const int relay = 4;    //D2 GPIO04 Relay
const int buzzer = 0;   //D3 GIPO 0 LED + Buzzer
const int btn = 2;      //D4 Micro Switch Push Button 2 pin in RFID Ext Module

//Network SSID
const char* ssid = "Budhi_Prayoga";
const char* password = "Yukihiro280588!";
//const char* ssid = "LAB_TE";
//const char* password = "innovation";

//pengenal host (server) = IP Address komputer server
const char* host = "192.168.100.20";

//Declare your Nextion objects , pageid, component id., component name
//Declare objects that we are going to read from the display. This includes buttons, sliders, text boxes, etc:
//Format: <type of object> <object name> = <type of object>(<page id>, <object id>, "<object name>");
/* ***** Types of objects:
 * NexButton - Button
 * NexDSButton - Dual-state Button
 * NexHotspot - Hotspot, that is like an invisible button
 * NexCheckbox - Checkbox
 * NexRadio - "Radio" checkbox, that it's exactly like the checkbox but with a rounded shape
 * NexSlider - Slider
 * NexGauge - Gauge
 * NexProgressBar - Progress Bar
 * NexText - Text box
 * NexScrolltext - Scroll text box
 * NexNumber - Number box
 * NexVariable - Variable inside the nextion display
 * NexPage - Page touch event
 * NexGpio - To use the Expansion Board add-on for Enhanced Nextion displays
 * NexRtc - To use the real time clock for Enhanced Nextion displays
 * *****
 */
/* ID Halaman, ID Objek, Nama Objek
 * ---------------------------------
 * 
 */
//                      (page, id, "objname");
NexButton b0 = NexButton(3,7,"b0");
NexButton b1 = NexButton(3,8,"b1");
NexText t0 = NexText(3,9,"t0");
NexText t1 = NexText(3,12,"t1");
NexNumber n0 = NexNumber(3, 11, "n0");    //ip address

String IPaddress;
int counter = 1;
int btnState = 0;

//Register a button object to the touch event list
//Format: &<object name>,

NexTouch *nex_listen_list[] = {
  &b0,    //button on
  &b1,    //button off
  &n0,    //number of ip address
  &t1,    //text of ip address
  //void MIFARE(),
  NULL    //String terminated
};

void setup(void) {
  Serial.begin(115200);
  SPI.begin();          // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522

  //Start inisialisasi koneksi WiFi
  WiFi.hostname("NodeMCU_Koko");
  WiFi.begin(ssid, password);

  //cek koneksi wifi
  while(WiFi.status() != WL_CONNECTED)
  {
    //progress sedang mencari WiFi
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Wifi Connected");
  Serial.print("IP Address : ");
  Serial.println(WiFi.localIP());
  //end inisialisasi koneksi WiFi
  
  Serial.println("ready");
  Serial.println("Initial Check LED Condition");
  delay(150);
  // inisialisasi pin input
  pinMode(btn, INPUT);      //D4 Micro Switch Push Button 2 pin in RFID Ext Module

  //inisialisasi pin output
  pinMode(led0,OUTPUT);     //D0 GPIO16 Indicator Upload + Reset  
  pinMode(ledPB,OUTPUT);    //D1 GPIO05 Indicator Push Button / Touch Button when pressed
  pinMode(relay,OUTPUT);    //D2 GPIO04 Relay
  pinMode(buzzer,OUTPUT);   //D3 GIPO 0 LED + Buzzer

  //
  digitalWrite(led0,HIGH);
  digitalWrite(ledPB,HIGH);
  digitalWrite(relay,HIGH);
  digitalWrite(buzzer,HIGH);
  delay(2000);
  digitalWrite(led0,LOW);
  digitalWrite(ledPB,LOW);
  digitalWrite(relay,LOW);
  digitalWrite(buzzer,LOW);

  Serial.println("LED Check Finish");
  delay(500);  
  //nexInit();
  
  //Register the pop event callback function of the components
  //b0.attachPop(b0PushCallback,&b0);
  //b1.attachPop(b1PushCallback,&b1);
  b0.attachPop(b0PopCallback,&b0);
  b1.attachPop(b1PopCallback,&b1);
  //n0.attachPop(n0PopCallback,&n0);
  //t1.attachPop(t1PopCallback,&t1);
  
  Serial.println("Dekatkan Kartu RFID Anda ke Reader");
  Serial.println();
  
}

void loop() {
  //nexLoop(nex_listen_list); // Check for any touch event
  //delay(150);                 //for stability
  //void MIFARE();
  //Look for new cards
  btnState = digitalRead(btn);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (btnState == LOW) {
    // turn LED on:
    Serial.println("");
    Serial.println("HIGH");
    digitalWrite(ledPB,HIGH);
    digitalWrite(relay,HIGH);
    digitalWrite(buzzer,HIGH);
    delay(150);
  } else {
    // turn LED off:
    digitalWrite(ledPB,LOW);
    digitalWrite(relay,LOW);
    digitalWrite(buzzer,LOW);
    delay(150);
  }
  
  int timeDelay = 10;
  while(timeDelay > 0)
  {
    if ( ! mfrc522.PICC_IsNewCardPresent()){
      return;
    }
    // Select one of the cards
    if ( ! mfrc522.PICC_ReadCardSerial()){
      return;
    }
    //Show UID on serial monitor
    Serial.println();
    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));
    }
    content.toUpperCase();
    Serial.println();
    if (content.substring(1) == "2D C7 E0 AF") //change UID of the card that you want to give access
    {
      Serial.println("t1.setText=" + String(mfrc522.uid.uidByte, HEX));
      //t1.setText("UID Card: 2DC7E0AF");
      Serial.println("");
      Serial.println(" Access Granted ");
      digitalWrite(buzzer,HIGH);
      delay(500);
      digitalWrite(buzzer,LOW);
      Serial.println();
      t1.setText("UID Card: 2DC7E0AF");
      statuss = 1;
      //Serial.println("n0.val=2D C7 E0 AF");
      //Serial.print("n0.val=" + String(counter));
      //Serial.println("t1.txt=2D C7 E0 AF");
      //t1.setText("UID Card: 2DC7E0AF");
      //Serial.print("t0.txt=" + String(IPaddress));
      //Serial.write(0xff);
      //Serial.write(0xff);
      //Serial.write(0xff);
      counter++;
    }
    
    else{
      Serial.println(" Access Denied ");
      buzz();
    }
    delay(150);
  }
   
}

void buzz(){
  for (int a=0; a<6; a++)
  {
    digitalWrite(buzzer,HIGH);
    delay(50);
    digitalWrite(buzzer,LOW);
    delay(50);
  }
}

void MIFARE(){
  //nexLoop(nex_listen_list);
  //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.println();
  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));
  }
  content.toUpperCase();
  Serial.println();
  if (content.substring(1) == "2D C7 E0 AF") //change UID of the card that you want to give access
  {
    Serial.println(" Access Granted ");
    digitalWrite(led3,HIGH);
    delay(1000);
    digitalWrite(led3,LOW);
    Serial.println();
    statuss = 1;
  }
  
  else{
    Serial.println(" Access Denied ");
    digitalWrite(led3,LOW);
    delay(1000);
  }*/
}

//Button b0 component popcallback function
//When ON button is Released the LED turns ON and the state text changes
//void b0PushCallback(void *ptr)  // Press event for button b1

/*void b0PushCallback(void *ptr)   // push event for button b0
{
  //t0.setText ("Status: ON");  
  digitalWrite(led,HIGH);
  Serial.println("LED ON");
  Serial.println("b0PushCallback");
}

void b1PushCallback(void *ptr)   // push event for button b0
{
  //t0.setText ("Status: ON");  
  digitalWrite(led, LOW);
  Serial.println("LED OFF");
  Serial.println("b1PushCallback");
}*/

void b0PopCallback(void *ptr){   // Release event for button b0
  //t0.setText ("Status: ON");  
  digitalWrite(led0,HIGH);
  digitalWrite(ledPB,HIGH);
  digitalWrite(relay,HIGH);
  digitalWrite(buzzer,HIGH);
  Serial.println("LED ON");
  Serial.println("b0PopCallback");
}

//Button b1 component popcallback function
// When OFF button is released the LED turns OFF and the state text changes

void b1PopCallback(void *ptr){     // Release event for button b1
  //void b1PushCallback(void *ptr)   // Release event for button b1
  //t0.setText ("Status: OFF");
  digitalWrite(led0,LOW);
  digitalWrite(ledPB,LOW);
  digitalWrite(relay,LOW);
  digitalWrite(buzzer,LOW);
  Serial.println("LED OFF");
  Serial.println("b1PopCallback");
}

/*void n0PopCallback(void *ptr){
  //IPaddress =  WiFi.localIP().toString();
  
  //n0.setValue(WiFi.localIP());
  //Serial.println("n0.val=" + String(IPaddress));
  //dbSerialPrintln("n0PopCallback");
  //n0.setValue(50);
  
  //Serial.print("n0.val=2D C7 E0 AF");
  //Serial.print("t1.txt=2D C7 E0 AF");
  //Serial.write(0xff);
  //Serial.write(0xff);
  //Serial.write(0xff);
}

void t1PopCallback(void *ptr){
  //Serial.print("n0.val=2D C7 E0 AF");
  //Serial.print("t1.txt=2D C7 E0 AF");
  //Serial.write(0xff);
  //Serial.write(0xff);
  //Serial.write(0xff);
  
  //t1.setText(WiFi.localIP());
  //Serial.println("t1.setText=" + String(IPaddress));
  //dbSerialPrintln("n0PopCallback");
  //n0.setValue(50);
}*/

4. Galeri

5. Video Demo