

A Weigand keypad is a security device commonly used in access control systems. It allows users to input a numeric code to unlock doors, activate gates, or gain entry to restricted areas. The keypad communicates with access control systems using the Weigand protocol, a widely adopted standard for transmitting data in a secure and reliable format.








Below is the typical pinout for a Weigand keypad. Note that specific models may vary slightly, so always refer to the manufacturer's datasheet.
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply input (5V to 12V DC) |
| 2 | GND | Ground connection |
| 3 | D0 | Data 0 line (Weigand protocol output) |
| 4 | D1 | Data 1 line (Weigand protocol output) |
| 5 | LED | LED control input (optional, used to control the keypad's indicator light) |
| 6 | Buzzer | Buzzer control input (optional, used to activate the keypad's buzzer) |
Below is an example of how to interface a Weigand keypad with an Arduino UNO. This code reads the D0 and D1 lines and decodes the Weigand data.
// Weigand Keypad Example for Arduino UNO
// This code reads data from the D0 and D1 lines of a Weigand keypad
// and prints the decoded keypress to the Serial Monitor.
#define D0_PIN 2 // Connect D0 line to Arduino digital pin 2
#define D1_PIN 3 // Connect D1 line to Arduino digital pin 3
volatile unsigned long weigandData = 0; // Stores the received data
volatile int bitCount = 0; // Tracks the number of bits received
void setup() {
pinMode(D0_PIN, INPUT); // Set D0 pin as input
pinMode(D1_PIN, INPUT); // Set D1 pin as input
attachInterrupt(digitalPinToInterrupt(D0_PIN), handleD0, FALLING);
attachInterrupt(digitalPinToInterrupt(D1_PIN), handleD1, FALLING);
Serial.begin(9600); // Initialize Serial Monitor
}
void loop() {
if (bitCount == 26) { // Check if 26 bits (Wiegand-26) have been received
Serial.print("Keypress detected: ");
Serial.println(weigandData, HEX); // Print the received data in hexadecimal
weigandData = 0; // Reset data
bitCount = 0; // Reset bit count
}
}
// Interrupt service routine for D0 line
void handleD0() {
weigandData = (weigandData << 1); // Shift left and append 0
bitCount++;
}
// Interrupt service routine for D1 line
void handleD1() {
weigandData = (weigandData << 1) | 1; // Shift left and append 1
bitCount++;
}
No Data Received:
Incorrect Keypresses Detected:
Keypad Not Powering On:
LED or Buzzer Not Working:
Q: Can I use a Weigand keypad outdoors?
Q: What is the difference between Wiegand-26 and Wiegand-34?
Q: Can I connect multiple Weigand keypads to a single controller?
Q: How secure is the Weigand protocol?