Jumat, 17 Mei 2019

login dan logout windows pakai Id Card

Assalamu'alaikum

beberapa hari ini banyak posting tentang arduino + rfid + ektp buat login pc. tapi kali saya memanfaatkan idcard tempat saya bekerja untuk login dan logout windows.

langsung saja, kumpulkan material yang digunakan:
1. arduino pro micro
2. rfid RC522
3. id card yang ada chipnya. bisa pkai ektp atau emoney
4. kabel jumper
5. resistor 10k = 3 buah

wiring seperti dibawah ini:
sumber: https://create.arduino.cc/projecthub/kksjunior/windows-pc-lock-unlock-using-rfid-5021a6

wiring diatas saya modif dikit, 3,3v saya ganti vcc di pro micro





masukin library:
library

cek id number card dulu dengan upload sket dibawah ini:
#include <MFRC522.h>
#include <SPI.h>

#define SAD 10
#define RST 5

MFRC522 nfc(SAD, RST);

void setup() {
  SPI.begin();
  // Read a fast as possible. There is a limit for how long we are
  // allowed to read from the tags.
  Serial.begin(115200);

  Serial.println("Looking for MFRC522.");
  nfc.begin();

  // Get the firmware version of the RFID chip
  byte version = nfc.getFirmwareVersion();
  if (! version) {
    Serial.print("Didn't find MFRC522 board.");
    while(1); //halt
  }

  Serial.print("Found chip MFRC522 ");
  Serial.print("Firmware ver. 0x");
  Serial.print(version, HEX);
  Serial.println(".");
}

byte keyA[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, };
byte keyB[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, };

void loop() {
  byte status;
  byte data[MAX_LEN];
  byte serial[5];
  int i, j, pos;

  // Send a general request out into the aether. If there is a tag in
  // the area it will respond and the status will be MI_OK.
  status = nfc.requestTag(MF1_REQIDL, data);

  if (status == MI_OK) {
    Serial.println("Tag detected.");
    Serial.print("Type: ");
    Serial.print(data[0], HEX);
    Serial.print(", ");
    Serial.println(data[1], HEX);

    // calculate the anti-collision value for the currently detected
    // tag and write the serial into the data array.
    status = nfc.antiCollision(data);
    memcpy(serial, data, 5);

    Serial.println("The serial nb of the tag is:");
    for (i = 0; i < 3; i++) {
      Serial.print(serial[i], HEX);
      Serial.print(", ");
    }
    Serial.println(serial[3], HEX);

    // Select the tag that we want to talk to. If we don't do this the
    // chip does not know which tag it should talk if there should be
    // any other tags in the area..
    nfc.selectTag(serial);

    // Assuming that there are only 64 blocks of memory in this chip.
    for (i = 0; i < 64; i++) {
      // Try to authenticate each block first with the A key.
      status = nfc.authenticate(MF1_AUTHENT1A, i, keyA, serial);
      if (status == MI_OK) {
        Serial.print("Authenticated block nb. 0x");
        Serial.print(i, HEX);
        Serial.println(" with key A.");
        // Reading block i from the tag into data.
        status = nfc.readFromTag(i, data);
        if (status == MI_OK) {
          // If there was no error when reading; print all the hex
          // values in the data.
          for (j = 0; j < 15; j++) {
            Serial.print(data[j], HEX);
            Serial.print(", ");
          }
          Serial.println(data[15], HEX);
        } else {
          Serial.println("Read failed.");
        }
      } else {
        // If we could not authenticate with the A key, we will try
        // the B key.
        status = nfc.authenticate(MF1_AUTHENT1B, i, keyB, serial);
        if (status == MI_OK) {
          Serial.print("Authenticated block nb. 0x");
          Serial.print(i, HEX);
          Serial.println(" with key B.");
          status = nfc.readFromTag(i, data);
          if (status == MI_OK) {
            for (j = 0; j < 15; j++) {
              Serial.print(data[j], HEX);
              Serial.print(", ");
            }
            Serial.println(data[15], HEX);
          } else {
            Serial.println("Read failed.");
          }
        } else {
          Serial.print("Access denied at block nb. 0x");
          Serial.println(i, HEX);
        }
      }
    }

    // Stop the tag and get ready for reading a new tag.
    nfc.haltTag();
  }
  delay(2000);
}

setelah sukses upload, jalankan serial monitor baudrate 9600
tap id cardnya
akan muncul sperti bawah ini:
Tag detected.
Type: 4, 0
The serial nb of the tag is:
84, ED, DE, 1E
Authenticated block nb. 0x0 with key A.
84, ED, DE, 1E, A9, 8, 4, 0, 62, 63, 64, 65, 66, 67, 68, 69
Authenticated block nb. 0x1 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x2 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x3 with key A.
0, 0, 0, 0, 0, 0, FF, 7, 80, 69, FF, FF, FF, FF, FF, FF
Authenticated block nb. 0x4 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x5 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x6 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x7 with key A.
0, 0, 0, 0, 0, 0, FF, 7, 80, 69, FF, FF, FF, FF, FF, FF
Authenticated block nb. 0x8 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x9 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0xA with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0xB with key A.
0, 0, 0, 0, 0, 0, FF, 7, 80, 69, FF, FF, FF, FF, FF, FF
Authenticated block nb. 0xC with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0xD with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0xE with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0xF with key A.
0, 0, 0, 0, 0, 0, FF, 7, 80, 69, FF, FF, FF, FF, FF, FF
Authenticated block nb. 0x10 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x11 with key A.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Authenticated block nb. 0x12 with key A.
Read failed.
Access denied at block nb. 0x13
Access denied at block nb. 0x14
Access denied at block nb. 0x15
Access denied at block nb. 0x16
Access denied at block nb. 0x17
Access denied at block nb. 0x18
Access denied at block nb. 0x19
Access denied at block nb. 0x1A
Access denied at block nb. 0x1B
Access denied at block nb. 0x1C
Access denied at block nb. 0x1D
Access denied at block nb. 0x1E
Access denied at block nb. 0x1F
Access denied at block nb. 0x20
Access denied at block nb. 0x21
Access denied at block nb. 0x22
Access denied at block nb. 0x23
Access denied at block nb. 0x24
Access denied at block nb. 0x25
Access denied at block nb. 0x26
Access denied at block nb. 0x27
Access denied at block nb. 0x28
Access denied at block nb. 0x29
Access denied at block nb. 0x2A
Access denied at block nb. 0x2B
Access denied at block nb. 0x2C
Access denied at block nb. 0x2D
Access denied at block nb. 0x2E
Access denied at block nb. 0x2F
Access denied at block nb. 0x30
Access denied at block nb. 0x31
Access denied at block nb. 0x32
Access denied at block nb. 0x33
Access denied at block nb. 0x34
Access denied at block nb. 0x35
Access denied at block nb. 0x36
Access denied at block nb. 0x37
Access denied at block nb. 0x38
Access denied at block nb. 0x39
Access denied at block nb. 0x3A
Access denied at block nb. 0x3B
Access denied at block nb. 0x3C
Access denied at block nb. 0x3D
Access denied at block nb. 0x3E
Access denied at block nb. 0x3F


berarti idcard anda terdetek idnumbernya:
84, ED, DE, 1E

masukkan id number di atas di koding dibawah ini

source code:
sketch arduino


jangan lupa ganti id card







Tidak ada komentar:

Posting Komentar

Frekwensi LoRa yang legal di Indonesia

 menurut kepmen 2024-05 standar teknis perangkat LPWAN berikut frekwensi LoRa : link KEPMEN: download