Question

I need a code an arduino code that works with RFID RC522, 4 x4 Matrix Keypad,...

I need a code an arduino code that works with RFID RC522, 4 x4 Matrix Keypad, 2 LEDS and 1602 I2C LC Display

I am building a project for school security, So the user must use their ID to access the system. When access is granted then student has the options to choose 1 or 2 ... (1) Green LED = Safe (2) Red LED = Danger .. I am also thinking about adding a camera to the system but IDK how to wire that. But If I do the camera only turns on when option 2 is picked.

RFID - verify user ID

4 x4 Matrix Keypad - Second security input only if the red LED IS on

1602 I2C LC Display - Display the result to show access granted and access decline

My pins are for RFID

3.3V to 3.3V

RST to digital 9

GND to GND

MISO to digital 11

MIST to digital 12

SCK to digital 13

SOA to digital 10

My pins for LCD

GND to GND

5V to 5V

SCL to A5

SDA to A4

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Just download the library from https://bit.ly/2qLqh9D. I am assuming you know how to add a library to your Arduino IDE. I haven't used camera with Arduino. Arduino is generally for small size signals like electrical signals. If you want to go to a little high level just like your camera functionality you can you Raspberry Pi or any other SoC board which have more capabilities. I am not saying that in Arduino you are limited to a small scope but then it gets difficult to run many things at a time considering it has very low memory and clock speed. Here is the code for your complete project except for the camera part. Most of the code is very easy to understand, but if you are stuck somewhere seeing so many weird expressions then skip that part because those are mostly library calls and needs a little more experience to understand, not at all difficult to understand just you need to be able to relate its implementation which comes with experience. Hope this will work for your project. If you have issues then please comment below. And give me a thumbs up. Thanks :)

#include <SPI.h>

#include <MFRC522.h>

#include <LiquidCrystal.h>

#include <Keypad.h>

// RFID
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);

// LCD
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);//RS,EN,D4,D5,D6,D7

// 4x4 Kepad
const byte ROWS = 4;

const byte COLS = 4;

char keys[ROWS][COLS] = {

{'1','2','3','A'},

{'4','5','6','B'},

{'7','8','9','C'},

{'#','0','*','D'}

};

byte rowPins[ROWS] = {0, 1, 2, 3};

byte colPins[COLS] = {4, 5, 6, 7};

Keypad kpd = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

// LEDs
const int greenPin = A0;
const int redPin = A1;

void setup() {
Serial.begin(9600);
SPI.begin();   
mfrc522.PCD_Init();
for(int k = 8;k < 14;k++) {
pinMode(k,OUTPUT);
}
lcd.begin(16, 2);
}

void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
content.toUpperCase();
String check = "BD 31 15 2B"; //change here the UID of the card/cards that you want to give access
if (content.substring(1) == "BD 31 15 2B") {
lcd.print("Authorized access");
analogWrite(greenPin, 255);
delay(3000);
analogWrite(greenPin, 0);
}
else {
lcd.print("Access denied");
analogWrite(redPin, 255);
delay(3000);
analogWrite(redPin, 0);
}
lcd.clear();
if (key != NO_KEY) {
lcd.print(key); //showing pressed character on LCD
}
delay(1000);
}

Add a comment
Know the answer?
Add Answer to:
I need a code an arduino code that works with RFID RC522, 4 x4 Matrix Keypad,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT