RFID Shield For Arduino
The RFID Access Control Shield from rhydoLABZ transforms your Arduino to an access control device. This unit is compatible with RFID modules such as micro RFID, EM-18 and ID-3LA. Onboard relay driving circuitry helps your Arduino to control magnetic locks, solenoid valve etc. The 5V buzzer provided on board can be used for indicating the RFID card acceptance
Features
- Compatible with Arduino R3 Layout
- Compatible with RFID modules such as μRFID, EM-18 and ID-3LA
- Reset switch (SW1) to reset Arduino
- On-board push button switch (SW2) connected to digital pin 10 of Arduino
- Supports both hardware serial (pins 0 & 1) and software serial communication as selected by jumpers J3 & J4. Software serial pins are:
- S-TX – digital pin 3
- S-RX – digital pin 2
- DPDT slide switch (SW3) selects 2 modes for hardware serial communication
- USB mode – reader communicates directly via USB of Arduino
- Arduino mode – reader communicates with Arduino controller
- Pinout (K3) for connecting External Antenna for ID-3LA reader
- Digital pin 7 of Arduino can be used to reset RFID reader 3LA (applicable only for this reader)
- RMC connector (K2) for WIEGAND output
- All modules other than relay powered from Arduino board
- On-board Relay with screw terminals (K1 & K4) for connection
- 3 LEDS ,Power, Relay Status and Program controlled
- On-board buzzer that can be triggered by Arduino / reader as selected by jumper J6
Hardware Overview
Jumper Description
- J1(BUZR) – Short to enable the buzzer.
- J2 – TX Pull down (to be used with 3V3 Arduino Boards)
- J3 – Selects H-Rx or S-Rx for reception
- J4 – Selects H-Tx or S-Tx for transmission
- J5 – RX Pull down (to be used with 3V3 Arduino Boards)
- J6 – Selects if buzzer is triggered by reader or Arduino
- Reader triggers the buzzer automatically if card is detected
- If Arduino is used, make digital pin 8 LOW to turn it on.
- J7(only for EM-18) – Short to select Wiegand26 data format. Leaving it open gives ASCII output.
- J8(only for 3LA) – Data format selection
- FORMAT – +5V : Wiegand26
- FORMAT – Ground : ASCII
- FORMAT – LED : Magnet emulation
LEDs
- PWR (Blue) – Power indication, turns on when the shield is powered
- RLY (Green) – Turns on automatically when the relay is activated
- STS (Red) – LED connected to digital pin 12 of Arduino,
program controlled
Buzzer
- Can be used as audio indicator
- Short J1 to enable the buzzer
- Triggered by reader or digital pin 8 of Arduino as selected by J6
- If the J6 is set to Module, the buzzer gets triggered by the reader automatically on valid card detection
- If Arduino is selected, then the buzzer can be triggered by making D8 LOW
Relay
- Controlled by digital pin 9 of Arduino
- Power the relay separately through K1. Give connections as follows
- RL +V – 12 V DC
- GND – ground
- Relay terminals (COM, N/C & N/O) are brought out on K4
- RLY LED(Green) turns on automatically when the relay is activated
Switch
- Reset switch (SW1) to reset Arduino
- Push button switch (SW2) connected to digital pin 10 of Arduino. The pin reads LOW if SW2 is pressed
Using 3LA
- Connect external antenna on K3
- Select desired data format (ASCII / Wiegand26 / Magnetic ABA Track2) using J8
- If serial output is selected, select the destination as Arduino / PC using the DPDT slide switch
- Wiegand26 and magnetic emulation data via K2
- Module can be reset with digital pin 7 of Arduino
Using EM-18 / μRFID
- Output will be ASCII data if J7 is open. Short J7 for Wiegand26 data format
- If serial output is selected, select the destination as Arduino / PC(USB) using the DPDT slide switch
- Wiegand26 output via K2
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
/***** Variables Declaration *****/ char j = 0, x; char Card_No[13]; char rfid_N0[4][13] = { "02000E6897F3","140055BD38C4","140050892CE1","140050B7E81B" }; boolean dataReceived = false; int BUZZER = 8; // Buzzer attached to digital pin 8 of Arduino int RELAY = 9; // Relay attached to digital pin 9 of Arduino int STS_LED = 12; // LED attached to digital pin 12 of Arduino #define BEEP_DURATION 100 /***** Function to beep the buzzer *****/ void beep(unsigned char delayms) { analogWrite(BUZZER, 20); // Almost any value can be used except 0 and 255 // Experiment to get the best tone delay(delayms); // Wait for delayms ms analogWrite(BUZZER, 0); // 0 turns it off digitalWrite(BUZZER, HIGH); delay(delayms); // Wait for delayms ms } void setup() { pinMode(BUZZER, OUTPUT); // Configure buzzer pin as output digitalWrite(BUZZER , HIGH); // Turn off buzzer initially pinMode(RELAY, OUTPUT); // Configure relay pin as output digitalWrite(RELAY , LOW); // Turn off relay initially pinMode(STS_LED, OUTPUT); // Configure LED pin as output digitalWrite(STS_LED , LOW); // Turn off LED initially Serial.begin(9600); // Initialize the serial communication at 9600 baud delay(1000); Serial.println("RFID Based Login"); // Print message on serial monitor Serial.println(" System "); Serial.println("Use your Tag to "); Serial.println("Login "); } void loop() { if(dataReceived == true) // True after intake of 12 characters { Serial.println("Found "); // Print message on serial monitor Serial.println("ID: "); Serial.println(Card_No); if(!strcmp(rfid_N0[0],Card_No)) // Compare the ID with the stored ID { Serial.println("Login Succeeded "); // Print message on serial monitor beep(BEEP_DURATION); // Make a single beep sound Serial.println(" THANK YOU "); digitalWrite(RELAY, !digitalRead(RELAY)); // Toggle relay and STS_LED digitalWrite(STS_LED, !digitalRead(STS_LED)); } else if(!strcmp(rfid_N0[1],Card_No)) { Serial.println("Login Succeeded "); beep(BEEP_DURATION); Serial.println(" THANK YOU "); digitalWrite(RELAY, !digitalRead(RELAY)); digitalWrite(STS_LED, !digitalRead(STS_LED)); } else if(!strcmp(rfid_N0[2],Card_No)) { Serial.println("Login Succeeded "); beep(BEEP_DURATION); Serial.println(" THANK YOU "); digitalWrite(RELAY, !digitalRead(RELAY)); digitalWrite(STS_LED, !digitalRead(STS_LED)); } else if(!strcmp(rfid_N0[3],Card_No)) { Serial.println("Login Succeeded "); beep(BEEP_DURATION); Serial.println(" THANK YOU "); digitalWrite(RELAY, !digitalRead(RELAY)); digitalWrite(STS_LED, !digitalRead(STS_LED)); } else { Serial.println("Login Failed "); /* If the IDs do not match, print the messsage */ beep(BEEP_DURATION); /* and beep the buzzer twice */ beep(BEEP_DURATION); } dataReceived = false; } else // If no tag is read, print the message { Serial.println("Use your Tag to "); Serial.println("Login "); delay(3000); } } void serialEvent() { while (Serial.available()) { Card_No[j++] = (char)Serial.read(); // Store the tag ID if(j == 12) { Card_No[j]='\0'; // Terminate the array when all the 12 characters are read j = 0; // Reset the array index dataReceived = true; } } } /*************************** END OF PROGRAM ***************************/ |
Resources
- Tutorials
Shop with us
Leave a Reply
You must be logged in to post a comment.