A library to read HID RFID cards through the wiegand protocol. This was tested with the HID ProxPoint Plus 6005BG00.

Dependents:   HID_ProxCard_Wiegand_Example

Wiegand Library for HID ProxPoint Plus

While this library should be able to read any wiegand input, the buffer can only store 64 bits, and it expects there to be less than a 5ms delay between each bit sent.

Here is a picture of some example wiring:

To use this library use the following pin attachments, the 6005BG00 has its pinouts on its back label (top right).

6005BG00 WireMBED PIN
data0p30
data1p29
holdp28
GNDGND
DRAINGND
5-16V (red)Vu

Here is a picuture of it wired up: /media/uploads/cbookman3/10264542_10152398127452363_476958199_n.jpg

include the mbed library with this snippet

void void onCardRead();
Wiegand rfid(p30, p29, p28, &onCardRead);

int main() {
  while(1) {
    rfid.doEvents(); //checks if data has been fully read, and calls the callback
  }
}

void onCardRead() {
  /*
    Do stuff with data, as we've fully read the card.
    WHen this function exits, RFID reader will be reset to read
    Another Card
  */
   //returns the unique student identifier on a buzzcard  (6 digit number on back of buzzcard below gatech seal)
    uint64_t rawCardData = rfid.getBits(14,33); 
}

Description of public methods

methoddescription
Wiegand(PinName pdata0, PinName pdata1, PinName pHold, void (*onCardRead)());constructor, call WIegand wiegand (...)
void doEvents(void)checks if all RFID data has been read though the use of a timer, and calls the onCardRead callback
uint8_t bitsRead(void)returns the number of bits read
uint64_t getBits(uint8_t start, uint8_t end)Returns the bits read from in [start,end] (Inclusive). If its an invalid range, returns 0

Example Program

Import programHID_ProxCard_Wiegand_Example

Example program to read HID ProxCards using the gatech BuzzCard format with a HID ProxPoint Plus 6005BG00.

Here is a video of the example program in action:

ProxPoint Plus 6005BG00 Oscilloscope Capture

/media/uploads/cbookman3/oscopecapture.jpg

Gatech BuzzCard Protocol

The rfid buzzcard unique student identifier can be found on the back of your buzzcard below the shiny gatech seal (6 digit number). Each buzzcard's rfid tag stores 35 bits of data, but only bits [14,33] contain your id (bit index starts at 0, and range is inclusive).

