Schlagwort-Archive: Arduino

RFID / Arduino : Copy a card with known keys,

General:

Today I want to show you how to copy a Mifare classic card with the arduino mega and the rfid-rc522 module.

Requirements:

  • Card Reader
  • Arduino Mega
  • Arduino Library
  • Existing RFID Card ( in this example a Mifare Classic 1k )
  • New empty RFID Card

Card Reader

Recently I bought a RFID-RC522 Module from aliexpress( ~ 5$ ) .

RFID Module Board RC522
RFID Module Board RC522
Connect the board with the Arduino Mega.
 
 *-----------------------------------------------------------------------
 * Pin layout should be as follows:
 * Signal Pin Pin Pin
 * Arduino Mega MFRC522 board
 * ------------------------------------------------------------
 * Reset      5    RST
 * SPI SS    53    SDA
 * SPI MOSI  51    MOSI
 * SPI MISO  50    MISO
 * SPI SCK   52    SCK
 *
 * #Note: Code will work not with Arduino UNO because of not enough SRAM
 

Arduino Mega

I used an Arduino  MEGA 2560, because UNO had to lees RAM. Note: We have to read a 1K card and keep this in memory.

Arduino Library

For accessing there exists a lot of arduino libraries in the net. I do not know which library I used exactly, think it was from here. https://github.com/miguelbalboa/rfid

Existing RFID Card

mifare_classic_1K In my example I used an existing Mifare Classic 1K card. This piece of code gives you info about your card. Serial.print(" PICC type: "); // Dump PICC type byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak); Serial.println(mfrc522.PICC_GetTypeName(piccType));

New empty RFID Card

Any new card. Please note that the UID number of an existing card couldn’t be copied. The UID number of an new card is normally read only, and programmed by the manufactory of the cards. Except, so called >> Chinese magic rfid card<<. My code example do not try to write the read UID number to the new card.

Code

In general I am a little bit lazy to give you a big explanation about the code. Just download it and go through… But okay some info’s I want to give you: Please note: serial baud rate is 57600 Please do not forget to change your keys

 byte KeyA_List[][6] =
 {
 {150,161,162,166,164,165}, // Sector 0
 ....
 byte KeyB_List[][6] =
 {
 {134,135,136,137,138,139}, // Sector 0
 

Basic flow: Idea is to read a card , dump this information


byte mydumpdata[MAX_SECTOR][MAX_BLOCK_SECTOR][MAX_DATA_BLOCK];

and also add the KEY A and KEY B infos to the dumped data. see comments in my code


// Special note on KEY_A / KEY_B
// see datasheet
// When the sector trailer is read, the key bytes are blanked out by returning logical zeros. If
// Key B is configured to be readable, the data stored in bytes 10 to 15 is returned, see

So this is my first version. https://github.com/ebc81/RFIDCopyMaschine/tree/RFIDCopyMaschine

Advertisements

Mini Thermal Printer QR701

Ich habe mir einen Mini Thermal Printer QR701 (EH48-20243)  aus China bestellt.
Der Printer druckt eine Testseite wenn man hinten auf der Platine den Schalter betätigt.

Mini Thermal Printer

Bei mir jedoch nicht….
Jetzt habe ich den Grund gefunden, ich habe ein zu schwaches Netzteil verwendet (1 A ).Mit einem stärkeren hat es funktioniert..

Noch ein Tipp:
Pinbelgeung beachten !
GND RX TX DTR VH
RX Pin ist Blau
TX Pin ist Grün
DTR Pin ist Gelb ( den unbedingt auf GND legen )

Hier noch einige Dokumente…
701print driver board –> pdf

701print driver board  –> word

2015/06/23
Here is my sketch I used for testing:
printertest_sketch

I also make some modifications on the Adafruit_Thermal library.
(which is not any more needed if you are using the latest library version, see example form library)
Adafruit_Thermal

It is basically the baud rate: –> Changed to 9600 !
diff Adafruit thermal printer lib

Latest Adafruit Library is on git hub
https://github.com/adafruit/Adafruit-Thermal-Printer-Library

Check also a other blog about the Mini Thermal Printer:
http://blog.goo.ne.jp/sabotenboy_london/e/9f8e50132b4554bce48f481f5ddbf874