NFC or RFID with CPython
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

NFC or RFID with CPython

by dparke on Tue Mar 13, 2018 4:37 pm


I was contemplating a project that would sense the presence of specially tagged objects and react in particular ways based on which combination were present. Ideally, there would be specific areas to place each of, say, three objects and only when there were three would it look at what was present and determine a reaction. I would like to have a great many potential objects and thus a large number of combinations, so I was thinking that a good solution would be to use NFC tags.

I've looked through the site for projects that use CircuitPython and NFC and the only hardware I've found referencing RFID/NFC is an Arduino controller shield or the PN532. Are there options out there for hardware detecting NFC tags? I'd like to continue using CPython (which is why I am posting here), but maybe the answer is this is a project best undertaken in another language? Also, is RFID/NFC an overly complicated solution to detecting and identifying a nearby object?

Thanks for any pointers and suggestions for getting started!

Posts: 8
Joined: Tue Feb 20, 2018 10:14 am

Re: NFC or RFID with CPython

by tannewt2 on Wed Mar 14, 2018 12:31 am

Hi dparke,
I don't think we have have a driver for the PN532 yet. If you are interested in trying to make it let me know! I'd be happy to help.

I don't know of a better way to detect the presence of a particular object. Proximity of anything is easier to do though.

(Note desktop python is often called CPython so its best to spell out circuitpython or do cirpy or cpy.)


Posts: 559
Joined: Thu Oct 06, 2016 8:48 pm

Re: NFC or RFID with CPython

by cefn on Thu Mar 15, 2018 7:41 pm

Hi there,

I've had some success with Micropython and the MFRC522 but it had annoying enough behaviours (successful every other read, read delays... ) to consider switching to the PN532 for the next project. My modified library is at https://github.com/cefn/micropython-mfrc522 and it still suffers from https://github.com/cefn/micropython-mfrc522/issues/1 since given the project urgency at the time I just had to find a workaround rather than a fix. Can your device run Micropython?

Like my library at https://github.com/ShrimpingIt/micropython-mcp230xx you may be able to port an Arduino library intended for the Pi without a lot of fuss. If you start with https://github.com/adafruit/Adafruit_Py ... 2/PN532.py you may only have to switch out the SPI calls, substituting CircuitPython/Micropython ones for the Raspberry Pi ones. YMMV, no promises.

Posts: 7
Joined: Mon Oct 22, 2012 9:55 am

Please be positive and constructive with your questions and comments.