I am currently using a rfid rc522 nfc tag reader with raspberry pi using the MFRC522-python code. In my project I need to collect data from two rfid rc522 cards at the same time, rc522 are located at two different places and I want to distinguish between them, I mean how can I tell the pi which card has detected the tag.
3 Answers
Your rc522 reader has "CS" pin which can be controlled to activate each rc522 reader. You can try to toggle them one by one to be able to read the individual one.
The MFRC522-python module does not seem to allow to control/specify it, so you may need to modify the module or control GPIO pin yourself: that's line 113 in https://github.com/mxgxw/MFRC522-python/blob/master/MFRC522.py.
-
Thanks for your reply, But I am not getting the Tag ID correct. If both RFID readers are connected the status is 2 and UID is also not correct, as soon as I remove one reader I get the correct UID from the other card– arslionMar 25, 2016 at 17:08
-
Please follow my suggestions above. The CS signal controls which reader is currently active. When using one, you have to disable another one.– nochkinMar 25, 2016 at 19:28
Here's a new solution using a resistor and a FET to parallel multiple RC522 RFID readers. I tried UART interface without success, and I2C is too short range. Using SPI code from https://www.raspberrypi-spy.co.uk/2018/02/rc522-rfid-tag-read-raspberry-pi/.
IRQ is a RC522 output that stays low while an RFID is in the antenna's near field. I used this signal to short out MISO and MOSI. So as long as RFIDs are not simultaneously present at multiple detectors, one should be able to parallel multiple RC522's and they'll stay off the bus until one detects an RFID. Verified to work for 2 RC522's.
In summary, bus all the signals except IRQ. On each RC522 connect IRQ through a pull-up resistor to 3.3V (e.g., 10kohm) and to the gate of a FET, e.g., VN10K, who's source and drain connect to MOSI and MISO. IRQ is inverted, so it goes low when an RFID is detected, making the FET essentially vanish (open) and that device exerts MOSI and MISO. Otherwise, with IRQ high, the two are shorted and signals pass to other devices on the bus.
-
connect IRQ through a pull-up resistor to 3.3V (e.g., 10kohm) and to the gate of a FET, e.g., VN10K, who's source and drain connect to MOSI and MISO
- please draw a schematic. Connecting something to MOSI and MISO means you have to short MOSI and MISO together, which is probably not what you meant. Aug 5, 2019 at 9:19
I have a solution using Raspberry Pi at this link: https://github.com/erivandoramos/TwoRC522RPi
-
Welcome to Raspberry Pi! We're trying a new policy with regard to informationless link-only answers here. If this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community.– Ghanima ♦Nov 19, 2016 at 10:31
-
Please take the tour and visit the helpcenter to see how things work here.– Ghanima ♦Nov 19, 2016 at 10:31