Skip to content

Commit

Permalink
add support for RDM6300 125KHz RFID reader (esprfid#163)
Browse files Browse the repository at this point in the history
* add support for RDM6300 125KHz RFID reader

I also wrote a simple library to interface with the RDM6300 RFID reader:
https://github.com/arduino12/rdm6300

* move setupRdm6300Reader to only non-OFFICIALBOARD compilation
  • Loading branch information
arduino12 authored and omersiar committed Sep 24, 2018
1 parent cff8391 commit f9dba8a
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 28 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ESP RFID - Access Control with ESP8266, RC522 PN532 Wiegand
# ESP RFID - Access Control with ESP8266, RC522 PN532 Wiegand RDM6300

[![Chat at https://gitter.im/esp-rfid/Lobby](https://badges.gitter.im/esp-rfid.svg)](https://gitter.im/esp-rfid/Lobby) [![Build Status](https://travis-ci.org/omersiar/esp-rfid.svg?branch=stable)](https://travis-ci.org/omersiar/esp-rfid) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fc424f75d12644da8b6fe248a5e95157)](https://www.codacy.com/app/omersiar/esp-rfid?utm_source=github.com&utm_medium=referral&utm_content=omersiar/esp-rfid&utm_campaign=Badge_Grade) [![Bountysource](https://api.bountysource.com/badge/team?team_id=242217)](https://salt.bountysource.com/checkout/amount?team=esp-rfid)

Access Control system using a cheap MFRC522, PN532 RFID readers or Wiegand RFID readers and Espressif's ESP8266 Microcontroller.
Access Control system using a cheap MFRC522, PN532 RFID, RDM6300 readers or Wiegand RFID readers and Espressif's ESP8266 Microcontroller.

[See Demo Here](https://bitadvise.com/esp-rfid/)

Expand Down Expand Up @@ -54,7 +54,7 @@ This project still in its development phase. New features (and also bugs) are in
* [Official ESP-RFID Relay Board](https://www.tindie.com/products/nardev/esp-rfid-relay-board-12v-in-esp8266-board/)
or
* An ESP8266 module or a development board like **WeMos D1 mini** or **NodeMcu 1.0** with at least **32Mbit Flash (equals to 4MBytes)** (ESP32 does not supported for now)
* A MFRC522 RFID PCD Module or PN532 NFC Reader Module or Wiegand based RFID reader
* A MFRC522 RFID PCD Module or PN532 NFC Reader Module or RDM6300 125KHz RFID Module Wiegand based RFID reader
* A Relay Module (or you can build your own circuit)
* n quantity of Mifare Classic 1KB (recommended due to available code base) PICCs (RFID Tags) equivalent to User Number

Expand Down Expand Up @@ -109,15 +109,16 @@ Get more information here: https://stackoverflow.com/questions/3102819/disable-s

### Pin Layout

The following table shows the typical pin layout used for connecting MFRC522 hardware to ESP:
The following table shows the typical pin layout used for connecting readers hardware to ESP:

| Signal | PN532 | MFRC522 | WeMos D1 mini | NodeMcu | Generic |
|---------------|:-------------:|:-------------:|:--------------:|:-------:|:------------:|
| RST/Reset | RST | RST | N/C [1] | N/C [1] | N/C [1] |
| SPI SS | SS | SDA [3] | D8 [2] | D8 [2] | GPIO-15 [2] |
| SPI MOSI | MOSI | MOSI | D7 | D7 | GPIO-13 |
| SPI MISO | MISO | MISO | D6 | D6 | GPIO-12 |
| SPI SCK | SCK | SCK | D5 | D5 | GPIO-14 |
| Signal | PN532 | MFRC522 | RDM6300 | WeMos D1 mini | NodeMcu | Generic |
|-----------|:-----:|:-------:|:-------:|:-------------:|:-------:|:-----------:|
| RST/Reset | RST | RST | N/C | N/C [1] | N/C [1] | N/C [1] |
| SPI SS | SS | SDA [3] | N/C | D8 [2] | D8 [2] | GPIO-15 [2] |
| SPI MOSI | MOSI | MOSI | N/C | D7 | D7 | GPIO-13 |
| SPI MISO | MISO | MISO | N/C | D6 | D6 | GPIO-12 |
| SPI SCK | SCK | SCK | N/C | D5 | D5 | GPIO-14 |
| SPI SCK | SCK | SCK | TX | D4 | D4 | GPIO-02 |

1. Not Connected. Hard-reset no longer needed.
2. Configurable via settings page.
Expand Down Expand Up @@ -199,6 +200,7 @@ Thanks to the community, ESP-RFID come to alive with their great effort:
- @zeraien
- @nardev
- @romanzava
- @arduino12

See [ChangeLog](https://github.com/omersiar/esp-rfid/blob/dev/CHANGELOG.md)

Expand Down
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ lib_deps =
MFRC522
https://github.com/monkeyboard/Wiegand-Protocol-Library-for-Arduino.git
Time
rdm6300

; boards which GPIO0 and RESET controlled using two NPN transistors as nodemcu devkit (includes wemos d1 mini)
[env:generic]
Expand Down
3 changes: 3 additions & 0 deletions src/config.esp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ bool ICACHE_FLASH_ATTR loadConfiguration() {
} else if (readerType == 2) {
rfidss = hardware["sspin"];
setupPN532Reader(rfidss);
} else if (readerType == 3) {
int rxpin = hardware["rxpin"];
setupRdm6300Reader(rxpin);
}
#endif
autoRestartIntervalSeconds = general["restart"];
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ int relayPin = 13;
#include <MFRC522.h>
#include "PN532.h"
#include <Wiegand.h>
#include <rdm6300.h>

MFRC522 mfrc522 = MFRC522();
PN532 pn532;
WIEGAND wg;
Rdm6300 rdm6300;

int rfidss;
int readerType;
Expand Down
15 changes: 15 additions & 0 deletions src/rfid.esp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ void ICACHE_FLASH_ATTR rfidloop() {
delay(50);
return;
}
} else if (readerType == 3) {
if (rdm6300.update()) {
uid = String(rdm6300.get_tag_id(), HEX);
#ifdef DEBUG
Serial.print(F("[ INFO ] PICC's UID: "));
Serial.print(uid);
#endif
} else {
delay(50);
return;
}
} else {
delay(50);
return;
Expand Down Expand Up @@ -232,6 +243,10 @@ void ICACHE_FLASH_ATTR setupMFRC522Reader(int rfidss, int rfidgain) {
ShowMFRC522ReaderDetails(); // Show details of PCD - MFRC522 Card Reader details
#endif
}

void ICACHE_FLASH_ATTR setupRdm6300Reader(int rx) {
rdm6300.begin(rx);
}
#endif

#ifndef OFFICIALBOARD
Expand Down
16 changes: 8 additions & 8 deletions src/webh/esprfid.htm.gz.h

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/webh/esprfid.js.gz.h

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/websrc/esprfid.htm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ <h6 class="text-muted">Please refer the <a href="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/omersiar/esp
<option selected="selected" value="0">MFRC522</option>
<option value="1">Wiegand</option>
<option value="2">PN532</option>
<option value="3">RDM6300</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -195,6 +196,25 @@ <h6 class="text-muted">Please refer the <a href="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/omersiar/esp
</span>
</div>
</div>
<div class="" id="rdm6300Form" style="display:none">
<div class="row form-group">
<label class="col-xs-3">RDM6300 RX<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right" data-content="Choose which ESP pin is connected to RFID Hardware RX pin"></i></label>
<span class="col-xs-9 col-md-5">
<select class="form-control input-sm" id="rxpin">
<option value="0">GPIO-0</option>
<option value="1">GPIO-1</option>
<option selected="selected" value="2">GPIO-2</option>
<option value="4">GPIO-4</option>
<option value="5">GPIO-5</option>
<option value="12">GPIO-12</option>
<option value="13">GPIO-13</option>
<option value="14">GPIO-14</option>
<option value="15">GPIO-15</option>
<option value="16">GPIO-16</option>
</select>
</span>
</div>
</div>
<br>
<div class="row form-group">
<label class="col-xs-3">Relay Type<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right" data-content="Depending on your electrical setup, you can choose the relay type"></i></label>
Expand Down
13 changes: 13 additions & 0 deletions src/websrc/js/esprfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var config = {
"readerType": 1,
"wgd0pin": 4,
"wgd1pin": 5,
"rxpin": 2,
"sspin": 0,
"rfidgain": 32,
"rtype": 1,
Expand Down Expand Up @@ -95,13 +96,21 @@ function handleReader() {
document.getElementById("wiegandForm").style.display = "none";
document.getElementById("mfrc522Form").style.display = "block";
document.getElementById("rc522gain").style.display = "block";
document.getElementById("rdm6300Form").style.display = "none";
} else if (parseInt(document.getElementById("readerType").value) === 1) {
document.getElementById("wiegandForm").style.display = "block";
document.getElementById("mfrc522Form").style.display = "none";
document.getElementById("rdm6300Form").style.display = "none";
} else if (parseInt(document.getElementById("readerType").value) === 2) {
document.getElementById("wiegandForm").style.display = "none";
document.getElementById("mfrc522Form").style.display = "block";
document.getElementById("rc522gain").style.display = "none";
document.getElementById("rdm6300Form").style.display = "none";
} else if (parseInt(document.getElementById("readerType").value) === 3) {
document.getElementById("wiegandForm").style.display = "none";
document.getElementById("mfrc522Form").style.display = "none";
document.getElementById("rc522gain").style.display = "none";
document.getElementById("rdm6300Form").style.display = "block";
}
}

Expand All @@ -119,9 +128,11 @@ function listhardware() {
document.getElementById("readerType").value = 1;
document.getElementById("wg0pin").value = 5;
document.getElementById("wg1pin").value = 4;
document.getElementById("rxpin").value = 2;
document.getElementById("gpiorly").value = 13;
document.getElementById("wg0pin").disabled = true;
document.getElementById("wg1pin").disabled = true;
document.getElementById("rxpin").disabled = true;
document.getElementById("gpiorly").disabled = true;
document.getElementById("readerType").disabled = true;
document.getElementById("typerly").value = config.hardware.rtype;
Expand All @@ -131,6 +142,7 @@ function listhardware() {
document.getElementById("readerType").value = config.hardware.readerType;
document.getElementById("wg0pin").value = config.hardware.wgd0pin;
document.getElementById("wg1pin").value = config.hardware.wgd1pin;
document.getElementById("rxpin").value = config.hardware.rxpin;
document.getElementById("gpioss").value = config.hardware.sspin;
document.getElementById("gain").value = config.hardware.rfidgain;
document.getElementById("typerly").value = config.hardware.rtype;
Expand Down Expand Up @@ -176,6 +188,7 @@ function savehardware() {
config.hardware.readerType = parseInt(document.getElementById("readerType").value);
config.hardware.wgd0pin = parseInt(document.getElementById("wg0pin").value);
config.hardware.wgd1pin = parseInt(document.getElementById("wg1pin").value);
config.hardware.rxpin = parseInt(document.getElementById("rxpin").value);
config.hardware.sspin = parseInt(document.getElementById("gpioss").value);
config.hardware.rfidgain = parseInt(document.getElementById("gain").value);
config.hardware.rtype = parseInt(document.getElementById("typerly").value);
Expand Down

0 comments on commit f9dba8a

Please sign in to comment.