Introduction: RFID Access Control System

Picture of RFID Access Control System

This Instructable is for a Rasberry Pi Access Control System, which uses an RFID tag system for automatic entry through a door. We use this system for members to access our makerspace and maintain secure access.

For this project, you will need a raspberry pi and the included parts list. The power supply is a self-contained unit, and its function is to control the strike by shorting PUSH to GND, and also provide 12V power. You can be creative when it comes to layout and interface (the spring terminals, etc., are only a suggestion) but all of the modules - or equivalent functionality - are required. For example, if you leave out the level shifter, you *will* fry your pi.

The theory of operation is actually very simple. connect four leads from the pi to the level shifter. Connect B4 to the S pin of the relay, and the green and white wires from the RFID reader go to B2 and B3, respectively. I used GPIO pins 24 and 26 for the RFID reader, and pin 25 for the relay. The 3.3V voltage goes to the LV pin of the level shifter. All of the rest is a simple matter of wiring.

The relay shorts out the PUSH and GND terminals from the power supply. The strike goes to COM+ and COM-. The 12V - 5V Dc-DC converter downsteps the 12V coming out of the supply to 5V that the pi can use.

Use the spring terminals for connecting up the power, and the wires to the rfid reader.

The relay contains all of the appropriate logic for driving the relay, including transistor, flyback diode, etc. The level shifter is also self contained. There are no required discrete components as currently designed, though some are optional.


- Power supply

- 12V door strike

- Raspberry Pi B+

- Raspberry Pi B+ downgrade cable

- Half sized proto board

- 4 channel level shifter (though you may be able to get away without i2c compatibility and save a few cents)

- Relay

- Spring terminals (you can use two of these three pin ones, or one six pin one)

