RFID Computer Lock

Introduction: RFID Computer Lock

About: I am a human being that enjoys to build things. I also say GNU/Linux instead of just Linux. Yeah, I'm that kind of person.

This instructable will allow you to make an easy RFID lock for your computer, so only people with the correct RFID tag can access it. A program runs on your computer, so when you click into it and press 'l', the mouse automatically goes to the top left corner, and stays there until it is unlocked. It works using processing (with the robot class), an RFID reader, and an Arduino. I would very highly recommend not using this to actually secure something, as it is easily hackable by someone with little experience. With that being said, it can still be used for simple protection against family or co-workers (depending on where you work).

Here is a video of it in action:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Supplies

Here's what you need:

1 ID-12 RFID Reader (and breakout board)
1 Arduino
1 RFID Tag
1 LED
1 Breadboard
1 Computer

Step 2: Assemble

Solder the RFID reader to the breakout board. Then, wire as follows:
RFID reader pin 1 to ground.
RFID reader pin 2 to 5v.
RFID reader pin 11 to 5v.
RFID reader pin 10 to LED.
RFID reader pin 9 to Arduino pin 6.
RFID reader pin 7 to ground.

Done!

Step 3: Arduino Code

Here is the code you should upload to your Arduino. You should know the code for your RFID key, so you should change the third to last line accodingly.

#include <SoftwareSerial.h>

SoftwareSerial RFID = SoftwareSerial(6, 7); //RX is 6, TX is 7
String key; //The key that was scanned

void setup ()

  Serial.begin(9600);
  RFID.begin(9600); //Begins connection with the reader
  Serial.println("RFID is all set.");
}

char read; //The most recent character read

void loop ()
{
   while(RFID.available() > 0)
   {
      read = RFID.read();
      key += read;
      if(key.indexOf("4F0088AE355C") >= 0) Serial.print("unlock"); //Should be changed to your RFID key
   }
}

Step 4: Processing Code

This is the processing script that you should run on your computer. Take note of how it isn't particularly secure, but it can be easily modified to be secure.

import processing.serial.*;
import java.awt.AWTException;
import java.awt.Robot;

Robot robot;
boolean locked = false;
Serial port;
void setup()
{
  println(Serial.list()); //Prints available ports

  port = new Serial(this, Serial.list()[0], 9600); //Chooses the first available port
  try
  {
    robot = new Robot(); //Creates robot
  }
  catch (AWTException e)
  {
    e.printStackTrace();
  }
}

void draw()
{
  if (locked == true) robot.mouseMove(0, 0); //If locked, moves mouse to top left corner
  while (port.available() > 0)
  {
    String input = port.readString(); 
    //println(input);
    locked = false; //If anything is recieved it'll unlock. I wasn't trying to make it all that secure
  }
}

void keyPressed ()
{
  if (key == 'l')
  {
    locked = true; //Locks it
  }
  if (key == 'u')
  {
   //locked = false; //Uncomment this if you're a wimp (or if you're testing)
  }

  if (key == ESC)
  {
    key = 0; //Disables escape as quit
  }
}

Step 5: Instructions for Operation

Now that you have built you reader, and have all your code, you may be wonder how it all comes together. Here are the simple operating instructions:
1. Plug in assembled reader.
2. Open up Arduino IDE, and upload supplied code.
3. Open up Processing IDE, and run supplied code.
4. Click into processing script and press 'l' to lock.
5. Hold card over reader to unlock.

It's that simple!

Keep in mind that you should use some precautions when testing the first few times. When building this, I got locked out of my computer many, many times. If you have any errors (like RXTX version mismatch), post them in the comments and I will be able to give you the solution.

Have fun and happy locking! (And unlocking hopefully)

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    8 Discussions

    0
    AfifA7
    AfifA7

    3 years ago

    how to i make this but to on CPU ???

    0
    AJMansfield
    AJMansfield

    6 years ago on Step 4

    To make this more complete, you could put this in its own executable .jar (with all the required libraries), reduce the dependency on Processing and use the standard java classes (in this case TimerTask and KeyListener) to perform the functionality you want, and add command-line switches to enable/disable pressung 'u' to unlock. This way, you don't have to start up the editor just to run it or tweak the testing parameters.

    0
    magique06
    magique06

    6 years ago on Step 4

    What software do you use to lock the computer screen?

    0
    VadimS
    VadimS

    7 years ago on Introduction

    Looks neat, just cureose, why didn't you have it actually lock the computer. You could have setup the arduino to act like a keyboard, program a macro on it to lock the system, then have the rfid trigger it to type in your password.

    0
    alecnotalex
    alecnotalex

    Reply 7 years ago on Introduction

    Interesting idea. I honestly didn't think of that, but now that you mention it, I'll try to figure it out!

    0
    megaduty
    megaduty

    7 years ago on Introduction

    I have the exact same reader and will give your ible a shot later; thanks for the post!