Committer:
cbookman3
Date:
Wed Apr 23 16:44:05 2014 +0000
Revision:
2:47ffa4e32ce3
Parent:
0:21edeadd0ca0
added keyboad emulation;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cbookman3 0:21edeadd0ca0 1 /* Mbed Wiegand library
cbookman3 0:21edeadd0ca0 2 * Copyright (c) 2014,
cbookman3 0:21edeadd0ca0 3 * Colin Bookman, cobookman [at] gmail [dot] com
cbookman3 0:21edeadd0ca0 4 * Sarthak Jaiswal sjaiswal3 [at] gatech [dot] edu
cbookman3 0:21edeadd0ca0 5 * Avnish Kumar akumar96 [at] gatech [dot] edu
cbookman3 0:21edeadd0ca0 6 *
cbookman3 0:21edeadd0ca0 7 * This program is free software: you can redistribute it and/or modify
cbookman3 0:21edeadd0ca0 8 * it under the terms of the GNU General Public License as published by
cbookman3 0:21edeadd0ca0 9 * the Free Software Foundation, either version 3 of the License, or
cbookman3 0:21edeadd0ca0 10 * (at your option) any later version.
cbookman3 0:21edeadd0ca0 11 *
cbookman3 0:21edeadd0ca0 12 * This program is distributed in the hope that it will be useful,
cbookman3 0:21edeadd0ca0 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cbookman3 0:21edeadd0ca0 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cbookman3 0:21edeadd0ca0 15 * GNU General Public License for more details.
cbookman3 0:21edeadd0ca0 16 *
cbookman3 0:21edeadd0ca0 17 * You should have received a copy of the GNU General Public License
cbookman3 0:21edeadd0ca0 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
cbookman3 0:21edeadd0ca0 19 */
cbookman3 0:21edeadd0ca0 20
cbookman3 0:21edeadd0ca0 21 #ifndef MBED_MICIO_H
cbookman3 0:21edeadd0ca0 22 #define MBED_MICIO_H
cbookman3 0:21edeadd0ca0 23
cbookman3 0:21edeadd0ca0 24 #include "mbed.h"
cbookman3 0:21edeadd0ca0 25
cbookman3 0:21edeadd0ca0 26 /**
cbookman3 0:21edeadd0ca0 27 * @code
cbookman3 0:21edeadd0ca0 28 * #include "Wiegand.h"
cbookman3 0:21edeadd0ca0 29 *
cbookman3 0:21edeadd0ca0 30 * Wiegand wiegand(pin data0, pin data1, pin hold, onRFIDRead); data0/data1 are ISR Inputs, hold = digital Out
cbookman3 0:21edeadd0ca0 31 *
cbookman3 0:21edeadd0ca0 32 * @endcode
cbookman3 0:21edeadd0ca0 33 */
cbookman3 0:21edeadd0ca0 34 class Wiegand {
cbookman3 0:21edeadd0ca0 35 public:
cbookman3 0:21edeadd0ca0 36
cbookman3 0:21edeadd0ca0 37 /* Create a Wiegand instance, and attach interrupts */
cbookman3 0:21edeadd0ca0 38 Wiegand(PinName pdata0, PinName pdata1, PinName pHold, void (*onCardRead)());
cbookman3 0:21edeadd0ca0 39
cbookman3 0:21edeadd0ca0 40 /* Check if we've read all card data */
cbookman3 0:21edeadd0ca0 41 void doEvents(void);
cbookman3 0:21edeadd0ca0 42
cbookman3 0:21edeadd0ca0 43 /* return number of bits currently read */
cbookman3 0:21edeadd0ca0 44 uint8_t bitsRead(void);
cbookman3 0:21edeadd0ca0 45
cbookman3 0:21edeadd0ca0 46 /* Returns the bits read from in [start,end] (Inclusive) */
cbookman3 0:21edeadd0ca0 47 uint64_t getBits(uint8_t start, uint8_t end);
cbookman3 0:21edeadd0ca0 48
cbookman3 0:21edeadd0ca0 49 protected:
cbookman3 0:21edeadd0ca0 50 InterruptIn _data0ISR;
cbookman3 0:21edeadd0ca0 51 InterruptIn _data1ISR;
cbookman3 0:21edeadd0ca0 52 DigitalOut _hold;
cbookman3 0:21edeadd0ca0 53 Timer _lastISR;
cbookman3 0:21edeadd0ca0 54
cbookman3 0:21edeadd0ca0 55 void (*_onCardRead)(); //callback function
cbookman3 0:21edeadd0ca0 56
cbookman3 0:21edeadd0ca0 57 /* Internal buffer of wiegand data */
cbookman3 2:47ffa4e32ce3 58 volatile uint8_t _buffer[64];
cbookman3 0:21edeadd0ca0 59 uint8_t _sizeOfBuffer;
cbookman3 0:21edeadd0ca0 60
cbookman3 0:21edeadd0ca0 61 /* Number of bits currently read */
cbookman3 0:21edeadd0ca0 62 volatile uint8_t _bitsRead;
cbookman3 0:21edeadd0ca0 63
cbookman3 0:21edeadd0ca0 64 /* Reset buffer */
cbookman3 0:21edeadd0ca0 65 void _resetBuffer(void);
cbookman3 0:21edeadd0ca0 66
cbookman3 0:21edeadd0ca0 67 /* Attaches ISR Routines */
cbookman3 0:21edeadd0ca0 68 void _attachInterrupts(void);
cbookman3 0:21edeadd0ca0 69
cbookman3 0:21edeadd0ca0 70 /* ISR Routine for data 0 */
cbookman3 0:21edeadd0ca0 71 void _data0ISRAction(void);
cbookman3 0:21edeadd0ca0 72
cbookman3 0:21edeadd0ca0 73 /* ISR Routine for data 1 */
cbookman3 0:21edeadd0ca0 74 void _data1ISRAction(void);
cbookman3 0:21edeadd0ca0 75
cbookman3 0:21edeadd0ca0 76 };
cbookman3 0:21edeadd0ca0 77
cbookman3 0:21edeadd0ca0 78 #endif