Post Top Ad

Post Top Ad

Baca data RFID card dengan RDM6300, arduino, lalu tulis data RFID ke SDcard (Dinamis File Name pada SDcard)

Alat dan bahan :

Arduino uno

Sdcard module (catalex product) + SD card nya

Kabel jumper male to female

Power supply bisa via usb , bisa via adaptor 7-15 volt

RDM6300 + antena

RFID tag 125khz

LCD 2x16

Variabel resistor 20 kilo ohm


library yang digunakan :

1 SD card
2 Software serial
3 LCD


Konfigurasi PIN LCD

/*

 The circuit:
 * LCD RS pin to digital pin 10
 * LCD Enable pin to digital pin 9
 * LCD D4 pin to digital pin 8
 * LCD D5 pin to digital pin 7
 * LCD D6 pin to digital pin 6
 * LCD D7 pin to digital pin 5
 * LCD R/W pin to ground
 * 20K var resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
  */

Konfigurasi PIN RDM 6300

VCC - 5 volt
GND- GND
TX to digital pin 2 arduino
antena to antenna


konfigurasi pin SD card module


 ** MOSI - pin 11 on Arduino Uno
 ** MISO - pin 12 on Arduino Uno
 ** CLK - pin 13 on Arduino Uno
 ** CS -  Pin 4 Arduino Uno
 ** VCC - 5 volt
 ** GND - GND



Arduino uno + LCD + RDM6300 + RFID tag 125 KHz
Arduino uno + LCD + RDM6300 + RFID tag 125 KHz

Arduino uno + LCD + RDM6300 + RFID tag 125 KHz
Arduino uno + LCD + RDM6300 + RFID tag 125 KHz

Arduino uno + LCD + RDM6300 + RFID tag 125 KHz
Arduino uno + LCD + RDM6300 + RFID tag 125 KHz

Arduino uno + LCD + RDM6300 + RFID tag 125 KHz
Arduino uno + LCD + RDM6300 + RFID tag 125 KHz

Arduino uno + LCD + RDM6300 + RFID tag 125 KHz
Arduino uno + LCD + RDM6300 + RFID tag 125 KHz


sketch / source code arduino nya :

/*


 The circuit:
 * LCD RS pin to digital pin 10
 * LCD Enable pin to digital pin 9
 * LCD D4 pin to digital pin 8
 * LCD D5 pin to digital pin 7
 * LCD D6 pin to digital pin 6
 * LCD D7 pin to digital pin 5
 * LCD R/W pin to ground
 * 20K var resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
  */

#include <SD.h>

#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3); // RX and TX

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(10, 9, 8, 7, 6, 5);


char character;//data rfid
String our_id;//data rfid


File myFile; //clas untuk nulis file ke mmc --> 12345678txt

int i;// baca rfid per


void setup()
{
  RFID.begin(9600);    // start serial to RFID reader
  Serial.begin(9600);  // start serial to PC

  lcd.begin(16, 2);
  lcd.print("RFID Register");
  lcd.setCursor(0, 1);
  lcd.print("Access System");
   delay(2000);
  
  lcd.setCursor(0, 0);
  lcd.print("                ");
  lcd.setCursor(0, 1);
  lcd.print("                ");

  lcd.begin(16, 2);
  lcd.print("System Access");
  lcd.setCursor(0, 1);
  lcd.print("Ready");
   //delay(2000);  


 // Open serial communications and wait for port to open:

  // while (!Serial) {
 //   ; // wait for serial port to connect. Needed for Leonardo only
//  }


  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  // pinMode(10, OUTPUT);
  
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  
}

void loop()
{
 
 
   while(RFID.available()>0)
  {
      character = RFID.read();
      our_id += character;
  }

  if (our_id.length() > 10) {
      our_id = our_id.substring(1,13);
      Serial.print("our_id --> ");
      Serial.println(our_id);
     
          
  String  temp= "";
  temp += our_id;
  temp += ".txt";//
 
  Serial.print("temp  --> ");
  Serial.println(temp);

  char filename[temp.length()-7];//--> 'index dalam pemrograman itu diawali dengan 0 ,1,2,3,4,5,6,7
  temp.toCharArray(filename, sizeof(filename));
  myFile = SD.open(filename, FILE_WRITE); 
   myFile.close();
  
  Serial.print("filename  --> ");
  Serial.println(filename);
 
  lcd.setCursor(0, 0);
  lcd.print("                ");
  lcd.setCursor(0, 1);
  lcd.print("                ");
      
  lcd.setCursor(0, 0); 
  lcd.print(filename);
  lcd.setCursor(0, 1);
  lcd.print("Terdaftar");
   delay(1000);
//    lcd.setCursor(0, 0);
//     lcd.print("                ");
//      lcd.setCursor(0, 1);
//       lcd.print("                ");
 
   // Check to see if the file exists:
  if (SD.exists(filename)) {
    Serial.print(filename); 
    Serial.println(".txt exists.");
  }
  else {
    Serial.print(filename); 
    Serial.println(".txt doesn't exist."); 
  }
 
 

 

   myFile.close();
  our_id="";  
   
  }  
}


NB :

catatan --> sketch   char filename[temp.length()-7];//--> 'index dalam pemrograman itu diawali dengan 0 ,1,2,3,4,5,6,7

menunjukkan bahwa RFID di copy sebanyak 8 digit awal, total ada 12 digit, namun penamaan file pada SDcard hanya di izinkan maksimal 8 digit karakter,

Selamat berekperiment


 
Contact Person : Taufik Adi Sanjaya
No HP / Whats App : 0823 2613 3990
PIN BBM 5983E244
Alamat : Jalan Imogiri Timur KM 11, 
Blawong 1 , RT 01, Trimulyo, 
Jetis, Bantul 55781.

Anda membutuhkan komponen elektronik , Arduino, Sensor, Tutorial(paket belajar), jasa pembuatan alat berbasis mikrokontroler, kendali lampu via jaringan LAN, led running teks, pengendali lampu  atau peralatan listrik lainnya via internet dan sebagainya ? anda dapat membelinya di www.kedaiarduino.com
 www.kedaiarduino.com