-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Readers #377
Comments
This comment has been minimized.
This comment has been minimized.
OS version: Windows 10 |
Hello. I don't much know about accessing data blocks on tags for multiple readers but I can assure you that you can use miguelbalboa's library for connecting multiple readers without using a multiplexer, and they're all totally functional at the same time. I've just committed my code for four readers https://github.com/Annaane/MultiRfid , I hope it can help anyhow. |
@Annaane Hey! Thanks for your message. Where did you purchase your MFRC522 card reader units? Ideally, I believe Balboa's library should actually work flawlessly, but I'm guessing most affordable card readers just aren't built well enough to be reliable receiving Slave Select signals, so if I can find affordable cards that work that might solve the whole problem better than pursuing another workaround (switching via MISO). I swear I have done your method at least 6-7 times and it never works for long, or usually at all. Some cards will read and at least 1 will frequently fail to read correctly. |
I own a Chinese clone of the chip/board and see that it doesn't work 100%
right. I'm going to explore further and share my results. Meanwhile see
here: ildar/libnfc#1
|
Be sure to have all slave select signals set to active HIGH before doing the individual device configuration. |
@dgriggs I don't think the problem is in the readers. I bought mine in a small shop next to my house for like 5$. Just make sure that your pins are very well wired. |
I am using a modified MFRC522 with multiple readers support (currently only 2, can be changed in MFRC522.h #define MFRC522_MAXREADERS): http://heli.xbot.es/wp-content/uploads/2018/06/rfid-1.4.1_heli.zip |
@helitp. Couldn't get it to work. I have input the MFRC522 library using the link above. Usng Microbit + Microbit Driver Expansion Board. Both RFID Readers sharing the SCK (13), MISO (14), MOSI (15) and RST(8) PINs. Using pins 12 and 2 for SS. Please help. I think my main problem is the sharing of the MISO pin by 2 readers. Anyway to solve this? When I execute I get the following: 21:59:51.862 -> Reader 0: Firmware Version: 0x0 = (unknown) Sketch Code: #include <SPI.h> constexpr uint8_t RST_PIN = 8; // Configurable, see typical pin layout above constexpr uint8_t NR_OF_READERS = 2; byte ssPins[] = {SS_1_PIN, SS_2_PIN}; MFRC522 mfrc522[NR_OF_READERS]; // Create MFRC522 instance. /**
Serial.begin(9600); // Initialize serial communications with the PC SPI.begin(); // Init SPI bus for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) { /**
for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
} //for(uint8_t reader /**
|
Thank you so much HibaHorya !!! |
Okay, so years ago I figured out how to use multiplexers to trick the Arduino into working in rapid sequence with as many readers as you want, depending on how fast you needed to read them (#191). But now I'm working on a project that requires a full library-level fix, not just a workaround.
I tried using the solution linked below and it worked! Unlike with Balboa's library where a random number of readers work, and the others never respond (seemed to look a lot like SPI data interference), I get FLAWLESS response from 6 separate reader cards every time! Unfortunately, the library from Sunfounder which communicates flawlessly with multiple readers does not include functions for authenticating with tags to allow read/write access to data blocks. It only is good for reporting UIDs. Please read below for accessing data blocks on tags, not just UIDs!
https://arduino.stackexchange.com/questions/18313/issue-sharing-miso-with-multiple-rc522-rfid-readers
I believe it has something to do with the fundamental SPI setup - with the Sunfounder library using softSPI, you can set any SPI pins you want for each library instance, meaning I could change my wiring to not use SDA (slave select) and instead assign different pins to each reader's MISO.
I NEED YOUR HELP! I'm a noob at Github and I'm still not confident in writing complex library code, so hopefully someone more skilled can take the direction I've found and pull it through to the end for the community's benefit!
Option 1 (probably easier than option 2 if unlike me you know what you're doing): get Balboa's library to accept different MISO pins for each reader! No guarantee that will completely solve the problem, but there's a good chance that's what's making the difference here. The easiest way I think to do this is simply switch Balboa's code from using hardware SPI over to softSPI library.
Option 2: I have tried and tried to get the Sunfounder library up to snuff with what Balboa's library can do copying his library's authentication process step-by-step, with no luck so far. If someone can create a repo for Sunfounder's rfid and add code to authenticate and access data blocks, I think we'll be in business!
Sunfounder RFID.h library with softSPI.h dependency included: https://www.sunfounder.com/learn/download/UkZJRF9raXRfVjEuMF9mb3JfQXJkdWluby56aXA=/dispa
The text was updated successfully, but these errors were encountered: