Raspberry Pi and Wiegand: step by step
Not complete yet.
This page describes how to set up a Raspberry with a Wiegand reader, step by step.
- We use GPIO pins 14 and 15 for the Wiegand reader data transmission wires, respectfully for Data0 and Data1.
- We use GPIO pin 3 to light up the LED (meaning the door is open).
- Wiegand reader Data0 and Data1 generally output +5V. Raspberry Pi's GPIO voltage levels are 3.3 V.
- We need a total of 4 wires going to the Raspberry Pi's GPIOS. Last one is for ground.
Here is the Raspberry Pi GPIO layout for informations:
A Wiegand reader will usually use +5V as its "high" voltage level. However, Raspberry Pi's pins are built to deal with 3.3V current. Therefore we need to reduce the voltage in order to not damage the pins.
We want to go from +5V to about +3.3V:
Vin = +5 and we would like
Vout = +3.3.
We will use 2 resistors:
R1 = 330 and
R2 = 560. This gives
Vout = 3.146, which is acceptable.
Step 1: Prepare the GPIOs.
Raspberry Pi with wires connected to GPIO.
- The black wire is connected to the ground GPIO pin.
- The blue wire goes to GPIO 3.
- The green wire is connected to GPIO 14.
- The white wire is connected to GPIO 15.
Step 2: Prepare breadboard.
This is what the breadboard look like, with 4 resistors for voltage divider. The led will be lighted if an access control is successful.
Step 3: The wiegand reader.
- The blue, yellow and orange wires are useless, as far as i know.
- The red wire is for powering the reader. (Based on your reader, it can range from 5V to 12V -- maybe more)
- The green wire is Data0 (aka data -)
- The white wire is Data1 (aka data +)
- No color wire is a ground that needs to be connected to the raspi's ground.
The reader could be powered by the Raspi's 5V pin, but we use an external powering source.
Step 4: Plug in the raspi's wires into the board.
We then plug the raspberry pi's wire (connected to the GPIOs) into the board. This will allow us to retrieve data from the reader as well as powering the led when we need to.
Step 5: Plug the reader into the board.