Skip to content

Commit

Permalink
Merge pull request #1 from kitsunehunter/Add_Wiegand_Formats_and_Deco…
Browse files Browse the repository at this point in the history
…ding

Add wiegand formats, decoding, enhance log file
  • Loading branch information
kitsunehunter authored Nov 28, 2023
2 parents ddb07ea + 6e1ced7 commit 2808278
Show file tree
Hide file tree
Showing 5 changed files with 364 additions and 155 deletions.
31 changes: 22 additions & 9 deletions gpio/wiegand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ This application supports W4, W8, W24, W26, W32, W34, W37, W40 and W48 formats.

This application can be used to test Wiegand readers and keypads. It can save the data to a file, and can load and replay the data. Timings are measured and displayed; which can be used to help debug Wiegand readers.


## Wiring
The D0 and D1 wires of the Wiegand must be about 1K or higher for the Flipper to be able to effectively pull them down to ground. If the line has a lower resistance, like 100 ohms, then you need to add MOSFETs to help pull the lines low. The following [YouTube video](https://youtu.be/OVyd3ffnZ0M) is a demonstration of how to correctly wire the device.

The D0 and D1 wires of the Wiegand must be about 1K or higher for the Flipper to be able to effectively pull them down to ground. If the line has a lower resistance, like 100 ohms, then you need to add MOSFETs to help pull the lines low. The following [YouTube video](https://youtu.be/OVyd3ffnZ0M) is a demonstration of how to correctly wire the device.

In all configurations:

- Pin A7 goes to your Wiegand D1 (white) wire.
- Pin A4 goes to your Wiegand D0 (green) wire.
- Pin GND goes to your Wiegand GND (black) wire.
This is sufficient for reading signals with both this application and the Debug Accessor application.
This is sufficient for reading signals with both this application and the Debug Accessor application.

If the pull-up resistors on your card reader are less than 1K, you also need the following:
- Two additional MOSFETs are required. I used IRF540 (but perhaps IRL540 would be better?)
- Two additional Pull-down resitors are required. I used 5K, but 4.7K would be fine as well.
- I'm still learning, but perhaps a MOSFET driver / optocoupler would provide even more protection to the Flipper GPIO pins? Use this circuit at your own risk. :)

- Two additional MOSFETs are required. I used IRF540 (but perhaps IRL540 would be better?)
- Two additional Pull-down resitors are required. I used 5K, but 4.7K would be fine as well.
- I'm still learning, but perhaps a MOSFET driver / optocoupler would provide even more protection to the Flipper GPIO pins? Use this circuit at your own risk. :)

Here is how you wire up the MOSFET and the pull-down resistors:

- The source pin of each MOSFET connects to ground.
- The gate pin connects to one side of a resistor. The other side of the resistor goes to ground.
- The gate pin connects to one side of a resistor. The other side of the resistor goes to ground.
- For the MOSFET used for D1:
- The gate pin of the MOSFET for D1 goes to pin A6 on the Flipper. (It should also already be connected to the pull-down resistor)
- The drain pin of the MOSFET for D1 goes to pin A7 on the Flipper.
Expand All @@ -47,15 +50,25 @@ This is a 26-bit format used by many readers. The first bit is an even parity bi

This is similar to W26, but without the leading and trailing parity bits. The first 8 bits are the facility code. The next 16 bits are the card number. The application will display the facility code and card number.

## W35: 35-bit Wiegand

This is HID 35 bit Corporate 1000 - C1k35s format. The first bit is odd parity 2 (based on bits 2-35). The next bit is even parity (based on 4-5,7-8,10-11,...,33-34). Then 12 bit company code. Then 20 bit card id. Then odd parity 1.

## W36: 36-bit Wiegand

This is decode HID 35 bit Keyscan - C15001 format. The first bit is an even parity bit. The next 10 bits are the OEM number. The next 8 bits are the facility code. The next 16 bits are the card number. The last bit is an odd parity bit.
Other 36 bit credentials may be decoded incorrectly.

## W48: 48-bit Wiegand

This is HID 48 bit Corporate 1000 - H2004064 format. The first bit is odd parity 2 (based on bits 2-48). The next bit is even parity (based on 4-5,7-8,10-11,...,46-47). Then 22 bit company code. Then 23 bit card id. Then odd parity 1 (based on 3-4,6-7,9-10,...,45-46).
This is HID 48 bit Corporate 1000 - C1k48s format. The first bit is odd parity 2 (based on bits 2-48). The next bit is even parity (based on 4-5,7-8,10-11,...,46-47). Then 22 bit company code. Then 23 bit card id. Then odd parity 1 (based on 3-4,6-7,9-10,...,45-46).

## W32/W34/W37/W40: 32/34/37/40-bit Wiegand

These formats are not very standardized, so the application will not try to interpret the data. You can modify the wiegand_data.c file to add your own interpretation.

## Installation

### Step 1. Install Git and VS Code.

If you have not already installed Git and VS Code, you will need to do so. The following links will take you to the download pages for Git and VS Code.
Expand Down Expand Up @@ -97,7 +110,7 @@ Create a new folder for the application. The name of the folder will be the name

### Step 6. Copy the application files.

Copy the files from this project to the **wiegand** folder. Be sure to copy the scenes directory into a scenes directory in the **wiegand** folder.
Copy the files from this project to the **wiegand** folder. Be sure to copy the scenes directory into a scenes directory in the **wiegand** folder.

### Step 7. Build the application.

Expand Down
Loading

0 comments on commit 2808278

Please sign in to comment.