









* and #).Below is a typical pinout for a Weigand keypad. Note that pin configurations may vary slightly depending on the manufacturer.
| Pin Name | Description | Notes |
|---|---|---|
| VCC | Power supply input | Connect to 5V or 12V DC (check model). |
| GND | Ground | Common ground for power and signals. |
| D0 | Data 0 line | Outputs binary data (low signal). |
| D1 | Data 1 line | Outputs binary data (high signal). |
| LED | LED control input | Used to control the keypad's LED. |
| Buzzer | Buzzer control input | Used to control the keypad's buzzer. |
VCC pin to a 5V or 12V DC power source (depending on the keypad model). Connect the GND pin to the ground of the power source.D0 and D1 pins to the corresponding data input pins on the controller or microcontroller.LED and Buzzer pins to GPIO pins on the controller for feedback control.Below is an example of how to interface a Weigand keypad with an Arduino UNO. This example assumes the keypad uses the Wiegand-26 protocol.
D0 to Arduino pin 2.D1 to Arduino pin 3.VCC to the 5V pin on the Arduino.GND to the GND pin on the Arduino.#include <Wiegand.h> // Include the Wiegand library
WIEGAND wg; // Create a Wiegand object
void setup() {
Serial.begin(9600); // Initialize serial communication
wg.begin(2, 3); // Initialize Wiegand on pins 2 (D0) and 3 (D1)
}
void loop() {
if (wg.available()) {
// If data is available, read the code and bit length
Serial.print("Code: ");
Serial.print(wg.getCode()); // Print the received code
Serial.print(", Bits: ");
Serial.println(wg.getWiegandType()); // Print the bit length
}
}
No Response from the Keypad
Incorrect or Inconsistent Data
LED or Buzzer Not Working
LED and Buzzer pins are properly connected to GPIO pins on the controller and controlled via software.Q: Can I use a Weigand keypad with a Raspberry Pi?
A: Yes, but you will need to use GPIO pins and a library that supports the Weigand protocol.
Q: What is the difference between Wiegand-26 and Wiegand-34?
A: Wiegand-26 uses 26 bits for data transmission, while Wiegand-34 uses 34 bits. The additional bits in Wiegand-34 allow for more unique codes.
Q: How do I test if my keypad is working?
A: Connect the keypad to a microcontroller and monitor the data output on the serial monitor. Press keys to verify that the correct codes are transmitted.
Q: Can I extend the cable length beyond 150 meters?
A: It is not recommended, as signal degradation may occur. If longer distances are required, consider using signal repeaters or converters.