Skip to content

Instantly share code, notes, and snippets.

@egnor
Last active November 16, 2024 21:57
Show Gist options
  • Save egnor/6fe9debde317bcb85a567623cf79c6a6 to your computer and use it in GitHub Desktop.
Save egnor/6fe9debde317bcb85a567623cf79c6a6 to your computer and use it in GitHub Desktop.

egnor's rough notes on RFID and NFC

... because this isn't explained super well elsewhere for some reason.

Popular NFC/RFID standards (focusing on air protocols)

  • ISO 18000-{1,2,3,4,5,6,7} - RFID umbrella standards for various frequency bands
  • ISO 14443 A/B (aka NFC-A/B, NXP MIFARE, NTAG) - 13.56MHz ("HF") - the most classic "RFID"
  • ISO 15693 (aka NFC-V, NXP ICODE, ISO 18000-3 Mode 1) - HF - prox cards, longer range than ISO 14443
  • ISO 18000-3 Mode 1 - HF - based on ISO 15693 plus app level protocols
  • ISO 18000-3 Mode 2 - HF - separate air protocol
  • ISO 18000-3 Mode 3 - HF - separate air protocol - "ICODE ILT" is this
  • FeliCa (aka NFC-F, JIS X 6319-4) - HF - used for payments in Japan
  • ISO 18092/21481 (aka NFCIP-1/2, ECMA 340/352) - "NFC" umbrella, based on ISO 14443, 15693, and FeliCa
    • "NFC" logo compatibility requires ISO 14443 and ISO 15693 compatibility (NFC-A, NFC-B, NFC-V)
  • EPC Gen2 (aka ISO 18000-6C, ISO 18000-63, RAIN) - 900MHz "UHF" - most common UHF RFID, fast, long distance, expensive readers
  • various 125kHz ("LF") standards I won't go into, mostly considered old/obsolete

NFC/RFID device categories

  • "Readers", which can interact with tags or other readers or pretend to be tags, most can also write
  • "Tags", which need a reader to read their ID or read/write their (small) data cache
  • reader and tag must support the same protocol from the list above
  • most modern mobile phones are readers for many protocols
  • apps like "NFC Tools" (Android, iOS) let you read/write tags with your phone

Popular NFC/RFID chipsets

  • MFRC522 (NXP) - super classic, popular, 20 years old, Not Recommended for New Designs, OFTEN CLONED, 14443-A
  • PN532 (NXP) - also classic and popular, 15 years old, also NRND, also OFTEN CLONED, 14443 + FeliCa
  • PN7150 (NXP) - pin compatible with PN532, NOT software compatible, 14443 + 15693 + FeliCa
  • PN5180 (NXP) - "high performance" 14443 + 15693 + 18000-3 Mode 3 + FeliCa
  • M6E-NANO, etc (ThingMagic) - UHF RFID reader modules ($100+)
  • lots and lots of other chips from NXP, ST, Nordic, etc

NFC vs RFID

You will find lots of text out there claiming that RFID and NFC are different in various ways, and you'll see itemized lists of pros and cons, when you might use one or the other. THEY ARE ALL BADLY WRONG (or at least very badly misleading)! DO NOT BELIEVE THE LIES! You will see things like "RFID is one way, NFC is two way" or "RFID is long range, NFC is short range" or "RFID is hard to implement, NFC is easy to implement". LIES LIES LIES CONFUSING LIES

"RFID" is a general term for using a radio to ping something and get its identity. The term was coined in 1983, but the idea has been around about as long as radios have. Technically aviation transponders and car toll tags are RFID, but when most people use the term they're talking about something shorter-range using "passive tags" (RF-powered transponders).

"NFC" refers to the standards associated with a specific industry consortium, the "NFC Forum", created by Nokia, Philips and Sony in 2004. They took a bunch of existing short-range HF (13MHz) RFID protocols (adding new ones over time), swept them under the "NFC" umbrella, and defined compatibility requirements and a logo program.

Most RFID in the wild is short range, HF RFID using NFC-blessed standards, and for those systems people use the terms interchangeably. (Older LF RFID, fancy UHF RFID, and long range active transponders are examples of RFID that is not NFC.)

Beware of clones!!

Almost EVERY cheap MRFC522 or PN532 part on Amazon or AliExpress uses a clone chip, not a genuine part. The silkscreen is different, the performance is worse, and this is a big part of why people find them so flaky. There are reports of sellers like HiLetGo admitting this to complaining buyers ("why do you think they're so cheap?"). They mostly do work! But, buyer beware.

Newer parts like PN5180 aren't generally cloned (yet), which is one reason they're more reliable. (Also they're newer and better.)

Name brand boards from Adafruit, Sparkfun, Elechouse, etc use genuine parts and are a lot more expensive than the Amazon cheapo models.

Board design considerations

You may have noticed that reader boards tend to be a bit chonky. This is because they have to have an antenna area that's free of components, plus the actual components on the side. Bigger antennas have better performance; as a rule of thumb, to read a tag at distance X, you want an antenna with radius X. (Up to a limit, obviously.)

Sometimes people wonder why RFID/NFC antennas tend to be rectangular rather than circular or some other shape. As far as I can tell this is mostly tradition and convenience. Things like antenna design calculators and reference designs use rectangles, and rectangles fit nicely into board designs. You could use circles or triangles or nonagons if you really wanted.

If you want to integrate a reader and antenna into your own board instead of using something off the shelf (for space or cost reasons), that's a whole Process. It can be done, and it can be done by hobbyists with hobbyist-level tools, but you'll be learning a whole bunch of new things and acquiring some new tools.

(I can write notes about this if anyone is inclined to walk that path...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment