Search code examples
androidkotlinarduinonfcnfc-p2p

NFC communication between Android Kotlin app and Arduino


I'm currently looking to transfer data between an Android app in Kotlin and an Arduino board with NFC (PN532). I want to establish NFC communication, because my project requires scanning NFC tags. I saw that it was necessary to turn more towards Bluetooth or wifi, but that would mean adding additional elements to the assembly and therefore having higher consumption, which I try to avoid.

I looked into NFC P2P (Beam) but it seems to me that Beam is no longer used.

I would like to know if it is possible to communicate using NFC like with Beam today? If you have even just some leads, I'm interested.

Thank you


Solution

  • Using NFC to transfer data is not ideal, it is slow and unreliable, this is one of the reason it was removed from Android in favour of bluetooth/wifi direct.

    BUT it is still possible with Android, if complicated and might be ok for small amounts of data.

    You can use Host Card Emulation (HCE) where one side of the communication pretends to be a Type 4A NFC Tag and then you can read/write to it as a normal Tag (If you implement all the necessary protocol)

    A working one directional example is at https://github.com/underwindfall/NFCAndroid

    You don't specify the NFC hardware used on the Arduino but the NFC Reader might also be able to do HCE.