Cov txheej txheem:

Arduino RFID Xauv Tutorial: 6 Kauj Ruam (nrog Duab)
Arduino RFID Xauv Tutorial: 6 Kauj Ruam (nrog Duab)

Video: Arduino RFID Xauv Tutorial: 6 Kauj Ruam (nrog Duab)

Video: Arduino RFID Xauv Tutorial: 6 Kauj Ruam (nrog Duab)
Video: SCHOOL PROJECT 1 : CSE VIDEO 2024, Kaum ib hlis
Anonim
Image
Image
Arduino RFID Xauv Tutorial
Arduino RFID Xauv Tutorial
Arduino RFID Xauv Tutorial
Arduino RFID Xauv Tutorial

Nyob zoo cov phooj ywg zoo siab txais tos rau Lwm Cov Lus Qhia. Nov yog Nick los ntawm educ8s.tv thiab niaj hnub no peb yuav kawm paub siv RFID Reader nrog Arduino li cas txhawm rau txhim kho lub kaw lus yooj yim.

Thawj thawj zaug, peb yuav siv RFID cim npe nrog Arduino. Kuv tau tsim txoj haujlwm yooj yim uas nyeem Qhov Cim Cim (UID) ntawm txhua daim ntawv cim npe RFID peb tso ze rau tus nyeem ntawv thiab nthuav tawm nws ntawm cov zaub OLED no. Yog tias UID ntawm daim ntawv sib npaug rau tus nqi ua ntej uas tau khaws cia hauv Arduino lub cim xeeb, tom qab ntawd hauv cov zaub peb yuav pom cov lus "Xauv". Yog tias Tus ID tshwj xeeb ntawm daim npav tsis sib npaug rau tus nqi ua ntej, Cov Lus Xauv yuav tsis tshwm. Cool tsis yog?

Muaj ntau yam los npog, yog li cia peb pib!

Kauj Ruam 1: Tau Txais Txhua Qhov

Tau Txhua Qhov
Tau Txhua Qhov

Cov ntu xav tau txhawm rau txhawm rau tsim txoj haujlwm no yog cov no:

  • Ib Arduino Uno ▶
  • Tus nyeem ntawv RFID ▶
  • OLED zaub:
  • Ib daim ntawv me me ▶
  • Qee cov xov hlau:

Yeem Tsis Tau:

Powerbank ▶

Tus nqi tag nrho ntawm txoj haujlwm yog kwv yees $ 15.

Kauj Ruam 2: RC522 RFID Reader

RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv
RC522 RFID nyeem ntawv

Txhua lub cim npe RFID muaj lub me me nti sab hauv. Yog tias kuv tso lub teeb nyem nyob hauv qab daim npav RFID no koj tuaj yeem pom cov nti me thiab cov kauj uas nyob ib puag ncig nws. Cov nti no tsis muaj lub roj teeb txhawm rau kom tau txais lub zog. Nws tau txais lub zog los ntawm tus nyeem ntawv, lub cuab yeej no, siv lub xov tooj cua loj no tau siv tau yooj yim. Tus nyeem ntawv tuaj yeem nyeem daim npav RFID zoo li qhov no los ntawm qhov deb mus txog 20mm!

Tib lub ntsej muag muaj nyob hauv cov cim tseem ceeb RFID cim npe ib yam.

Txhua daim npav RFID muaj tus lej tshwj xeeb uas qhia nws. Qhov ntawd yog UID uas peb tso tawm ntawm OLED zaub. Tsuas yog los ntawm UID no, txhua daim ntawv tuaj yeem khaws cov ntaub ntawv. Hauv daim npav hom no peb tuaj yeem khaws txog 1K ntawm cov ntaub ntawv! Impressive tsis yog nws? Peb yuav tsis siv qhov kev ua haujlwm niaj hnub no tab sis yuav ua li ntawd yav tom ntej Qhia. Hnub no, txhua yam peb xav paub yog txhawm rau txheeb xyuas daim npav tshwj xeeb los ntawm nws UID. Tus nqi ntawm tus nyeem ntawv RFID thiab ob daim npav RFID no nyob ib puag ncig $ 4.

Kauj Ruam 3: OLED Zaub

Image
Image
Txuas Txhua Qhov
Txuas Txhua Qhov

