Yuav Ua Li Cas Txuas Cov RFID Nyeem RC522 Rau Arduino

Cov txheej txheem:

Yuav Ua Li Cas Txuas Cov RFID Nyeem RC522 Rau Arduino
Yuav Ua Li Cas Txuas Cov RFID Nyeem RC522 Rau Arduino

Video: Yuav Ua Li Cas Txuas Cov RFID Nyeem RC522 Rau Arduino

Video: Yuav Ua Li Cas Txuas Cov RFID Nyeem RC522 Rau Arduino
Video: Arduino Метро Единый билет RC522 Card Read Module RFID NFC 2024, Kaum ib hlis
Anonim

Hauv tsab xov xwm no, peb yuav saib qhov txuas ntawm RC522 RFID daim npav nyeem ntawv thiab cov keyfobs kev ua haujlwm ntawm lub zaus ntawm 13.56 MHz.

RFID nyeem RC522 nrog daim npav thiab fob qhov tseem ceeb
RFID nyeem RC522 nrog daim npav thiab fob qhov tseem ceeb

Nws yog qhov tsim nyog

  • - Arduino;
  • - RFID nyeem RC522;
  • - wireless RFID tag lossis metro / hauv av thauj daim pib;
  • - khoos phis tawj;
  • - txuas xov hlau.

Cov Lus Qhia

Kauj ruam 1

Qhov RFID-RC522 module raws li NXP MFRC522 nti. Qhov microcircuit no muab ob-txoj kev txuas wireless (txog 6 cm) kev sib txuas lus ntawm ntau zaus ntawm 13.56 MHz. RFID yog ib qho lus luv rau "Xov tooj cua zaus IDentification" thiab txhais ua "xov tooj cua kom paub".

MFRC522 microcircuit txhawb cov kev sib txuas sib txuas hauv qab no:

- SPI (Serial Peripheral Interface, cov ntu sib txuas rau kev sib txuas lus ntawm cov khoom siv hluav taws xob), muab cov ntaub ntawv hloov pauv ntawm mus txog 10 Mbit / s;

- ob-xaim I2C interface, nce mus txog 3400 kbaud nyob rau hauv hom kev kub ceev, nce mus txog 400 kbaud hauv hom ceev;

- serial UART (analogue RS232), nce kom ceev mus txog 1228, 8 kbaud.

Siv cov qauv no, koj tuaj yeem sau thiab nyeem cov ntaub ntawv los ntawm ntau cov cim npe ntawm RFID: fobs tseem ceeb los ntawm kev sib tshuam, daim npav yas hla thiab daim pib rau metro thiab hauv av thauj, nrog rau cov npe nrov ntawm NFC cov npe.

RFID-RC522 Wireless Module
RFID-RC522 Wireless Module

Kauj ruam 2

Cia peb txuas qhov RFID-RC522 module rau Arduino ntawm SPI interface raws li daim duab hauv qab no.

Cov qauv siv los ntawm lub ntsuas hluav taws xob los ntawm 2, 5 txog 3, 3 V. Peb txuas tus so ntawm lub pins mus rau Arduino raws li hauv qab no:

RST D9;

SDA (SS) - D10;

MOSI - D11;

MISO - D12;

SCK - D13.

Tsis tas li ntawd, nco ntsoov tias Arduino muaj nplooj siab ICSP header rau SPI kev ua haujlwm. Nws cov pinout tseem tau qhia hauv qhov kev piv txwv. Koj tuaj yeem txuas rau RST, SCK, MISO, MOSI thiab GND pins ntawm RC522 qhov txuas mus rau ICSP txuas ntawm Arduino.

Daim duab kev sib txuas RFID-RC522 SPI kev sib txuas
Daim duab kev sib txuas RFID-RC522 SPI kev sib txuas

Kauj ruam 3

MFRC522 microcircuit muaj cov haujlwm zoo heev. Koj tuaj yeem paub txog txhua yam kev tuaj yeem los ntawm kev kawm nws phau ntawv hla tebchaws (phau ntawv hla tebchaws). Txhawm rau kom paub txog lub peev xwm ntawm lub cuab yeej no, peb yuav siv ib qho ntawm cov ntawv sau tau npaj tseg rau Arduino ua haujlwm nrog RC522. Qhov kawg ntawm tsab xov xwm, koj tuaj yeem nrhiav qhov txuas rau ib qho ntawm cov tsev qiv ntawv hu ua rfid. Rub tawm nws thiab khaws nws mus rau% Arduino IDE% / cov tsev qiv ntawv / cov npe.

Txhim kho lub tsev qiv ntawv
Txhim kho lub tsev qiv ntawv

Kauj ruam 4

Tam sim no cia peb qhib cov piv txwv qhia: Cov Ntaub Ntawv -> Cov Qauv -> MFRC522 -> DumpInfo thiab thauj nws mus rau Arduino nco. Cov duab kos no txiav txim siab ntaus ntawv txuas nrog tus nyeem ntawv thiab nyeem cov ntaub ntawv sau rau ntawm daim npav RFID lossis daim npav, thiab tom qab ntawd tsim tawm nws mus rau qhov chaw nres nkoj serial. Cov ntawv sau ntawm cov duab kos yog zoo tawm tswv yim los ntawm cov neeg tsim tawm ntawm "rfid" lub tsev qiv ntawv, thiab ntau cov ntaub ntawv muaj txiaj ntsig ntawm kev ua haujlwm nrog lub tsev qiv ntawv muaj nyob hauv MFRC522.h.

Kos duab rau kev nyeem cov ntaub ntawv kaw rau ntawm RFID tag
Kos duab rau kev nyeem cov ntaub ntawv kaw rau ntawm RFID tag

Kauj ruam 5

Pib lub chaw nres nkoj serial nrog Ctrl + Shift + M sib xyaw ua ke, dhau ntawm Cov Cuab yeej cov ntawv qhia lossis khawm nrog lub khob loj. Tam sim no cia peb xa daim metro daim pib lossis lwm daim ntawv cim npe RFID rau tus nyeem ntawv. Lub chaw nres nkoj serial yuav qhia cov ntaub ntawv kaw rau ntawm RFID lossis daim pib. Piv txwv, hauv kuv tus kheej, tus lej cim daim pib, hnub yuav khoom, hnub tas sij hawm, tus naj npawb ntawm mus ncig ua si, nrog rau cov ntaub ntawv kev pabcuam raug muab zais ntawm no. Peb yuav txheeb xyuas hauv ib qho ntawm cov ntawv nyeem txog yav tom ntej dab tsi yog sau rau ntawm daim ntawv qhia chaw metro thiab chaw thauj hauv av.

Pom zoo: