Not bumping this thread due to a problem on my end, just wanted to say that thanks to this thread and @peekay123’s library, I was able to get this ebay kit up and running on a Photon in about 4 minutes!
Any future Googlers looking for a quick start, here’s a summary of this thread:
Wiring:
-Function- Photon Pin MRFC522 Pin
Reset ANY (D2) RST
SPI SS ANY (A2) SDA
SPI MOSI A5 MOSI
SPI MISO A4 MISO
SPI SCK A3 SCK
Code:
This will publish an event to the Particle cloud with the ID of whatever device you scan - kind of a RFID hello world, as it doesn’t really do much beyond let you catalog the cards and fobs you have, and ensure you’ve wired it up right. Make sure you add the MFRC522 library through the IDE, I’m not sure how it works if you just paste this with the include statement.
// This #include statement was automatically added by the Particle IDE.
#include <MFRC522.h>
#define SS_PIN A2
#define RST_PIN A1
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
void setup() {
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV8);
mfrc522.PCD_Init();
}
void loop() {
// Look for new cards, if nothing found, quit
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards, if nothing found, quit
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
String cardID = "";
for (byte i = 0; i < mfrc522.uid.size; i++) {
cardID += String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
cardID += String(mfrc522.uid.uidByte[i], HEX);
}
Particle.publish("rfid_scan", cardID, 60, PRIVATE);
mfrc522.PICC_HaltA();
}
Now for some RFID fun! Thanks everyone!