- HID RFID reader (this is a cheap knockoff and I wouldn't trust it, but this is similar to what is needed)

- 12V to 5V DC-DC converter

- HID 125KHz cards

- an LED to suit, perhaps a diode to prevent reverse biasing the pi (I haven't added that to my project), etc.

- Large plastic box

Step 1: Assembly

Picture of Assembly

The code for the pi is located here:

First, you will need to assemble the level shifter and permaboard. When soldering the level shifter, it might be helpful to use a breadboard to put the headers in, so that you are guaranteed a good fit to the permaboard.

Now find a good spot on the permaboard for all of the parts. You will need a three pin header for the relay, and sufficient space for the spring terminals and level shifter. Once you have a good layout, solder everything on. You may want to use female headers for the level shfiter so that you can replace it if needed.

Now, do the wiring. Connect 3.3v from the pi to the LV terminal of the level shifter. Wire 5V and GND to the HV side of the level shifter and relay (it might be helpful to cross-bridge the rails on each side of the permaboard for easy access). Also be sure that the RPI has at least one 5V and GND wire connected (pins 4 and 6 are good candidates). DO NOT REVERSE BIAS THE PI. You may want to include a diode to prevent any possibility of this happening. It is not required, but the peace of mind may justify spending the extra few cents. If you include the diode, mind the polarity - you only want to block current flowing the wrong direction.

Connect the S terminal of the relay header to one of the outputs of the level shifter.

Wire up the appropriate GPIO pins from the pi to the LV site of the level shifter. Note that wiringpi uses a different gpio schema than python. You may want to use the suggested GPIO pins, but if you are willing to modify the software appropriately, you can use whichever pins strike your fancy. We used 23 and 25 for the RFID, and 24 for the relay.

Wire +5V and GND to two spring terminals. Wire +5V and GND to two more spring terminals (this is for the RFID reader). Wire two more spring terminals to two high-side pins of the level shifter. Wire everything up and test it. First, you might want to check that there are no shorts - check that there is an open circuit between +5V and GND before plugging anything in. Wire the green and white wires from the RFID reader to the spring terminals you've connected to the two high-side outputs of the level shifter.

Program the pi and use the script found on github. Make sure that the GPIO in the weigand.c file is correct, and run "mkwiegand" - this will create a program in the directory called "weigand". You will need to install python-pip and the daemon module, and also wiringpi. Test the weigand by starting the weigand program on its own and try to read a card. If you get a 26 bit result, you have wired everything correctly. Now make sure the config files in the conf directory are correct (you will need to edit zone.conf and users.conf) for the user and card you're using, and start the script. If you've done everything right, presenting the card will cause the relay to trigger.

If you have made this work, you have completed the logic, now you just have to wire it up.

It also helps to use masking tape on the wires so they don't fall out when flipping over to solder.

Step 2: Install in to a Door

Picture of Install in to a Door

Find a place to mount your reader. Find a way to run the wires inside to the control mechanism (do NOT make it accessible to the outside - if you have access to the power supply the system is trivially subverted). We used hook-up wires, plastic conduit, and shrink tubing. For the control mechanism, we used two small project boxes, one for the power supply and one for the mechanism itself, mounted to the door jamb using double sided tape. You can do this any way you want, the way we did it is unique to our setup and is only a suggestion.

We mounted everything in the boxes using double sided foam stickies, and drilled holes so that the wires can enter and exit. The power supply needs 120V AC, we used a standard IEC connector. It can be hardwired using conduit, if you choose this route, be sure you know what you're doing or hire a competent electrician. Wire the 12V and GND from the power supply to the 5V DC-DC converter, and use the output from the converter to power your board, from the spring terminal that you wired earlier. MIND YOUR POLARITY - getting this wrong will likely fry something. Wire the NO terminals of the relay to PUSH and GND from the power supply. Wire the strike to NC and COM on the power supply.

To install the strike, use a vibrosaw or other similar tool to cut out a notch, and just put it in. Make sure that you don't screw it in too tight, it will bind the solenoid. Power it up, make sure the pi has started (it should be configured to start automatically on boot) and make sure everything works. Feel free to hack on the, but please send us your changes so that others can use them. Notes and gotchas: You can use other weigand systems too, the one we used is not a requirement, as long as it's a 26 bit system it should work.

The card reader we used apparently does not always like freezing weather - use wisdom in cold climes. There is one 5V GPIO slot available for an LED or something similar - feel free to make use of it. The proxpass reader has wires available for controlling the buzzer and LED. We did not make use of these. If you wish to use an 8 bit level shifter instead of the 4 bit one we used, you can probably do something with those. Shrink tube or otherwise electrically isolate all unused wires on the reader. If security from internal threats is important, place in a physically secure location. Subverting the mechanism with access to the pi or power supply is easier than trivial. Access to the wires and reader, though, is completely safe, the system is not easily subverted in that way. The strikes that are predominantly available through amazon and ebay will unlock when there is no power. Take care that you get the strike that is right for your application. If you get one that will fail closed, make sure you are using the correct lead from the power supply. The software has code for a locker application. This will be a separate instructable, but the hardware is actually very similar. Feel free to dink with it.

CONGRATULATIONS!! You made an RFID access control system!


0xt1v0 (author)2017-09-20

Looking at making something like this for testing RFID access controls. I'm assuming since it shorts the power supply PUSH to GROUND, to be able to power multiple doors you would need multiple power supplies (otherwise they would all open when one is opened)? Please confirm I am understanding correctly.

SIRNicolasRemington (author)2017-08-16

I know this is a pretty old instructable, so I hope someone will reply. For the power supply, shorting PUSH to GROUND. Does anyone know the duration of the short. Is it a second long or continuous?

J. AlbertoA (author)2016-04-14


Great project.

a bit long ago but I have an issue, when the raspberry pi reboots it seems to send a pulse that opens the lock and therefore the door.

Any suggestions on why this could be happening and how to avoid it?

JamieW66 (author)2016-04-01

Hi everyone, I am a fresh noob to RPi, I know some light linux & python, but cannot for this life of me figure out how to get this going. Nowhere can I find the instructions about how to find the wiegand.c or the mkwiegand. Thanks for any help.

AliC10 (author)2015-09-16

The github code seems different, have you removed the need for the weigand.c file?

pierinz (author)2015-01-12

The clamping diode should be included in the relay module (it also includes a transistor, which allows you to turn on the relay with 3.3V). Do not wire a generic 5V relay without those components or you will fry your Raspberry, it can't provide the required current from any GPIO pin.

You can build a simple relay board with an ULN2803/ULN2003 (

duskglow (author)pierinz2015-01-12

I'm the one who actually built this, and I'm not sure I understand this comment. The relay in the parts list contains all of the appropriate logic, including flyback diode and drive transistor (even a nice LED). Are you suggesting instead that this should be a warning in the documentation?

pierinz (author)duskglow2015-01-13

Yes, I think you should add that the project needs a special relay module. A beginner may wire a simple 5V relay: it should work, but it won't last long.

Laserbird (author)2015-01-11

Details on the triangle mural design can be found here:

About This Instructable




Bio: We are a new 10,000 sq. ft. makerspace in Portland, OR at 7600 N. Interstate Ave with a wood shop, craft lab, hackerspace, tiny ... More »
More by Laserbird:Model Magic X86 Mobile Keyboard Computer3D Printed Glencairn Whiskey GlassThe Blue Mountain Elk Burger
Add instructable to: