Key Card Lock

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)This Instructable is going to detail how to make a key card access lock that can be attached to fridge or drawer. Simply put the access card up to the sensor and the lock will open.Arduino UnoMotor ShieldStepper MotorBreadboardBattery and Battery connectorPushbuttonRFID Key Card ModuleBox for hardware storageFirst it is necessary to 3D print all your parts. You need to print the mount bracket, pin, shaft, gear and cover. Use the schematics above to 3D design the parts with Inventor.Drawings in this order.1. Cover2. Pin3. Shaft.4. Gear5. Mount6. BracketGlue the shaft to the gear by placing it in the hole designed for itAttach the Motor to the Cover using two screws. Then the shaft should slide through the hole in the cover and rest on the motor.Cut tape and stick tape to Mount where it is white in the photo.Slide the pin through the holes into resting positon. The cover, gear, shaft and motor should stick on top.Follow the Wiring diagram with these instructions.RFIDSDA to pin 10SCK to pin 13MOSI to pin 11MISO to pin 12IRQ no pin GRD to GRDRST to pin 83.3V to 3.3VMotor ShieldStep motor attaches to A B C and DIN1 to pin 2IN2 to pin 3IN3 to pin 4IN4 to pin 5 to 5V- to GNDButtonTo pin 6To GNDDownload these and put in your librariesCopy and paste this into your code/******************************************#define pin1 2/these are the Arduino pins that we use to activate coils 1-4 of the stepper motor #define pin2 3 #define pin3 4 #define pin4 5#define delaytime 5 /delay time in ms to control the stepper motor delaytime. /Our tests showed that 8 is about the fastest that can yield reliable operation w/o missing steps#define buttonS 6 / defining button to close lock#define gearratio 64 const int stepsPerRevolution = 2048; const int mySteps = 255;#include / Include of the RC522 Library #include "FastLED.h" / Include of the FastLED library #include / Used for communication via SPI with the Module#define SDAPIN 10 / RFID Module SDA Pin is connected to the UNO 10 Pin #define RESETPIN 8 / RFID Module RST Pin is connected to the UNO 8 Pin/#define Buzzer 3 / Pin 3 connected to pin of the Buzzerbyte FoundTag; / Variable used to check if Tag was found byte ReadTag; / Variable used to store anti-collision value to read Tag information byte TagData[MAX_LEN]; / Variable used to store Full Tag Data byte TagSerialNumber; / Variable used to store only Tag Serial Number byte GoodTagSerialNumber = 0xE4, 0xD2, 0x51, 0xEB; / The Tag Serial number we are looking forMFRC522 nfc(SDAPIN, RESETPIN); / Init of the library using the UNO pins declared abovevoid setup() / initialize the 8 pin as an output: pinMode(pin1, OUTPUT); pinMode(pin2, OUTPUT); pinMode(pin3, OUTPUT); pinMode(pin4, OUTPUT); pinMode(buttonS, INPUT); / setting the pinmode for the button digitalWrite(buttonS, HIGH); /defining the button as HIGH /Serial.begin(9600); SPI.begin(); Serial.begin(9600); /For serial monitor/ Start to find an RFID Module Serial.println("Looking for RFID Reader"); nfc.begin(); byte version = nfc.getFirmwareVersion(); / Variable to store Firmware version of the Module/ If can't find an RFID Module if (! version) Serial.print("Didn't find RC522 board."); while(1); /Wait until a RFID Module is found / If found, print the information about the RFID Module Serial.print("Found chip RC522 "); Serial.print("Firmware version: 0x"); Serial.println(version, HEX); Serial.println(); void loop()String GoodTag="False"; / Variable used to confirm good Tag Detected/ Check to see if a Tag was detected / If yes, then the variable FoundTag will contain "MI_OK" FoundTag = nfc.requestTag(MF1_REQIDL, TagData);if (FoundTag == MI_OK) delay(200);/ Get anti-collision value to properly read information from the Tag ReadTag = nfc.antiCollision(TagData); memcpy(TagSerialNumber, TagData, 4); / Write the Tag information in the TagSerialNumber variableSerial.println("Tag detected."); Serial.print("Serial Number: "); for (int i = 0; i 0) forward(); /going forward numberOfSteps -- ;/counting down the number of steps delay(100); FastLED.show(); for (int y = 0; y 0) backward(); /going backward numberOfSteps -- ;/counting down the number of steps Serial.println("LOW"); delay(100); Copy and paste this into a functions tab/these functions set the pin settings for each of the four steps per rotation of the motor (keepp in mind that the motor in the kit is geared down,/i.e. there are many steps necessary per rotationvoid Step_A() digitalWrite(pin1, HIGH);/turn on coil 1 digitalWrite(pin2, LOW); digitalWrite(pin3, LOW); digitalWrite(pin4, LOW); void Step_B() digitalWrite(pin1, LOW); digitalWrite(pin2, HIGH);/turn on coil 2 digitalWrite(pin3, LOW); digitalWrite(pin4, LOW); void Step_C() digitalWrite(pin1, LOW); digitalWrite(pin2, LOW); digitalWrite(pin3, HIGH); /turn on coil 3 digitalWrite(pin4, LOW); void Step_D() digitalWrite(pin1, LOW); digitalWrite(pin2, LOW); digitalWrite(pin3, LOW); digitalWrite(pin4, HIGH); /turn on coil 4 void step_OFF() digitalWrite(pin1, LOW); /power all coils down digitalWrite(pin2, LOW); digitalWrite(pin3, LOW); digitalWrite(pin4, LOW); /these functions run the above configurations in forward and reverse order /the direction of a stepper motor depends on the order in which the coils are turned on. void forward()/one tooth forward Step_A(); delay(delaytime); Step_B(); delay(delaytime); Step_C(); delay(delaytime); Step_D(); delay(delaytime); void backward()/one tooth backward Step_D(); delay(delaytime); Step_C(); delay(delaytime); Step_B(); delay(delaytime); Step_A(); delay(delaytime); Start the serial monitor and run the code.Press your card up to the sensor and write down the tag info.Replace the accepted tag info with your tag infoGet your container and cut open a hole for the button. Place all wiring into the box.Congratulations! Your Key Access Lock is now finished!

stepper motor related articles
Battery Saver Light Indicator Is On?
Null
Could a Window AC Unit Effectively Air Condition a Medium Sized Attic?
"A Redneck Republican Wearing an IUD": Colorado Lawmakers Use Birth Control Earrings to Push for Fam
Is This a Good Price for 2005 Acura TSX?

Copyright © 2020  Shandong Abusair Agricultural Machinery Co,. Ltd- |  Sitemap

Multifunctional farm Abusair machinery  |  Tea Professional Cultivator farm machinery