A stand-alone access control with RFID

By on August 27, 2013
Pin It


RFID Tags are increasingly used for many applications such as identifying objects by means of a code or access control. In logistics RFIDs allows asset tracking, or monitoring conveyor belts; in shops tags are often used as anti theft. RFIDs are also used for presence detection and security, with several use cases, for example in computer and appliance access and user identification. Due to the importance of RFIDs we propose today a simple, stand-alone project, which is basically a simple transponder enabled lock. This lock is equipped with a relay to be used to control an electric gate opener or a simple lamp. We’ll use a great module, very practical because it incorporates everything you need to make a transponder reader: the ID-12 by Innovations Technology. This component integrates the exciter coil, the logic to control absorption and that for code identification.
We presented also a RFID shield for Arduino available in the store.

Furthermore ID-12 integrates a logic that is able to output the data read from the transponder tag (according to three standards: ASCII, Wiegan26 and Magnetic ABA Track2).

Precisely because it provides transponder recognition by itself, the ID-12 is the ideal device for many systems, including electronic access gates, counters, goods classifiers and cataloguers, etc..

From the 11 pins available, pin 7 defines the data format: to read read ASCII-12 it should be put to 0 logic, if connected to pin 11 it will read Magnet ABA Track2 tags, if attached t the power supply will read Wiegan26 transponders.


The component sports a TTL level serial interface, that is accessible from pin 9 (TX or D0) and 8, from which the data read is outputted. Another output is available at pin 10: it blinks at a 3 kHz each time the module detects the code of a tag encoded as expected. This signal can be used to operate a buzzer without electronics or a light emitting diode, from which to report the identification event. The module can’t store codes, it only warns that it recognized something as expected, then, whether to activate the circuit is in charge of the rest of the electronics.



  • Up to 127 tags can be stored.

  • Possibility to store\deletion of a single tag and memory reset.

  • Dynamic memory management: each tag is stored in the next available location.

  • Both bistable and monostable output operation (1 second activation).

  • Buzzer indicator of the passage of tag on the player.



This RFID access control is available in the store


Circuit diagram


As said, the circuit is made ​​easier thanks to the adoption of the ID-12: in the diagram we see that it is interfaced with:

  • a Microchip PIC12F683 microcontroller (a 8-bit micro-architecture RISC processor, with flash memory) to which it passes the data it reads from tags and

  • an NPN transistor (T2) that we use as a current amplifier needed to drive a buzzer.

Once fed, the ID-12 is ready to use.

In our case, pin 7 is connected to ground: the circuit will recognize tags encoded in ASCII and will output ASCII characters, which the microcontroller will either check for storing (in tracking applications) or compare with the codes in memory (as a lock).


In the circuit, the ID-12 is interfaced with a microcontroller that provides tag recognition, and the actions for the identification of one of the transponders available in memory.

Upon initialization, the PIC firmware sets GP0 and GP1 as direct controls of the diodes of the LD1 two-color LED, used to signal the operating conditions. GP5 is used to command the the relay through T1 transistor (with the base polarized from the R1/R2 divider). GP2, GP3 and GP4 are initialized as inputs, reading, respectively, the incoming data from the ID-12 module, the state of the P1 butto) and the JP1 jumper condition.

The entire circuit operates with continuous and stabilized 5 volts provided by the U1 regulator coming from the supply voltage applied to + and – PWR (between 11 and 15V DC). D1 protects the circuit from reversed polarity, C1 filters impulse noise in input voltage and C2 filters out the residual alternating current (ripple), C3 and C4 filter out the 5 volts.


R1: 10 kohm
R2, R3, R5, R7: 4,7 kohm
R4, R6: 470 ohm
C1, C3: 100 nF 
C2: 220 μF 25 VL 
C4: 220 μF 16 VL 
C5, C6: 15 pF 
BZ1: buzzer 12 V c
LD1: Led 5 mm red/green
P1: Microswitch
RFID1: ID-12
RL1: relay 12 V
T1, T2: BC547
U1: 7805
U2: PIC12F683 (MF829)


How it works


Once you plug the circuit and a tag approaches the reader module, pin 10 generates a one second pulse train at 3 kHz (which plays the buzzer through T2) and the micro prepares to read data from TX coming from RFID1; once data is read, the microcontroller pulls the code contained in them and compares it with those that in memory.

At this point, two things can happen: in case the code is not among those previously learnt the alarm is activated: the relay stays at rest, but the buzzer plays and the LED will turn red for a second.  If the circuit works in bistable mode and the relay has been energized by a valid transponder the diode, now with green light, switches to red and then turns green again.

Instead if the transponder read is known, we have different behaviours according to the activation mode selected: in monostable setting the micro pulses RL1 for a second and this relay will be used to control an electric lock, a gate opener or other actions. Meanwhile, the two-color LED will pulse to green light, and then turn off with the release of the relay.

In bistable mode, however, the relay changes state each time the ID-12 is approaching a valid tag: the first time RL1 clicks and stays excited, highlighted by the stable green color lighting.


Notice that the firmware of the PIC was designed to signal tag reading in any case, irrespectively of being among those stored: indeed, if the ID-12 is approaching a non-ASCII transponder the two-color LED remains unchanged, but if you approach an ASCII tag, the message is different depending on whether the same is matched (light green) or not (red light).


Clearly the circuit can work with at least one RFID tag code: storing can be done as follows. After powering the board, press P1 button and keep it pressed until the LED lights up with an orange color. Then release the button and pass the transponder card that you want to store. If the LED turns off and on, the tag code has been stored, if the light remains on, the transponder code is already in memory, or the memory space may be exhausted.

At this point you can replicate the procedure to match other tags.

To exit the memory mode, press and hold the P1 button until the LED starts flashing meaning that is coming back to normal operation.


Tag  Cancellation

At any time you can remove a code from the memory: just power the board, press P1 button and keep it pressed until the red LED stops lighting. At this point, release the button and pass the tag you want to delete: if the LED turns off and on, the card has been canceled, differently, in case light remains on, it means that you are trying to remove from memory a transponder that is not stored in the reader. To remove more tags, just pass them one after another. To exit the procedure, hold the button until the LED starts flashing.


Cancellation of all tags

To cancel all tags in a single shot just power the circuit with P1 button pressed. When the red LED lights up, release the button since the cancellation is done.

Firmware (Pic Basic Pro)


About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.


  1. Pingback: Electronic Access Control · WWW.INFOWEBHUB.NET

Leave a Reply