Add some security to your projects

Olga Kostenko, 123RF

On the Cards

Blank RFID (Radio Frequency ID) cards along with a USB-based RFID card reader can offer an easy and low cost solution for your Pi security projects.

Are you looking for a low cost, simple security solution? If so, consider harnessing 125 kHz RFID (Radio Frequency Identification) technology. For less than $10 we were able to use blank RFID cards (5 for $3) [1] and a generic USB-based six-dollar RFID card reader to set up our system [2].

In this article we will look at two applications. The first project will use Python to read the card, check it in a lookup file, and, if the card is valid write to a GPIO pin. The second project will use Node-RED to toggle a smart power switch. Using some of these basic concepts you can create projects such as a security system (Figure 1), a plant watering system, or a door access system.

Figure 1: A card-enabled security system.

Cards & Readers

The RFID cards and readers need to work at the same frequency. For our project, we used low-cost 125kHz equipment.

The blank 125 kHz RFID cards have a predefined RFID number. This number is typically written on the card (Figure 2). These blank cards can be used directly, so no programming or writing to the card is required.

Figure 2: RFID Card with its RFID number.

The USB card reader will momentarily light up and beep when it reads a card. It acts like a USB keyboard, passing the card's RFID number as a series of key strokes. An [Enter] key press is sent at the end of the sequence.

Lookup File

To verify the card's RFID number, open a terminal session and start swiping the cards. The cards ID numbers should appear on the command line:

pi@raspberrypi:~ $ 0006241052
bash: 0006241052: command not found
pi@raspberrypi:~ $ 0003617750
bash: 0003617750: command not found

The next step is to create a simple text file (card_id.txt) with the valid RFID card numbers, something like Listing 1.

Listing 1

validcardnumbers.txt

0006241052
0003617750
.
.
.

Buy this article as PDF

Express-Checkout as PDF

Pages: 3

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content