RFID Reader

The Soldered 125 kHz RFID Reader reads passive 125 kHz RFID cards and key fobs over I²C. It detects tag presence and reports the tag ID. Up to eight readers can be connected simultaneously via address selection. See the Soldered documentation for wiring and hardware details.

Connection

Call startRFIDReader() inside preload(). The device is ready to use by the time setup() runs.

let reader;

function preload() {
  reader = startRFIDReader(name?, addressOrIndex?);
}

name string | false | null "rfid"

Controls automatic event callback registration. With the default name:

function rfidChanged(event) { /* tag detected or removed */ }

Pass false or null to disable and use addEventListener instead.

addressOrIndex number 0x30

The I2C address of the device, or an index (0–7) into the address list. Eight addresses are available, selectable via solder jumpers on the board:

AddressIndexA0A1A2
0x300000
0x311100
0x322010
0x333110
0x344001
0x355101
0x366011
0x377111

Methods

getTagID() string | null

Returns the ID of the currently detected tag as a hex string, or null when no tag is present.

Methods (BaseDevice)

connect() Promise<Response>

Opens the USB connection and sends the start command to the firmware. Calling it multiple times is safe — subsequent calls return the same promise. In p5.js you do not need to call this manually; startXxx() calls it for you inside preload().

Properties

Properties (BaseDevice)

id { type, address }

Identifies the device. type is the DeviceType enum value, address is the I2C address the device was started with.

isConnected boolean

true once the USB connection has been established and the firmware has acknowledged the device. In p5.js this is always true by the time setup() runs, because startXxx() waits for the connection inside preload().

Events

changed(event) changed

Fires when a tag is detected or removed. Check event.detail.tagId — an empty string indicates the tag was removed.

Event Argument

All event callbacks receive a single event argument. The event detail is available at event.detail and contains:

event.detail.tagId string — Hex string ID of the detected tag. Empty string when the tag is removed.