Cov txheej txheem:
- Kauj Ruam 1: Teeb Arduino thiab RFID RC-522 (Kev Sib Txuas Lub Cev)
- Kauj ruam 2: Arduino Code.,
- Kauj Ruam 3: Teeb MySQL
- Kauj Ruam 4: Teeb Kev Ua Haujlwm IDE
- Kauj Ruam 5: Ua tiav Txoj Haujlwm
- Kauj Ruam 6: Xaus
Video: App khw yooj yim Siv RFID RC-522 thiab Arduino Mega: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Nws yog qhov zoo uas tau pom koj dua ntawm no ntawm kuv lwm qhov kev qhia, ntawm no kuv yuav pab koj los tsim daim ntawv thov khoom lag luam yooj yim siv RFID RC-522 thiab Arduino nrog Ua kom tsim tau yooj yim GUI.
Nco tseg: tsis txhob khiav Arduino tus saib xyuas thaum khiav cov cai vim hais tias chaw nres nkoj tsis sib haum yuav tshwm sim vim ob leeg yuav tsum siv tib lub chaw nres nkoj
Koj Xav Tau:
- Arduino Mega lossis Arduino Uno (Kuv siv Mega)
- RFID-RC522
- 7 txiv neej rau poj niam jumper xov hlau
- Qee daim npav ID (xaiv tau)
- RFID Lub Tsev Qiv Ntawv (Yuav tsum, Txuas Hauv Qab)
- Wamp neeg rau zaub mov
- Ua IDE 2.2.1 (tsis txhob siv ntau dua ntawd)
- BezierSQLib-0.2.0 tsev qiv ntawv rau kev ua (Rub tawm txuas hauv qab no)
Tom qab ntawv Rub tawm Hauv qab no RFID lub tsev qiv ntawv thiab ntxiv nws rau koj Arduino IDE los ntawm txhaj Sketch-> Xws li Tsev Kawm Ntawv-> Ntxiv. Zip Library hauv cov ntawv qhia zaub mov
Kauj Ruam 1: Teeb Arduino thiab RFID RC-522 (Kev Sib Txuas Lub Cev)
yooj yim txuas cov arduino nrog RFID-RC522 raws li qhia hauv cov duab saum toj no. Warning: muab tsuas yog 3.3V txwv tsis pub module yuav hlawv tawm
Pin Out rau Uno/Nano thiab Mega
RC522 MODULE Uno/Nano MEGASDA D10 D9 SCK D13 D52 MOSI D11 D51 MISO D12 D50 IRQ N/A N/A GND GND GND RST D9 D8 3.3V 3.3V 3.3V
Kauj ruam 2: Arduino Code.,
Luam cov cai hauv qab no rub nws rau koj Arduino
/*PINOUT: RC522 MODULE Uno/Nano MEGA SDA D10 D9 SCK D13 D52 MOSI D11 D51 MISO D12 D50 IRQ N/AN/A GND GND GND RST D9 D8 3.3V 3.3V 3.3V*//*suav nrog tus qauv Arduino SPI lub tsev qiv ntawv */ #suav nrog/ *Suav nrog RFID lub tsev qiv ntawv */ #suav nrog
/* Txheeb cais DIO siv rau SDA (SS) thiab RST (pib dua) pins. */
#define SDA_DIO 9 #define RESET_DIO 8
/ * Tsim ib qho piv txwv ntawm RFID lub tsev qiv ntawv */
RFID RC522 (SDA_DIO, RESET_DIO); int nyeem ntawv = 0;
void teeb tsa ()
{Serial.begin (9600); / * Pab kom SPI interface */ SPI.begin (); / * Pib ua tus nyeem ntawv RFID */ RC522.init (); }
void lub voj ()
{ / * Lub voj voos ib ntus * / byte i;
/* Puas tau pom daim npav? */
yog (RC522.isCard ()) { / * Yog li ntawd tau txais nws tus lej lej * / RC522.readCardSerial ();
/ * Tso cov lej tawm mus rau UART */ rau (i = 0; i <= 2; i ++) {Serial.print (RC522.serNum , DEC); //Serial.print(RC522.serNum, HEX); } Serial.print (","); Serial.print (nyeem ntawv ++); Serial.println (); } ncua (1000); }
Kauj Ruam 3: Teeb MySQL
- Nruab Wamp server rau MySQL thiab teeb tsa nws kom khaws cov ntaub ntawv (
- Khiav wamp serveropen MySQL console
- xaiv database
- Tom qab ntawd tsim lub rooj rau koj cov ntaub ntawv
tsim cov lus rfid (ID int (8), token int (1), Npe varchar (20), Tus nqi int (4));
Tam sim no saib qhov txuas no txhawm rau kawm paub yuav ua li cas kom tau txais koj li txiaj ntsig RFID lossis tom qab siv tus lej hauv qab no txhawm rau ntxig cov ntaub ntawv. Tsis txhob hnov qab hloov tus lej tus lej nrog koj tus lej cim npe RFID
ntxig rau hauv rfid qhov tseem ceeb (3756178, 1, 'Mem hluav', 20);
siv tus nqi token li 1 yog li ntawd tom qab nyeem tus lej cim thawj zaug nws yuav hloov pauv mus rau 2, tsis txhob siv 0 rau tus nqi token thaum nyeem daim npav uas tsis tau ntxig rau hauv DB nws yuav muab 0 tom qab ntawd tso nws ua Daim Ntawv Tsis Paub..
Kauj Ruam 4: Teeb Kev Ua Haujlwm IDE
- Rub tawm thiab Txhim Kho Cov Txheej Txheem IDE 2.2.1
- Tshem tawm cov ntawv ZIP saum toj no rau MyDocuments/Ua/Libraries
- Tam sim no qhib kev ua IDE thiab tshawb xyuas lub tsev qiv ntawv tau teeb tsa raug lossis tsis zoo li hauv cov duab saum toj no
- Tom qab ntawd Luam cov cai hauv qab no los ua thiab npe nws ntawm koj tus kheej
ntshuam de.bezier.data.sql.*; ntshuam ua tiav.serial.*; // ntshuam java.math. BigInteger;
// tsim 2005-05-10 los ntawm fjenett
// hloov tshiab fjenett 20080605
MySQL dbconnection;
Txoj hlua s = ""; int Qhov siab = 700; int Luas = 1200; ntev ID; koj token; tus nqi; int Tag nrho = 0;
Txoj hlua a = {"NULL", "NULL"};
int kawg = 10; // tus lej 10 yog ASCII rau kab ntawv pub zaub mov (kawg ntawm cov ntawv.println), tom qab ntawd peb yuav saib qhov no txhawm rau txhawm rau txhawm rau cais cov lus ib leeg zuj zus; // tshaj tawm txoj hlua tshiab hu ua 'serial'. Ib txoj hlua yog ntu ntu ntawm cov cim (hom ntaub ntawv paub zoo li "char") Serial chaw nres nkoj; Txoj hlua curr, ua ntej, Lub npe; PFont f;
void teeb tsa ()
{// loj (Dav, Qhov siab); loj (700, 500); f = createFont ("Arial", 24, tseeb); // qhov piv txwv no kwv yees tias koj tab tom khiav // mysql server hauv zos (ntawm "localhost"). // // hloov --username--, --password- nrog koj li mysql-account. // String user = "hauv paus"; Txoj hlua hla = ""; // lub npe ntawm lub database siv // String database = "IOT_Database"; // lub npe ntawm lub rooj uas yuav raug tsim String table = ""; // txuas rau database ntawm server "localhost" dbconnection = tshiab MySQL (qhov no, "localhost", database, tus neeg siv, dhau); port = Serial tshiab (qhov no, Serial.list () [0], 9600); // pib qhov khoom los ntawm kev xa chaw nres nkoj thiab tus nqi baud (yuav tsum sib xws ntawm Arduino) chaw nres nkoj.clear (); // ua haujlwm los ntawm cov tsev qiv ntawv uas cuam tshuam thawj zaug nyeem, thaum peb pib nyeem hauv nruab nrab ntawm txoj hlua los ntawm Arduino serial = port.readStringUntil (kawg); // muaj nuj nqi uas nyeem cov hlua los ntawm qhov chaw nres nkoj txuas mus txog thaum luam tawm thiab tom qab ntawv muab txoj hlua rau peb cov hlua sib txawv (hu ua 'ntu') serial = tsis muaj; } tsis muaj dab tsi kos () {keeb kwm yav dhau (255); textFont (f, 24); puv (0); text ("Tag Nrho Tus Nqi Rs:", 400, 400); ntawv nyeem (Tag nrho, 585, 400); cov ntaub ntawv (); thaum (port.available ()> 0) {// tsuav yog muaj cov ntaub ntawv los ntawm chaw nres nkoj txuas, nyeem nws thiab khaws nws cov lej = port.readStringUntil (kawg); } yog (serial! = tsis muaj) {prev = curr; cov = a [1]; a = phua (serial, ','); // ib qho array tshiab (hu ua 'a') uas khaws cov txiaj ntsig rau hauv cov cell sib cais (cais los ntawm tus lej cim tseg hauv koj li Arduino program) yog ((curr).equals (prev)) {//} else {// println ("curr ", kev); // println ("Ua ntej", ua ntej); muaj nuj nqi (); }}}
tsis muaj nuj nqi ()
{yog (dbconnection.connect ()) {// tam sim no nyeem nws rov qab // dbconnection.query ("SELECT * los ntawm rfid qhov twg ID ="+a [0]+""); thaum (dbconnection.next ()) {ID = dbconnection.getInt ("ID"); token = dbconnection.getInt ("token"); Tus nqi = dbconnection.getInt ("Tus nqi"); } yog (token == 0) {println ("Ok"); textFont (f, 54); sau (255, 0, 0, 160); ntawv nyeem ("Tsis paub yam khoom tau pom", 50, 300); ncua (2000); } lwm tus yog (token == 1) {Total = Total+Amount; dbconnection.query ("hloov tshiab rfid teeb token = 2 qhov twg ID ="+a [0]+""); println ("Ok"); textFont (f, 24); sau (255, 0, 0, 160); // text ("Yam khoom ntxiv", 10, 30); ncua (1000); } lwm tus yog (token == 2) {Total = Total-Amount; dbconnection.query ("hloov tshiab rfid teeb token = 1 qhov twg ID ="+a [0]+""); println ("OK"); textFont (f, 24); sau (255, 0, 0, 160); // text ("Yam khoom raug tshem tawm", 10, 30); ncua (1000); } lwm {} dbconnection.close (); } lwm { / kev sib txuas ua tsis tau tejyam! }}
void cov ntaub ntawv ()
{int txoj hauj lwm = 100; yog (dbconnection.connect ()) {dbconnection.query ("SELECT * los ntawm rfid qhov twg token = 2"); thaum (dbconnection.next ()) {Lub npe = dbconnection.getString ("Npe"); Tus nqi = dbconnection.getInt ("Tus nqi"); textFont (f, 24); sau (0, 0, 255, 160); ntawv (Npe, 10, txoj haujlwm); sau (0, 0, 0, 160); ntawv (Tus lej, 215, txoj haujlwm); txoj hauj lwm = txoj hauj lwm+30; }} dbconnection.close (); }
Kauj Ruam 5: Ua tiav Txoj Haujlwm
Khiav qhov kev zov me nyuam los ntawm txhaj lub pob khiav tsis kaw lub qhov rooj qhib qhov qhib yuav tsum tsis ua tiav thiab hauv qab cov lus nug kom pom cov ntaub ntawv khaws tseg hauv MySQL …
Kauj Ruam 6: Xaus
Kuv xav ua tsaug rau koj nyeem kuv cov lus qhia. Kuv yuav txaus siab yog tias koj pom nws muaj txiaj ntsig thiab poob qhov nyiam (nyiam) lossis nug kuv ib yam vim nws ua rau kuv mob siab ua cov lus qhia no. xav tias dawb nug cov lus nug uas koj xav paub …
Zoo Siab Coding Arduino…
Pom zoo:
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: 4 Cov Kauj Ruam (nrog Duab)
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: Hnub no kuv xav qhia yuav ua li cas kom pom lub teeb pom kev zoo los ntawm lub zog xa hluav taws xob tsis siv hluav taws xob los ntawm tus txhuam txhuam hniav thiab lub tshuab solenoid valve coils uas tau khaws los ntawm scrapyard.Ua ntej pib, thov saib cov vis dis aus hauv qab no:
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Qhov Yooj Yim Yooj Yim Yooj Yim]: 3 Kauj Ruam
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Ob Qes Yooj Yim Yooj Yim]: Puas yog koj tab tom nrhiav kom ua txoj haujlwm yooj yim thiab nthuav nrog Arduino uas nyob rau tib lub sijhawm tuaj yeem muaj txiaj ntsig tiag tiag thiab muaj peev xwm cawm txoj sia? tej yam tshiab thiab tshiab. Hauv kab ntawv no peb mus
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): 7 Kauj Ruam
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): Xav hloov pauv yam ntawm koj lub laptop lossis PC? Xav tau kev hloov pauv hauv koj qhov chaw? Ua raws cov kauj ruam no yooj yim thiab yooj yim kom ua tiav koj tus kheej lub computer ntsuas phoo
DIY MusiLED, Music Synchronized LEDs Nrog Ib-nias Windows & Linux Application (32-ntsis & 64-ntsis). Yooj Yim Rov Ua Dua, Siv Yooj Yim, Yooj Yim rau Chaw Nres Nkoj: 3 Kauj Ruam
DIY MusiLED, Music Synchronized LEDs Nrog Ib-nias Windows & Linux Application (32-ntsis & 64-ntsis). Yooj Yim Rov Ua Dua, Siv Yooj Yim, Yooj Yim rau Chaw Nres Nkoj: Qhov haujlwm no yuav pab koj txuas 18 LEDs (6 Liab + 6 Xiav + 6 Daj) rau koj lub Rooj Tswjhwm Saib Arduino thiab txheeb xyuas koj lub khoos phis tawj Lub Suab Suab Lub suab lub sijhawm tiag tiag thiab xa lawv mus rau cov LEDs kom pom lawv raws li qhov cuam tshuam (Snare, High Hat, Kick)
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi