Ive tried to get multiple RFID scanners (2) to work like one, but I cant seem to get them to work, only one work, (If I switch there place the other one works. the one to the right). I'm pretty sure its the code, that needs a rewrite, since they work individually in the same setup (code for one, then change the pin output). It just doesn't work when i do it together. I have tried looking at similar forum post, but it hasn't worked for me. I'm really new to C++, so I'm probably missing something obvious. The readers are being fed 3.3 volt through a 1k ohm and 2k ohm resistor.
I saw in an other post, it wight help giving separate reset pin to so that's why i've done it.
Code for two readers (I just copied the code for another reader)
#include <SPI.h>
#include <MFRC522.h>
//Reader 1
#define RST_PIN 44
#define SS_PIN 45
//Reader 2
#define RST_PIN1 49
#define SS_PIN1 39
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
MFRC522 mfrc5221(SS_PIN1, RST_PIN1);
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
mfrc5221.PCD_Init();
delay(4); // Optional delay. Some board do need more time after init to be ready, see Readme
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details
mfrc5221.PCD_DumpVersionToSerial();
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}
void loop() {
// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
if ( ! mfrc522.PICC_IsNewCardPresent() ) {
return;
}
if ( ! mfrc5221.PICC_IsNewCardPresent() ) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial() ) {
return;
}
if ( ! mfrc5221.PICC_ReadCardSerial() ) {
return;
// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
mfrc5221.PICC_DumpToSerial(&(mfrc5221.uid));
}
}
original code
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 49 // Configurable, see typical pin layout above
#define SS_PIN 39 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
delay(4); // Optional delay. Some board do need more time after init to be ready, see Readme
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details
Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
}
void loop() {
// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}


