0% found this document useful (0 votes)
81 views8 pages

Rfid + LCD

This document provides wiring instructions for connecting an RFID module and LCD display to an Arduino board. It specifies the pin connections for the RFID module including MOSI, MISO, SCK, SDA/SS, RST, 3.3V and GND. It also lists the pin connections for the LCD display including GND, VCC, contrast, RS, RW, EN and the data pins. The code sample shows how to initialize the RFID and LCD modules, read card data, check for valid card IDs and control a door lock and buzzer accordingly.

Uploaded by

Arman muchammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views8 pages

Rfid + LCD

This document provides wiring instructions for connecting an RFID module and LCD display to an Arduino board. It specifies the pin connections for the RFID module including MOSI, MISO, SCK, SDA/SS, RST, 3.3V and GND. It also lists the pin connections for the LCD display including GND, VCC, contrast, RS, RW, EN and the data pins. The code sample shows how to initialize the RFID and LCD modules, read card data, check for valid card IDs and control a door lock and buzzer accordingly.

Uploaded by

Arman muchammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

WIRING MODUL RFID KE ARDUINO

MOSI : PIN D11

MISO : PIN D12

SCK : PIN D13

SDA/SS : PIN D10

RST : PIN D9

RQ : -

3.3V : DI HUBUNGKAN KE 3.3V ARDUINO..AWAS SALAH 5V Y GAN

GND : PIN GND

PIN D8 arduino di hubungkan ke resistor

WIRING LCD 16x2 KE ARDUINO

1 GND ke GND

2 VCC ke 5V

3 COTRAST dari vr (potensiometer)

4 RS ke PORT D7

5 RW ke GND

6 EN ke PORT D6

7 0 tidak di pakai

8 1 tidak di pakai

9 2 tidak di pakai

10 3 tidak di pakai

11 4 ke PORT D5 ARDUINO
12 5 ke port D4 ARDUINO

13 6 ke PORT D3 ARDUINO

14 7 ke PORT D2 ARDUINO

15 +backlight ke +5v

16 -backlight ke GND

#include <RFID.h>

#include <LiquidCrystal.h>

#include <Wire.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

#include <SPI.h>

#define SS_PIN 10

#define RST_PIN 9

RFID rfid(SS_PIN,RST_PIN);
const int buzzer = 1;

const int doorLock = 8;

int serNum[5];

int cards[][5]= { //ID KARTU YG BOLEH MASUK

{52,80,74,255,209},{22,163,98,139,92}

};

bool access = false;

int alarm = 0;

uint8_t alarmStat = 0;

uint8_t maxError = 5;

//gariss

void setup(){

lcd.begin(16, 2);

Serial.begin(9600);
SPI.begin();

rfid.init();

pinMode(doorLock, OUTPUT);

digitalWrite(doorLock, HIGH);

tone (buzzer,1200);

lcd.setCursor (0,0);

lcd.print(F(" +RFID System+ "));

lcd.setCursor (0,1);

lcd.print(F(" by farid "));

delay (5000);

lcd.clear();

noTone (buzzer);

void loop(){

if (alarm >= maxError){

alarmStat = 1; }

if (alarmStat == 0){

lcd.setCursor (0,0);

lcd.print(F(" -System Ready- "));

lcd.setCursor (0,1);

lcd.print(F(" Scan Your Card "));


if(rfid.isCard()){

if(rfid.readCardSerial()){

if(rfid.readCardSerial()){

Serial.print(rfid.serNum[0]);

Serial.print(" ");

Serial.print(rfid.serNum[1]);

Serial.print(" ");

Serial.print(rfid.serNum[2]);

Serial.print(" ");

Serial.print(rfid.serNum[3]);

Serial.print(" ");

Serial.print(rfid.serNum[4]);

Serial.println("");

for(int x = 0; x < sizeof(cards); x++){

for(int i = 0; i < sizeof(rfid.serNum); i++ ){

if(rfid.serNum[i] != cards[x][i]) {

access = false;

break;

} else {

access = true;

}
if(access) break;

if(access){

Serial.println("Welcome!");

lcd.setCursor (0,0);

lcd.print(F(" Akses diterima "));

lcd.setCursor (0,1);

lcd.print("ID:");

lcd.print(rfid.serNum[0]); lcd.print(rfid.serNum[1]);

lcd.print(rfid.serNum[2]); lcd.print(rfid.serNum[3]);

lcd.print(rfid.serNum[4]);

digitalWrite(doorLock, LOW);

tone (buzzer,900);

delay(100);

tone (buzzer,1200);

delay(100);

tone (buzzer,1800);

delay(200);

noTone(buzzer);

delay(600);

lcd.setCursor (0,0);

lcd.print(F(" Silahkan Masuk "));


lcd.setCursor (0,1);

lcd.print(F("AutoLock after "));

for(int i=5; i>0; i--){

lcd.setCursor (15,1); lcd.print(i);

delay (1000);

digitalWrite(doorLock, HIGH);

lcd.clear();

}else {

alarm = alarm+1;

Serial.println("Not allowed!");

lcd.setCursor (0,0);

lcd.print(F(" Akses ditolak "));

lcd.setCursor (0,1);

lcd.print("ID:");

lcd.print(rfid.serNum[0]); lcd.print(rfid.serNum[1]);

lcd.print(rfid.serNum[2]); lcd.print(rfid.serNum[3]);

lcd.print(rfid.serNum[4]);

tone (buzzer,900);

delay(200);

noTone(buzzer);

delay(200);

tone (buzzer,900);

delay(200);
noTone (buzzer);

delay(500);

lcd.clear();

You might also like