Cov txheej txheem:

Yuav Siv RFID-RC522 Module Nrog Arduino: 5 Kauj Ruam
Yuav Siv RFID-RC522 Module Nrog Arduino: 5 Kauj Ruam

Video: Yuav Siv RFID-RC522 Module Nrog Arduino: 5 Kauj Ruam

Video: Yuav Siv RFID-RC522 Module Nrog Arduino: 5 Kauj Ruam
Video: Yuav siv tag nrho lub zog 2024, Kaum ib hlis
Anonim
Yuav Siv RFID-RC522 Module Nrog Arduino li cas
Yuav Siv RFID-RC522 Module Nrog Arduino li cas

Hauv Cov Lus Qhia no, Kuv yuav taug kev ntawm cov hauv paus ntsiab lus ua haujlwm ntawm RFID module ua ke nrog nws cov cim npe thiab cov chips. Kuv tseem yuav muab piv txwv luv luv ntawm qhov haujlwm kuv tau siv qhov qauv RFID no nrog RGB LED. Raws li ib txwm muaj nrog Kuv Cov Lus Qhia, Kuv yuav muab cov lus piav qhia luv hauv thawj ob peb kauj ruam thiab yuav tawm ib qho kev piav qhia ntxaws ntxaws, hauv cov kauj ruam kawg rau cov uas xav paub.

Khoom siv:

RC522 RFID Module + cim cim npe thiab daim npav-https://www.amazon.com/SunFounder-Mifare-Reader-Ar…

RGB LED + peb 220 ohm resistors

Kauj Ruam 1: Kev Sib Txuas Kho Vajtse

Kho vajtse sib txuas
Kho vajtse sib txuas

Hauv qhov haujlwm no kuv tau siv Arduino Mega, tab sis koj tuaj yeem siv ib qho microcontroller uas koj xav tau vim qhov no yog qhov haujlwm muaj peev txheej qis, tsuas yog qhov uas yuav txawv yog tus pin txuas rau SCK, SDA, MOSI, MISO, thiab RST txij li lawv txawv ntawm txhua pawg thawj coj saib. Yog tias koj tsis siv Mega, xa mus rau sab saud ntawm tsab ntawv no uas peb yuav siv sai:

RFID:

SDA (dawb) - 53

SCK (txiv kab ntxwv) - 52

MOSI (daj) - 51

MISO (ntsuab) - 50

RST (xiav) - 5

3.3v - 3.3v

GND - NCO

(Nco tseg: Txawm hais tias tus nyeem ntawv nruj me ntsis xav tau 3.3V, tus pin yog 5V zam, uas tso cai rau peb tuaj yeem siv tus qauv no nrog Arduinos thiab lwm yam 5V DIO microcontrollers)

RGB coj:

Liab Cathode (ntshav) - 8

GND - NCO

Ntsuab Cathode (ntsuab) - 9

Xiav Cathode (xiav) - 10

Kauj ruam 2: Software

Software
Software

Tam sim no mus rau lub software.

Ua ntej, peb yuav tsum teeb tsa lub tsev qiv ntawv MFRC522 kom tau txais, sau, thiab txheej txheem RFID cov ntaub ntawv. Qhov txuas github yog: https://github.com/miguelbalboa/rfid, tab sis koj tseem tuaj yeem nruab nws ntawm tus thawj tswj tsev qiv ntawv hauv Arduino IDE lossis ntawm PlatformIO. Ua ntej peb tuaj yeem tsim peb tus kheej, cov phiaj xwm tshwj xeeb los cuam tshuam nrog thiab txheej txheem RFID cov ntaub ntawv, thawj zaug peb yuav tsum tau txais qhov tseeb UID rau peb daim npav thiab cim npe. Txog qhov ntawd, peb yuav tsum xa daim duab no:

(Arduino IDE: piv txwv> MFRC522> DumpInfo)

(PlatformIO: PIO Tsev> tsev qiv ntawv> teeb tsa> MFRC522> piv txwv> DumpInfo)

