Cov txheej txheem:

Kev cuam tshuam ntawm RFID-RC522 Nrog Arduino MEGA Cov Duab yooj yim: 4 Cov Kauj Ruam
Kev cuam tshuam ntawm RFID-RC522 Nrog Arduino MEGA Cov Duab yooj yim: 4 Cov Kauj Ruam

Video: Kev cuam tshuam ntawm RFID-RC522 Nrog Arduino MEGA Cov Duab yooj yim: 4 Cov Kauj Ruam

Video: Kev cuam tshuam ntawm RFID-RC522 Nrog Arduino MEGA Cov Duab yooj yim: 4 Cov Kauj Ruam
Video: Kev siv lub kaus thiab txoj siv ceeb ntawm kev tshoob kos cuam tshuam kev ntseeg Yexus li cas? 2024, Kaum ib hlis
Anonim
Kev cuam tshuam ntawm RFID-RC522 Nrog Arduino MEGA Kev Kos Duab Yooj Yim
Kev cuam tshuam ntawm RFID-RC522 Nrog Arduino MEGA Kev Kos Duab Yooj Yim

Hai nyob hauv qhov kev qhia no kuv yuav pab koj nrog cuam tshuam nrog RFID-RC522 nrog Arduino Mega 2560 los nyeem RFID thiab Zaub Cov Ntaub Ntawv ntawm Tus Saib Xyuas. yog li koj tuaj yeem nthuav nws ntawm koj tus kheej

Koj Xav Tau:

  1. Arduino Mega lossis Arduino Uno (Kuv siv Mega)
  2. RFID-RC522
  3. 7 txiv neej rau poj niam jumper xov hlau
  4. Qee daim npav ID (xaiv tau)
  5. RFID Lub Tsev Qiv Ntawv (Yuav tsum, Txuas Hauv Qab)

Tom qab ntawv Rub lub Tsev qiv ntawv hauv qab no 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: Kev Sib Txuas Lub Cev

Kev Sib Txuas Lub Cev
Kev Sib Txuas Lub Cev

yooj yim txuas cov arduino nrog RFID-RC522 raws li qhia hauv daim duab saum toj no.

Ceeb toom: muab tsuas yog 3.3V txwv tsis pub lub 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: Txoj Cai Yooj Yim Nyeem thiab Sau Cov Ntawv Cim RFID

Txoj Cai Yooj Yim Nyeem thiab Luam Ntawv RFID Cov Ntawv Cim Tus Nqi
Txoj Cai Yooj Yim Nyeem thiab Luam Ntawv RFID Cov Ntawv Cim Tus Nqi

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);

void teeb tsa ()

{Serial.begin (9600); / * Pab kom SPI interface */ SPI.begin (); / * Pib ua tus nyeem ntawv RFID */ RC522.init (); }

void lub voj ()

{ /* Puas tau kuaj pom daim npav? */ yog (RC522.isCard ()) {/ *Yog li ntawd tau txais nws tus lej lej */ RC522.readCardSerial (); Serial.println ("Card kuaj pom:"); rau (int i = 0; i <5; i ++) {Serial.print (RC522.serNum , DEC); //Serial.print(RC522.serNum, HEX); // luam daim npav kom ntxaws hauv Hexa Decimal format} Serial.println (); Serial.println (); } ncua (1000); }

Kauj Ruam 3: Txoj Cai Yooj Yim rau Super Market Application Siv RFID

Txoj Cai Yooj Yim rau Super Market Application Siv RFID
Txoj Cai Yooj Yim rau Super Market Application Siv RFID

Luam cov cai hauv qab no rub nws rau koj Arduino. hauv qab no tag nrho tus nqi yuav khoom yuav nce ntxiv thaum nyeem daim npav thawj zaug thiab txo qis thaum nyeem tib yam rau zaum ob …

/*

PINOUT:

RC522 MODULE Uno/Nano MEGA

SDA 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

*

* Suav nrog tus qauv Arduino SPI lub tsev qiv ntawv */

#suav nrog / * suav nrog lub tsev qiv ntawv RFID * / #suav nrog

/* Txheeb cais DIO siv rau SDA (SS) thiab RST (pib dua) pins. */

#define SDA_DIO 9 #define RESET_DIO 8 int productname [5] = {228, 18, 37, 75, 24}; int khoom [5] = {100, 120, 230, 125, 70}; int token [5] = {0, 0, 0, 0, 0}; int Tag Nrho; / * Tsim ib qho piv txwv ntawm RFID lub tsev qiv ntawv */ RFID RC522 (SDA_DIO, RESET_DIO);

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 = 0; byte j = 0; byte k = 0; tus ID;

/* Puas tau pom daim npav? */

yog (RC522.isCard ()) { / * Yog li ntawd tau txais nws tus lej lej * / RC522.readCardSerial (); Serial.print (RC522.serNum , DEC);

//Serial.println("Card kuaj pom: ");

/ * Tso cov lej lej mus rau UART */

ID = RC522.serNum [0]; //Serial.print(ID); Serial.println (""); rau (i = 0; i <5; i ++) {if (productname == ID) {Serial.println ("Total Purchase"); yog (token == 0) {Total = Total+khoom ; token [kuv] = 1; } lwm {Total = Total-product ; token [kuv] = 0; } Serial.println (Tag Nrho); tawg; } lwm tus yog (i == 5) {Serial.println ("Nkag Tsis Pub Nkag Mus"); tawg; }} Serial.println (); Serial.println (); } ncua (1000); }

Kauj Ruam 4: 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: