Tuesday, July 29, 2014

Arduino RFID access control

In this tutorial I will demonstrate an RFID (Radio Frequency Identification) access control system.

What we need:
Once you wire the module, download the sketch and upload it to arduino.



Alternatively use codebender
Open the serial monitor and approach a token or a card to the antenna. You should receive the tag id.


Now we have readings let's handle them. It's in your discretion what to operate with those, but in this example we will make a simple check-in/check-out sequence.

As always, check your arduino configuration and then enable the serial port.


To achieve our goal we need to evaluate user status in order to switch from present to absent and vice versa when a tag is pointed. At Control Panel click Add New Instruction Set. Type rfideval in the name field (handler) or one of your choice and the evaluation that follows as the action...

{ evalBool("%whereami%" == "present"); check_me_out; check_me_in; }


'check_me_in' and 'check_me_out' are Instruction Sets that corresponds to our preferred actions. For example, saluting user using %salute% function, announce temperature even turning on a light. Also the %checkin% and %checkout% functions are mandatory to changing the current status.


To see how responses will look or sounds like, go to terminal tab and type...
  check_me_in; %whereami%
  check_me_out; %whereami%

...which  will execute the commands and after that get the status with %whereami% function.


We can also drive the check-out sequence within an event handler for extra functionality, like a countdown timer that give as time to leave before status is changed. This action can be achieved by pointing the check_me_out Instruction Set to event handler we just describe. The events will look like this...

judo sleep <ms>; %checkout%



The check_me_out Instruction Set now points to check-out-handler.

It would be wise to read about functions and API for extra customization. Also, it would be very handy to know how events work .It will help you to make multiple actions in a single command.

As we may already know, whatever collected by the serial port triggers corresponding events if they exists. This means that if we create a new event handler with name (id) same as RFID tag then it will be triggered when found.


Notice the last id in the serial monitor screenshot. When specific token (with id 6600942812) is acknowledged the event will trigger the evaluator 'rfideval' and change our status accordingly.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.