Qhov no yog cov zaub zoo heev los siv nrog Arduino. Nws yog OLED zaub thiab txhais tau tias nws muaj lub zog siv hluav taws xob tsawg. Lub zog siv hluav taws xob ntawm cov zaub no nyob ib puag ncig 10-20 mA thiab nws nyob ntawm seb muaj pes tsawg lub pixels ci.

Cov zaub muaj kev daws teeb meem ntawm 128 × 64 pixels thiab nws yog qhov me me. Muaj ob qhov kev hloov pauv ntawm cov zaub. Ib ntawm lawv yog monochrome, thiab lwm qhov zoo li qhov kuv siv tuaj yeem tso tawm ob xim, daj thiab xiav. Sab saud ntawm lub vijtsam tsuas tuaj yeem pom daj, qis dua tsuas yog xiav.

Cov zaub OLED no ci heev, thiab nws muaj kev txhawb nqa lub tsev qiv ntawv zoo. Adafruit tau tsim lub tsev qiv ntawv zoo heev rau cov zaub no. Ntxiv rau qhov ntawd, cov zaub siv I2C interface, yog li kev txuas nrog Arduino yog qhov yooj yim kawg. Koj tsuas yog yuav tsum txuas ob lub xov tooj tshwj tsis yog Vcc thiab GND. Yog tias koj yog tus tshiab rau Arduino thiab koj xav tau qhov pheej yig thiab yooj yim siv cov zaub los siv nrog koj txoj haujlwm, pib nrog zaub. Nws yog txoj hauv kev yooj yim tshaj plaws los ntxiv cov zaub rau koj qhov project Arduino. Kuv tau npaj cov lus qhia ntxaws ntxaws txog yuav siv cov zaub no li cas uas kuv tau txuas nrog Cov Lus Qhia no.

Kauj Ruam 4: Txuas Txhua Qhov

Txuas Txhua Qhov
Txuas Txhua Qhov
Txuas Txhua Qhov
Txuas Txhua Qhov
Txuas Txhua Qhov
Txuas Txhua Qhov

Kev sib txuas nrog Arduino Uno board yog yooj yim heev. Thaum xub thawj, cia peb txuas lub zog ntawm ob tus nyeem ntawv thiab tso saib.

Ceev faj, tus nyeem ntawv RFID yuav tsum txuas nrog 3.3V cov zis ntawm Arduino Uno lossis nws yuav raug rhuav tshem. Txij li cov zaub tseem tuaj yeem ua haujlwm ntawm 3.3V peb txuas Vcc los ntawm ob qho qauv mus rau lub khob cij zoo. Txoj kev tsheb ciav hlau no txuas nrog 3.3V cov zis ntawm Arduino Uno. Tom ntej no, peb txuas ob qho GNDs mus rau daim ntawv qhia zaub mov GND kev tsheb nqaj hlau. Tom qab ntawd peb txuas GND txoj kev tsheb nqaj hlau mus rau Arduino GND.

OLED Zaub - Arduino

Vcc ▶ 3.3V

GND thiab GND

SCL ▶ Analog Pin 5

SDA ▶ Analog Pin 4

RFID nyeem ntawv - Arduino

RST ▶ Digital Pin 9

IRQ ▶ Unconnected

MISO -Digital Pin 12

MOSI -Digital Pin 11

SCK ▶ Digital Pin 13

SDA ▶ Digital Pin 10

RFID tus qauv nyeem ntawv siv SPI interface txhawm rau sib txuas lus nrog Arduino. Yog li peb yuav siv cov khoos phis tawj SPI ntawm Arduino UNO. RST tus pin mus rau tus lej digital 9. IRQ tus pin nyob qis dua. MISO tus pin mus rau tus lej digital 12. MOSI tus pin mus rau tus lej digital 11. SCK tus pin mus rau tus lej digital 13 thiab kawg, SDA tus pin mus rau tus lej digital 10. Ntawd yog. Tus nyeem ntawv RFID tau txuas nrog. Tam sim no peb yuav tsum txuas OLED cov zaub nrog Arduino siv I2C interface. Yog li, SCL tus pin ntawm cov zaub mus rau Analog Pin 5 thiab SDA tus pin ntawm cov zaub rau Analog Pin 4. Yog tias tam sim no peb txhawb nqa txoj haujlwm thiab tso daim npav RFID ze rau tus nyeem ntawv peb tuaj yeem pom tias txoj haujlwm ua haujlwm tau zoo! Tam sim no nws yog lub sijhawm los saib cov cai ntawm qhov haujlwm.