Qhov kos duab no ua dab tsi yog qhov tseem ceeb rho tawm txhua cov ntaub ntawv tam sim no hauv daim npav, suav nrog UID hauv daim ntawv hexadecimal. Piv txwv, UID ntawm kuv daim npav yog 0x72 0x7D 0xF5 0x1D (saib daim duab). Tus so ntawm cov qauv luam tawm cov ntaub ntawv yog cov ntaub ntawv muaj nyob hauv daim npav uas peb tuaj yeem nyeem lossis sau rau. Kuv yuav mus rau qhov tob hauv ntu kawg.

Kauj Ruam 3: Software (2)

Software (2)
Software (2)

Raws li ib txwm muaj nrog Kuv Cov Lus Qhia, Kuv yuav piav qhia cov software hauv kab lus-kab-kab lus kom txhua feem ntawm txoj cai tuaj yeem piav qhia txog nws txoj haujlwm hauv seem ntawm tsab ntawv, tab sis qhov nws tseem ceeb ua yog txheeb xyuas daim npav nyeem thiab ib qho nyiaj pab lossis tsis kam nkag mus. Nws kuj tseem qhia tawm cov lus zais yog tias daim npav raug txheeb xyuas ob zaug.

github.com/belsh/RFID_MEGA/blob/master/mfr….

Kauj Ruam 4: RFID; Piav qhia

RFID; Piav qhia
RFID; Piav qhia

Hauv tus nyeem ntawv, muaj Xov Tooj Cua Zaus thiab tus kav hlau txais xov uas tsim hluav taws xob. Daim npav, ntawm qhov tod tes, muaj cov nti uas tuaj yeem khaws cov ntaub ntawv thiab tso cai rau peb hloov kho nws los ntawm kev sau ntawv mus rau ib qho ntawm nws ntau qhov thaiv, uas kuv yuav mus rau hauv kev nthuav dav ntxiv hauv ntu tom ntej vim nws poob qis hauv RFID cov ntaub ntawv qauv.

Lub hauv paus ntsiab lus ua haujlwm ntawm RFID kev sib txuas lus yog ncaj ncaj. Tus nyeem ntawv tus kav hlau txais xov (hauv peb qhov xwm txheej, tus kav hlau txais xov ntawm RC522 yog cov txheej txheem zoo ib yam nyob rau ntawm lub ntsej muag) uas yuav xa tawm xov tooj cua nthwv dej, uas nyob rau hauv lem yuav txhawb lub kauj hauv daim npav/tag (nyob ze ze) thiab qhov ntawd kev hloov pauv hluav taws xob yuav siv los ntawm lub transponder (ntaus ntawv uas tau txais thiab tso tawm xov tooj cua ntau zaus) hauv daim npav xa rov qab cov ntaub ntawv khaws tseg hauv nws raws li ntau lub xov tooj cua yoj. Qhov no hu ua backscatter. Hauv ntu tom ntej, kuv yuav tham txog cov qauv ntaub ntawv tshwj xeeb uas siv los ntawm daim npav/cim npe khaws cov ntaub ntawv uas peb tuaj yeem nyeem lossis sau rau.

Kauj Ruam 5: RFID; Piav qhia (2)

RFID; Piav qhia (2)
RFID; Piav qhia (2)

Yog tias koj saib rau sab saud ntawm peb cov ntawv sau ua ntej, koj yuav pom tias daim npav hom yog PICC 1 KB, txhais tau tias nws muaj 1 KB ntawm kev nco. Lub cim xeeb no tau faib rau hauv cov ntaub ntawv qauv tsim los ntawm 16 ntu uas nqa 4 ntu, txhua qhov uas nqa 16 bytes ntawm cov ntaub ntawv (16 x 4 x 16 = 1024 = 1 KB). Qhov thaiv zaum kawg hauv txhua ntu (AKA Sector Trailer) yuav raug tshwj tseg rau kev tso cai nyeem / / sau nkag mus rau lwm qhov kev lag luam, uas txhais tau tias peb tsuas muaj thawj 3 ntu ua haujlwm nrog rau kev khaws thiab nyeem cov ntaub ntawv.

(Nco tseg: thawj ntu ntawm ntu 0 hu ua Chaw Tsim Khoom Thaiv thiab muaj cov ntaub ntawv tseem ceeb xws li cov ntaub ntawv chaw tsim khoom; hloov pauv qhov thaiv no tuaj yeem kaw koj daim npav tas li yog li ceev faj thaum sim sau cov ntaub ntawv rau nws)

Zoo siab tinkering.

Pom zoo: