Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Computer Skills
  2. Electronics

How to Open Your Garage Door With RFID

Read Time:11 minsLanguages:

Radio Frequency Identification, or RFID, is an exciting technology that has gained popularity in recent years.  It creates the ability to tag something with a very small passive chip that then allows remote reading of the information on that chip.  RFID tags are commonly used for security door swipe cards, identification for lost pets, and more recently near field communication in smartphones.  

In this tutorial I’ll explain a few basics about how RFID works, describe some different types of RFID, and show how you could build an RFID garage door opener.

The Basics of RFID

RFID is a really cool technology that uses the the energy of the RFID reader signal to power the tag or transponder. This then returns a signal that contains the contents of the tag's memory chip.

Interrogating signal powers the RFID chip

There is a number of RFID types.  Some tags can have a small amount of data written to them that can be read later.  Others are so sophisticated as to require the reader to signal an encryption key before the tag can decode and return its contents.  Most tags, however, simply contain permanent unique ID numbers. Further information about RFID is available on Wikipedia.

RFID chip formats and frequencies vary considerably.  There is a whole alphabet soup of types.  Many smart phones read NFC and MIFARE formats.  

For this project, however, I am going to be using the EM4100 125K Wiegand type of chip.  This type of RFID uses inexpensive readers and tags which is the primary reason for this chip in my kit. As long as you have compatible readers and tags, however, the type of RFID will not matter for this project.

The RFID Project

In this project I will use an RFID tag and an Arduino to open a garage door when an authorized tag is sensed.  Using a low level RFID component is a fairly complicated task, so we are using a breakout board that does the low level reading and transmits the tag code via serial pins.  This is how most RFID breakout boards work.  This tutorial uses one such breakout board.

For this tutorial I will breadboard out the design for the garage door opener and create a functional proof of concept.

Project Components

  • Arduino (Just about any 5V model should work, I used an Uno)
  • RFID Reader board with antenna
  • RFID Tags (I found that  EM4100 125K Wiegand key fobs are cheap and easy to find on ebay)
  • Breadboard
  • A standard LED
  • 220 Ohm Resistor (Red Red Brown)
  • Relay (Aleph SD1A05AWJ)
  • Diode  (1N4148)
  • Jumper Wires

How It Works

The process is quite simple.

First, the RFID reader board reads the tag and transmits the code to the Arduino. The Arduino then reads the code from the serial connection and compares it to a list of authorized RFID codes. If the tag is on the authorized list the Arduino will pull a pin high to provide 5V to close a relay. When the relay closes, it connects the terminals of the garage door signal contacts. The garage door then opens.

The Build

Step 1. The RFID Reader Setup

Using the datasheet or instructions on the RFID reader, wire up the power, ground, serial, and antenna pins.  Below is the pin out diagram of the reader I have.  We’re using Arduino pins 2 and 3 for serial communication with the RFID board so we can leave pins 0 and 1 for console output.

The datasheet will show the pin outs

Follow these steps to hook up the RFID reader board.

  1. Wire ground to the ground pin of the reader
  2. Wire power to the power pin of the reader
  3. Wire Arduino pin 2 to the TX pin of the RFID board
  4. Wire Arduino pin 3 to the RX pin
  5. Connect the antenna to the reader
  6. Connect the LED anode to the pwr out pin of the boards indicator.
  7. Connect the cathode pin of the LED to the ground via the resistor

My breadboard setup is shown below.

The Arduino connected to the RFID reader board

Step 2. Relay Setup

Add the relay to the breadboard.  The two internal pins run the elecromagnet that will close the relay.  You can see in the diagram below how running current through pins 3 to 7 will affect the relay.

Relay schematic
  1. Run pin 4 from the Arduino to pin 3 on the relay.  When pulled high, this pin will provide enough current to close the relay.
  2. Run pin 7 on the relay to ground.
  3. Add the diode between pins 3 and 7 with the paint stripe towards pin 3 of the relay.
Tip: When using a relay or really anything that uses an electromagnetic field, always use a “flyback” diode to protect the system from the power spike when the magnetic field collapses.

This is my breadboard with the relay wired up.

Breadboard with RFID and relay setupBreadboard with RFID and relay setupBreadboard with RFID and relay setup
Breadboard with RFID and relay setup

Step 3. Program Arduino

  1. Copy the code from the end of this tutorial.  The code is thoroughly commented to help you understand what is happening at each step.  Near the top of the code you can see where the is a place to modify the list of RFID tag values.  We will run the code once and wave your RFID tag so you can copy and paste the ID from you authorized tags into the final code.
  2. Click upload in the Arduino IDE
  3. Open up the Serial Monitor of the Arduino IDE by pressing CTRL SHIFT M or Selecting the menu Tools > Serial Monitor.
Tip: Make sure the baud rate of the Serial Monitor matches what we set in the setup() function.  In this example: 38400.

You should see something like this:

Tag read: 3D00CFBB80
Checksum: C9 — passed.

Bad tag. Go away.

Copy and paste your ID (3D00CFBB80 in this example) into the code into the goodTags list.  Note, a different code can be on a new line as long as it is surrounded by quotes and has a comma after it. A single code list may look something like this:

char* goodTags[] = {

Click upload in the Arduino IDE then open up the Serial Monitor of the Arduino IDE by pressing CTRL SHIFT M or Selecting the menu Tools > Serial Monitor.

Now when you run the code you will see something like this:

Tag read: 3D00CFBB80
Checksum: C9 -- passed.

Opening Door!

Below is a photo of me testing the RFID tag with the relay.  The multimeter is hooked to pins 1 and 9 of the relay so it should detect continuity when the relay closes.

Testing the RFID loopTesting the RFID loopTesting the RFID loop
Testing the RFID loop

With a multimeter connected, you can hear the beep of the multimeter to indicate continuity and then a very faint tink and the relay snaps back open.

Step 4. Opening the Garage Door

Most garage door openers operate very simply by opening when they have a contact closed.  When you press the button on the wall you are closing the contact.  On my garage door opener, I have terminals where the wires from the button are connected.  You can see the terminals highlighted here:

Garage door opener terminals
  1. Hook up Pins 1 and 9 from the relay on the breadboard to the terminals on the garage door opener
  2. Wave your RFID tag near the antenna
  3. Watch the door open

You now have the basic proof of concept for opening the door with a wave of your hand.

Step 5. Make it Permanent

  1. Mount the antenna somewhere it can read the tag through the door or wall.  RFID can pass through solid objects so an antenna can be hidden behind the garage wall depending on the material.  It may take some trial and error to find a place where it can read the tag.
  2. Transfer the circuit to a perfboard and solder up a permanent solution
  3. Put the project in a box and mount in your garage.

Source code for this project


In this tutorial I outlined the basics of RFID technology and how to harness it for your own projects.  While the low level components that read RFID may be difficult for hobbyists to use, RFID breakout boards allow using RFID very easily in projects with Arduino or even a Raspberry Pi via a serial port.  Once an ID is read from a tag it's simple to act upon the information.  In this example we actuated a relay to open a garage door.

In addition:

  • I examined the differences in types of RFID technology
  • I explored the concept of how RFID works
  • You followed an example of hooking up an RFID reader board to an Arduino
  • Read and printed the RFID identifier from an ID tag
  • Added a relay to the circuit to close a contact when the right tag was read
  • Wired the relay to a garage door opener to add RFID based access control
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.