Kauj Ruam 5: Txoj Cai ntawm Txoj Haujlwm

Txoj Cai ntawm Txoj Haujlwm
Txoj Cai ntawm Txoj Haujlwm

Txhawm rau kom cov phiaj xwm phiaj xwm los ua ke peb yuav tsum suav nrog qee lub tsev qiv ntawv. Ua ntej tshaj plaws, peb xav tau MFRC522 Rfid lub tsev qiv ntawv. Txhawm rau nruab nws, mus rau Sketch -> suav nrog Tsev Qiv Ntawv -> Tswj cov tsev qiv ntawv. Nrhiav MFRC522 thiab nruab nws. Peb kuj xav tau Adafruit SSD1306 lub tsev qiv ntawv thiab Adafruit GFX lub tsev qiv ntawv rau cov zaub. Nruab ob lub tsev qiv ntawv nrog tib tus txheej txheem. Lub tsev qiv ntawv Adafruit SSD1306 xav tau kev hloov kho me me. Mus rau Arduino -> Cov ntawv qiv ntawv, qhib Adafruit SSD1306 nplaub tshev thiab kho Adafruit_SSD1306.h lub tsev qiv ntawv. Kab lus 70 thiab kab lus tsis pom zoo 69. Peb cov zaub muaj kev daws teeb meem ntawm 128x64, qhov ntawd yog qhov peb tau txhais ntawm no. Tam sim no peb tau npaj los saib nrawm ntawm cov cai.

Thaum xub thawj, peb tshaj tawm tus nqi ntawm daim npav RFID uas peb xav kom Arduino lees paub. Nws yog ib qho array ntawm integers.

int chaws = {69, 141, 8, 136}; // Qhov no yog UID khaws cia

Tom ntej no, peb pib ua RFID nyeem ntawv thiab tso saib.

rfid. PCD_Init (); display.begin (SSD1306_SWITCHCAPVCC, 0x3C);

Tom qab qhov no, hauv kev ua haujlwm hauv lub voj, peb tshawb xyuas ib daim ntawv ntawm tus nyeem ntawv txhua 100 ms.

Yog tias muaj cov cim npe ntawm tus nyeem ntawv peb nyeem nws UID thiab peb luam tawm ntawm cov zaub. Tom ntej no, peb sib piv UID ntawm daim ntawv uas peb nyuam qhuav nyeem, nrog tus nqi uas khaws cia hauv cov lej sib txawv. Yog tias qhov txiaj ntsig zoo ib yam, peb tso tawm UNLOCK cov lus, lwm qhov peb tsis tso tawm cov lus no.

yog (phim) {Serial.println ("\ nKuv paub daim npav no!"); printUnlockMessage (); } lwm {Serial.println ("\ n Tsis paub Card"); }

Yog lawm, koj tuaj yeem hloov kho cov cai no txhawm rau khaws ntau dua 1 UID qhov tseem ceeb txhawm rau ua kom txoj haujlwm kom paub ntau daim npav RFID.

Nov yog qhov piv txwv xwb. Raws li ib txwm koj tuaj yeem pom cov cai ntawm txoj haujlwm txuas nrog rau Cov Lus Qhia no.

Kauj Ruam 6: Kev Xav Thaum Kawg & Kev Txhim Kho

Kev Xav Thaum Kawg & Kev Txhim Kho
Kev Xav Thaum Kawg & Kev Txhim Kho

Raws li koj tuaj yeem pom nrog tus nqi qis heev peb tuaj yeem ntxiv tus nyeem ntawv RFID rau peb cov phiaj xwm. Peb tuaj yeem yooj yim tsim kev ruaj ntseg nrog tus nyeem ntawv zoo li qhov no lossis tsim kom muaj kev lom zem ntau dua.

Kuv lub hom phiaj tseem ceeb yog tsim qee qhov kev sib tham sib tham ua si rau menyuam yaus siv tus nyeem ntawv RFID no thiab ntau daim cim npe RFID. Hauv cov vis dis aus yav tom ntej, peb tseem yuav sim sau thiab nyeem cov ntaub ntawv los ntawm daim npav RFID. Txij ntawm no mus, Kuv xav hnov koj lub tswv yim hais txog daim npav RFID nyeem ntawv no. Koj puas npaj yuav siv nws hauv ib qho ntawm koj cov phiaj xwm? Thov tshaj tawm cov lus lossis tswv yim hauv cov lus hais hauv qab no, ua tsaug!

Pom zoo: