Simulator

An RFID simulator: an RC522 reader and four cards

Mokxi is a free online RFID simulator that runs in your browser, with nothing to install and no account needed. An Arduino Uno talks to an MFRC522 reader over SPI with the MFRC522 library. Lay a card on the reader and its UID appears in the serial monitor: three cards and fobs with four-byte UIDs, and a sticker with seven.

  • 269parts on the bench
  • 32boards running now
  • 1.00xreal time, on every board
Arduino Uno: RC522 RFID readerlive0.000 s 0.00x
Click to open it in the editor
Click the reader and pick a card to lay on it, or click anything else to open it in the editor.

What you can do here

In the circuit above, or in the editor it opens.

  • Read card UIDs with the MFRC522 library
  • Pick from four cards, one of them with a seven-byte UID
  • Change the cards’ UIDs in the properties panel
  • Build a door that lets two of the cards in
  • Print the reader’s firmware version, and see what a loose wire does to it
  • Edit the code and press Run again

What the running circuit shows

A serial number, read through the air.

The RC522 sits on the Uno’s SPI bus, pins 11, 12 and 13, with its chip select on 10 and its reset on 9. Its antenna powers a card held near it, and every card carries a serial number, its UID, which the reader can read without knowing anything else about the card. The sketch asks the library whether a new card is present, reads its UID, prints it, and puts the card to sleep with PICC_HaltA.

In the engine the four cards read “C3 5A 1E 94”, “7B 02 D4 19”, “91 E6 3C A7” and the seven-byte “04 6F 2A D2 5B 71 80”. Because the sketch halts the card, one left on the reader prints once, not once a loop; take it off and lay it on again to read it again.

How the reader is modeled

Registers, commands and the cards’ own memory.

The MFRC522 part answers the library at the register level: its version register reads 0x92, version 2.0, and the cards answer the request, anticollision and select commands a real card does, cascading for a seven-byte UID. A four-byte card is a MIFARE Classic 1K, its memory behind the factory keys, so a sketch can authenticate, read and write blocks; the sticker is an NTAG213. A sketch written for the MFRC522 library, the one every RC522 tutorial uses, runs unchanged.

What it leaves out: the radio. There is no range or angle, a card is either on the reader or not, and only one is on it at a time, so two cards never collide. The RC522 runs on 3.3 V and is wired to the Uno’s 3.3 V pin here; on a real board, never give it 5 V.

Questions

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

Can I simulate an RFID door lock?

Yes. The RFID door project lets two of the four cards in with a green LED and turns the others away with a red one, and the RC522 tutorial walks through it.

Why does my RC522 say communication failure?

The library could not read the reader’s version register, so a wire or the supply is wrong. In the RFID door project, which prints the version as it starts, pull MISO or the 3.3 V wire and the version reads 0x0, with the same warning a real board prints.

Does it use the MFRC522 library?

Yes: #include <MFRC522.h>, PCD_Init, PICC_IsNewCardPresent and PICC_ReadCardSerial, as in the library’s own examples.

Read a card

Open the circuit, lay a card on the reader and press Run. Nothing to install, and no account needed.