Cov txheej txheem:
- Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau
- Kauj Ruam 2: Npaj Arduino + RC-522
- Kauj Ruam 3: Lub Windows Interface Sau hauv C#
- Kauj Ruam 4: Muaj Kev Txhim Kho
- Kauj Ruam 5: Muab Thumbs Up !
Video: Txhawb nqa Nrog C# thiab Arduino + RC-522: 5 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Kev pab txhawb nqa yog qhov ntau heev. Txawm li cas los xij, kev tswj hwm lawv tsis yog ib txoj haujlwm yooj yim. Kuv txiav txim siab siv RFID's los siv ua tus cim rau txheeb xyuas txhua pab pawg. Ua ke nrog qhov tseeb koj tuaj yeem khaws daim npav RC-522 RFID nyeem ntawv thiab daim npav arduino pheej yig heev, nws ua rau nws tsim tau cov txheej txheem no yooj yim heev.
Kauj Ruam 1: Cov Ntaub Ntawv Xav Tau
- Arduino board: txhua lub rooj tsavxwm yuav ua. Kuv siv Arduino Nano rau nws qhov loj me
- Arduino kev txhim kho ib puag ncig
- RC-522: tuaj yeem yuav/xaj hauv zos lossis txawv teb chaws
- MiFare 13.56 MHz cim npe. Feem ntau qee qhov piv txwv tuaj nrog koj li RC-522 lub rooj tsavxwm. Hom cim npe tsis muaj teeb meem. Tsuas yog xyuas lawv yog qhov raug zaus.
- Lub PC khiav Windows thiab muaj Visual Studio teeb tsa, yog tias koj xav hloov kho txoj cai.
Kauj Ruam 2: Npaj Arduino + RC-522
Daim duab saum toj no qhia qhov txuas ntawm RC-522 tus qauv rau Arduino. Ib qho Arduino yuav ua. Yog li, yog tias koj muaj Arduino Nano muaj, koj yuav txiav txim siab siv qhov ntawd. Ntawm yam sib txawv koj tuaj yeem pom qee kis rau kev ntaus nrig nws txhua qhov. Kuv tau sim ib qho, tab sis nws cov npoo rau luam ntawv nws me dhau, xaus nrog qhov tsis siv 3D-luam tawm.
Kuv tseem tab tom ua haujlwm zoo rau qhov ntawd.
Txhawm rau siv koj li RC-522 lub rooj tsavxwm, koj yuav tau ntxiv lub tsev qiv ntawv rau Arduino tus khoos phis tawj. Hmoov tsis zoo, nws tsis yog lub tsev qiv ntawv uas tau tswj hwm los ntawm Arduino tus khoos phis tawj, yog li koj yuav tsum ntxiv nws "tsev kawm qub" txoj hauv kev rub nws thiab luam nws mus rau lub tsev qiv ntawv tais ceev tseg. Tsis txhob hnov qab rov pib kho Arduino tus kho kom nws siv tau.
Lub tsev qiv ntawv tuaj yeem pom ntawm
Txog tam sim no, koj muaj tus editor npaj. Nws yog lub sijhawm los rub cov ntawv rau koj Arduino. Yog tias koj txheeb xyuas cov cai, koj yuav pom muaj lub sijhawm luv ntawm 5000 milliseconds uas nws tau zam kev luam tawm tib qhov tseem ceeb ntau zaus. Koj tuaj yeem sib txawv lub sijhawm ntawd, tab sis yog tias koj teeb nws me me dhau, tib tus yuam sij yuav pom ntau zaus tom qab ib leeg.
Yog li, tam sim no nws yog lub sijhawm los tshuaj xyuas yog tias ntu no ua haujlwm. RFID qhov kuv siv yog tus qauv MiFare 1Kb fobs ntawm 13.56 MHz, uas tseem muaj cov nqi pheej yig heev.
Qhib Serial monitor ntawm Arduino editor thiab saib cov yuam sij tshwm sim thaum koj coj lawv mus rau RC-522 module.
Kauj Ruam 3: Lub Windows Interface Sau hauv C#
Koj pom suav nrog cov nplaub tshev uas muaj C# txoj haujlwm. Download tau nws thiab unpack nws. Cov cai tau sau hauv Visual Studio 2017 lub hom phiaj. Net moj khaum 4.6.1. Txhua lub khoos phis tawj tshiab yuav tsum muaj qhov no thiab tuaj yeem ua nws. Koj tsis tas yuav tsum teeb tsa Visual Studio. Cov cai tau muab rau cov uas xav hloov kho lossis tshuaj xyuas nws. Tsis muaj kev hloov kho rau txoj haujlwm, lub sijhawm ua haujlwm tau teev rau 1 teev thiab 30 feeb. Lub sijhawm ua haujlwm li qub tau teem rau 50 vib nas this uas yog rau 400 meter khiav.
Qhov ua tiav tuaj yeem pom nyob hauv Debug nplaub tshev uas nyob hauv SponsorRun / SponsorRun / bin nplaub tshev.
Hauv cov ntawv ntawd tseem yog cov ntawv sau uas tau siv hauv txoj haujlwm no los khaws cov ntaub ntawv.
Cov ntawv ntawv yog:
- rfidKeys.txt: muaj cov yuam sij rau pab pawg sib txawv. Thawj qhov tseem ceeb yog rau thawj pab pawg, thiab ntxiv rau. Koj tuaj yeem tshem tawm cov ntawv no thiab ntxiv koj tus kheej cov yuam sij (saib hauv qab no seb txoj haujlwm ua haujlwm li cas)
- teams.txt: muaj cov npe rau pab pawg sib txawv. Thawj lub npe yog rau thawj pab pawg, thiab ntxiv rau. Kho cov ntawv no nrog cov ntawv nyeem yooj yim ib txwm siv (phau ntawv sau yuav ua tau).
- results.txt: a CSV-formatted file containing the results of the various laps of the teams (tej zaum yuav tsis tuaj, thaum tsis tau teev npe los txog tam sim no)
- fraude.txt: CSV-formatted cov ntaub ntawv uas muaj pab pawg sim dag (tej zaum yuav tsis tuaj, thaum tsis muaj kev dag tau pom lawm)
Txoj hauv kev ua haujlwm yog raws li hauv qab no:
- Ntawm kev pib ua haujlwm, qhov program pom ntau qhov chaw nres nkoj COM ntawm koj lub computer. Koj yuav tsum xaiv qhov chaw nres nkoj COM muab rau koj Arduino txhawm rau ua kom muaj kev sib txuas lus tau. Los ntawm lub neej ntawd, COM qhov nrawm yuav tsum yog 9600 bps, uas sib haum rau qhov nrawm teev hauv Arduino code.
- Nyem rau "Pib mloog" khawm kom qhib kev sib txuas lus
-
Los ntawm qhov ntawd, koj tuaj yeem xaiv ntawm ob txoj haujlwm:
- Nyeem RFID cov yuam sij: qhov no ntxiv cov yuam sij tshiab rau rfidKeys.txt ntawv
- Sau npe ceg tawv (kev xaiv ua ntej): sau npe tus ncej puab tshiab rau cov ntaub ntawv.txt. Txhua lub sijhawm siv tus lej tseem ceeb raug nyeem, cov lus yuav tshwm thiab lub suab nrov nrov yuav nrov rau kom paub meej tias sau npe. Ib kab yuav raug ntxiv rau results.txt. Yog tias muaj kev sim dag, cov lus yuav tshwm nyob rau hauv ib lub thawv cais, lwm lub suab nrov yuav tshwm thiab qhov tshwm sim yuav raug sau rau fraude.txt. Hauv qhov xwm txheej ntawd, lub sijhawm rau tus ncej puab yuav raug teem rau lub sijhawm uas tau dag tias tau kuaj pom.
Kauj Ruam 4: Muaj Kev Txhim Kho
Kuv tsim txoj haujlwm no rau qhov xwm txheej tshwj xeeb hauv kuv lub tsev kawm ntawv. Nws yog qhov pom tseeb qee qhov tsis siv uas yuav tsis haum rau koj txoj haujlwm. Txog tam sim no, koj yuav tsum hloov kho qhov tsis nyob hauv C# code thiab rov sau dua qhov haujlwm, uas xav tau kev teeb tsa ntawm Visual Studio (qhov hnyav 3.5 GB teeb tsa). Yog tias muaj qhov tsim nyog cov lus teb, kuv yuav txiav txim siab nyeem cov ntawv no los ntawm cov ntaub ntawv sab nraud.
3D-xwm txheej kuv pom rau vaj tsev Arduino txoj haujlwm tsis siv tau. Kuv pib ntawm ib qho, tab sis muaj qee qhov poob qis, uas yog vim li cas, Kuv tseem tsis tau ntxiv lawv. Ib tus neeg uas xav qhia ib tus tuaj yeem tiv tauj kuv, yog li kuv tuaj yeem hais txog koj li haujlwm hauv Phau Ntawv Qhia no.
Kauj Ruam 5: Muab Thumbs Up !
Kuv vam tias koj tuaj yeem siv txoj haujlwm no thiab kuv tos ntsoov yuav hnov los ntawm koj.