Search code examples
iosnfcrfid

Passing RFID data from iPhone to a RC522


I currently have a Mifare RC522 module that I can use to successfully read/write to tags and cards, but I cannot successfully get it to read data that I am writing through an NFC phone app. Simply trying to get the RC522 module to read the data on the iPhone by bringing it close just brings up the Apple Pay menu. Is there something I am doing wrong? Does the data need to be encoded in a certain way or would that module just be useless and I'd probably need something like a PN532? I basically just want a module that can read NFC data I broadcast from an iPhone/Android device


Solution

  • In NFC comms there 2 parts, an initiator (more general term as a reader) and a target (more general term of Tag/Card) and passive and active devices.

    The initiator start the communication and the target responds.

    An Active device has power and a passive device does not supply it's own power.

    Passive devices cannot be initiator's because they need power to start the communication and might need to supply power to the target device.

    So a normal NFC Tag like an NTAG 21x tag is a passive target.

    A device like the iPhone/Android at the hardware level capable of being initiator and target device and can supply power to passive devices.

    The RC522 Module is only an initiator device and can supply power to passive devices.

    Devices like the iPhone/Android when they act as a target device (Tag/Card) this is called Host Card Emulation or HCE (they are emulating the Card hardware in software).

    So as the RC522 is only an initiator (reader) the other device has to be the target.

    Unfortunately in iOS only Apple are allowed to do Host Card Emulation (be a target) for Apple Pay where they pretend to be contactless bank card to contactless bank terminals which are only initiator's.
    This is why Apple Pay appears because this is the only way it can respond to an initiator.

    On Android it is possible for normal developers to use Host Card Emulation.

    So basically what you are trying is not possible with the RC522 reader and iPhones.

    So yes it would be possible with a PN532 because that chip offers card emulation modes on chip or pass through mode where the Host Card is emulated on the attached micro controller. This is because the iPhone for a normal developer can only be a reader (initiator) device.