Skip to content

Commit

Permalink
Code and diagram available
Browse files Browse the repository at this point in the history
  • Loading branch information
proyectoTEOS authored Apr 24, 2019
1 parent 34c7867 commit c995c4a
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 2 deletions.
44 changes: 44 additions & 0 deletions Lector-de-tarjeta-RFID_RC522-con-Arduino.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Created by TEOS
Domotic with Arduino https://goo.gl/btZpjs
YouTube https://goo.gl/k7TUSZ
Instagram https://goo.gl/zEIjia
Facebook https://goo.gl/eivraR
Twitter https://goo.gl/du5Wgn
Github https://goo.gl/Xl5IiS
WEB https://www.proyecto-teos.com
*/

#include <SPI.h>
#include <MFRC522.h> //https://github.com/miguelbalboa/rfid

MFRC522 mrfInstanceT(10, 9);
uint8_t myTagIDT[4] = {0xCA, 0x04, 0x1F, 0xCE};
String resultSerialT;

void setup() {
Serial.begin(9600);
SPI.begin();
mrfInstanceT.PCD_Init();
resultSerialT = "Coloque el TAG en el lector de tarjeta.";
Serial.println(resultSerialT);
}

void loop() {
if (mrfInstanceT.PICC_IsNewCardPresent()) {
if (mrfInstanceT.PICC_ReadCardSerial()) {
resultSerialT = (comparisonTagT(mrfInstanceT.uid.uidByte, myTagIDT, 4)) ? "TAG conocido" : "TAG desconocido";
Serial.println(resultSerialT);
mrfInstanceT.PICC_HaltA();
}
}
delay(500);
}

bool comparisonTagT(uint8_t* incomingTagT, uint8_t* currentTagT, uint8_t length) {
for (uint8_t indexT = 0; indexT < length; indexT++) {
if (incomingTagT[indexT] != currentTagT[indexT])
return false;
}
return true;
}
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,62 @@
# Lector-de-tarjeta-RFID_RC522-con-Arduino
En esta ocasión trabajaremos con el lector de tarjetas RFID MIFARE RC522 utilizando Arduino.
# Lector de tarjeta RFID RC522 con Arduino
En esta ocasión trabajaremos con el lector de tarjetas RFID MIFARE RC522 utilizando Arduino.

### Requisitos
- Tener el IDE de [Arduino](https://www.arduino.cc/en/Main/Software) (o el de tu preferencia) con la versión más actual
- Contar con las librería [MFRC522](//https://github.com/miguelbalboa/rfid)
- Tener el material para hacer el proyecto

### Código
**[Aqui](https://github.com/proyectoTEOS/Lector-de-tarjeta-RFID_RC522-con-Arduino/blob/master/Lector-de-tarjeta-RFID_RC522-con-Arduino.ino)** podrás obtener el link del código, también dejaremos
una vista previa aquí abajo.

```c++
/*
Created by TEOS
Domotic with Arduino https://goo.gl/btZpjs
YouTube https://goo.gl/k7TUSZ
Instagram https://goo.gl/zEIjia
Facebook https://goo.gl/eivraR
Twitter https://goo.gl/du5Wgn
Github https://goo.gl/Xl5IiS
WEB https://www.proyecto-teos.com
*/

#include <SPI.h>
#include <MFRC522.h> //https://github.com/miguelbalboa/rfid

MFRC522 mrfInstanceT(10, 9);
uint8_t myTagIDT[4] = {0xCA, 0x04, 0x1F, 0xCE};
String resultSerialT;

void setup() {
Serial.begin(9600);
SPI.begin();
mrfInstanceT.PCD_Init();
resultSerialT = "Coloque el TAG en el lector de tarjeta.";
Serial.println(resultSerialT);
}

void loop() {
if (mrfInstanceT.PICC_IsNewCardPresent()) {
if (mrfInstanceT.PICC_ReadCardSerial()) {
resultSerialT = (comparisonTagT(mrfInstanceT.uid.uidByte, myTagIDT, 4)) ? "TAG conocido" : "TAG desconocido";
Serial.println(resultSerialT);
mrfInstanceT.PICC_HaltA();
}
}
delay(500);
}

bool comparisonTagT(uint8_t* incomingTagT, uint8_t* currentTagT, uint8_t length) {
for (uint8_t indexT = 0; indexT < length; indexT++) {
if (incomingTagT[indexT] != currentTagT[indexT])
return false;
}
return true;
}
```
### Diagrama
El siguiente esquemático muestra como se debe conectar todos los componentes con la placa.
![](https://github.com/proyectoTEOS/Lector-de-tarjeta-RFID_RC522-con-Arduino/blob/master/lector-de-tarjeta-rfid_rc522-con-arduino-5.jpg)
Binary file added lector-de-tarjeta-rfid_rc522-con-arduino-5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c995c4a

Please sign in to comment.