In this post I wanna discusss the possibilities of the Raspberry PI and RFID, and implementing it in a cheap but effective way.


This tutorial assumed you have basic knowledge of the Raspberry Pi


Tools used:

Raspberry Pi 2 (could be any model, doesn’t have to RPI2)
Cheap USB RFID reader I bought of ebay (similiar listing)
1 x 370 Ohm Resistor
1 x 10K ohm Resistor
1 x tactile switch
some cables
host computer
micro sd with raspbian


Codes avaivable in this tutorial:

Perform action on RPI with RFID
Perform action on RPI with RFID with timed secondary task
Perform togglable actions on RPI with RFID


Uses: Creating RFID locks, turning objects on/off, performing action on server secured with RFID



This is the way the raspberry Pi was connected to the breadboard, not all wires are used in all code snippets

Rpi connection


Here is an image of the setup I used when writing these snippets




While the RFID reader is fairly big, the circuitry inside it is very minimal and could easily be mounted in a much smaller form factor



Unfortuaneatly I was unable to see what chip this reader uses which would have been interesting, but it was almost as if the writing was filed off it


How it works:

These code snippets work by running a small python scripts that asks for a keyboard input. The RFID reader shows up in the raspberry pi (or any computer for that matter) as a standard keyboard, when you place an RFID near it, it reads it’s ID and “types it in” into the computer and “presses enter”

If the ID matches the one in the code, the software performs the action it’s supposed to perform, if not it asks you to scan the ID again.

All the code is heavily commented and can be ran directly on the Raspberry PI, the “action” is always turn on a LED but it could be anything, write time into database for a punch clock, unlock a door or automaticly order pizza by hacking a pizza app

Well, no more stalling. Lets get to the good stuff


Code snippet 1:

Perform a single action

Code snippet 2:

Perform action, wait, perform secondary action

Code snippet 3:

Only to be used with the raspberry pi GPIO’s, when active it will constantly perform it’s action. It is not a problem when lighting a led, door strike or driving mechanical devices off the pi, but using it for example to send a POST request will resault in a flood of POST’s

Code snippet 4: Toggle

scan the RFID, perform action 1
Scan the RFID, Perform action 2



 Tags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *