loading

I will show you how to easily make a RFID lock.

I will use Arduino UNO, RFID RC522 (MIFARE protocol).
This project can also be seen here: Arduino RFID lock

Step 1: Components

  • Arduino UNO
  • RFID RC522
  • TG9e servo
  • LED RGB - WS2812
  • 2 x RFID tag

Step 2: Schematic

Step 3: Software

At the beginning we import all the needed libraries.


#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
#include <Adafruit_NeoPixel.h>

//----------------------------------------------------------

Then we configure and initialize:

UART speed

We initiate rc522

We set the servo to zero

void setup() {
Serial.begin(115200);

SPI.begin();

mfrc522.PCD_Init();

Serial.println("For more: http://geek.adachsoft.com");

Serial.println("Arduino RFID lock");

Serial.println("");

myservo.attach(SERVO_PIN);

myservo.write( 0 );

pixels.begin();

pixels.setPixelColor(0, 32, 32, 32);

pixels.show();

delay(500);

pixels.setPixelColor(0, 0, 0, 0);

pixels.show();

}

//----------------------------------------------------------

After we read the UID tag, we compare it with the proper UID.

If the UID is the same then start the servo.

if( content == "77-39-50-39" ){
Serial.println("Authorized access");

myservo.write( 90 );

pixels.setPixelColor(0, 0, 32, 0);

pixels.show();

delay(1000);

myservo.write( 0 );

pixels.setPixelColor(0, 0, 0, 0);

pixels.show();

}else{

Serial.println("Access denied");

pixels.setPixelColor(0, 32, 0, 0);

pixels.show();

delay(500);

pixels.setPixelColor(0, 0, 0, 0);

pixels.show();

}

//----------------------------------------------------------

Download source code: RFID_with_servo.ino

Step 4: End and Checking

About This Instructable

397views

17favorites

License:

Bio: Software, electronics, do-it-yourself
More by adachsoft:DIY USB Charger for Your Phone - LM2596 DIY WIFI RC Car With ESP8266 and Arduino IDE Control Any Devices Using Raspberry PI and PCF8574, Relay Module 
Add instructable to: