Web Site: www.parallax.com
Forums: forums.parallax.com
Sales: sales@parallax.com
Technical: support@parallax.com
Office: (916) 624-8333
Fax: (916) 624-8003
Sales: (888) 512-1024
Tech Support: (888) 997-8267
RFID Read/Write Module, Serial (#28440)
Designed in cooperation with Grand Idea Studio (www.grandideastudio.com), the Parallax Radio
Frequency Identification (RFID) Read/Write Module provides a low-cost solution to read and write passive
RFID transponder tags up to 3 inches away. The RFID transponder tags provide a unique serial number
and can store up to 116 bytes of user data, which can be password protected to allow only authorized
access.
The RFID Read/Write Module can be used in a wide variety of hobbyist and commercial applications,
including access control, user identification, robotics navigation, inventory tracking, payment systems, car
immobilization, and manufacturing automation.
Features
y
y
y
y
Low-cost method for reading and writing
passive, 125 kHz RFID transponder tags
Up to 116 bytes of user data storage on a
single tag
Optional security features prevent tag from
being read or written without password
Bi-color LED for visual indication of status
Key Specifications
y
y
y
Power requirements: +5 VDC; < 10 mA idle,
approx. 100-200 mA active
Communication: asynchronous serial 9600 bps,
(8N1); 5 V TTL-level, non-inverted
Dimensions: 3.25 x 2.45 in (8.26 x 6.2 cm)
RFID Tag Compatibility
The RFID Read/Write Module works exclusively with
the EM Microelectronics EM4x50 1kbit R/W
transponder tags. A variety of different tag types and
styles exist, with the most popular ones made available
from Parallax.
Each tag contains a unique, read-only serial number (one of 232, or 4,294,967,296 possible combinations)
and 116 bytes of user data area stored in a non-volatile EEPROM (Electrically Erasable Read Only
Memory). The user data area can be optionally secured with a 32-bit password to allow only authorized
read and write operations.
The RFID Read/Write Module provides, with a single command, legacy support for the EM
Microelectronics EM4100 read-only tags that are used with Parallax’s RFID Card Reader Serial (#28140)
and USB (#28340).
Copyright © Parallax Inc.
RFID Read/Write Module, Serial (#28440)
v1.0 6/29/2010 Page 1 of 10
Connections
The RFID Read/Write Module easily interfaces to any host microcontroller using only four connections
(VCC, SIN, SOUT, GND).
Pin
Pin Name
Type
Function
1
VCC
P
System power. +5V DC input.
2
SIN
I
Serial input from host. TTL-level interface, 9600 bps, 8 data
bits, no parity, 1 stop bit.
3
SOUT
O
Serial output to host. TTL-level interface, 9600 bps, 8 data bits,
no parity, 1 stop bit.
System ground. Connect to power supply’s ground (GND)
terminal.
Note: Type: I = Input, O = Output, P = Power, G = Ground
4
GROUND
G
Use the following example circuit for connecting the Parallax RFID Read/Write Module:
Copyright © Parallax Inc.
RFID Read/Write Module, Serial (#28440)
v1.0 6/29/2010 Page 2 of 10
Usage
There are many ways to use the RFID Read/Write Module and associated tags, but the three most
common are as follows:
1) Read Only: Read the tag’s unique, non-changing 32-bit serial number
2) Read/Write: Read from and write up to 116 bytes of publicly accessible user data on the tag
3) Read/Write (Protected): Read from and write up to 116 bytes of password-protected user data
on the tag. In this mode, you must enter the correct 32-bit password in order for read and write
operations to be successful.
The RFID Read/Write Module is controlled by the host via a serial communications interface. The unit
waits in an idle state until it receives a valid header and command from the host, at which time the
module will perform the command and return a status/error byte indicating a success or failure and
command-specific data (if any). The module will then re-enter the idle state and wait for the next valid
header and command.
A visual indication of the RFID Read/Write Module’s state is given with the on-board LED (Light Emitting
Diode). When the module is successfully powered-up and is in an idle state, the LED will be GREEN;
when the module is in an active state (for example, searching for a valid tag or performing an operation
on the tag), the LED will be RED.
The face of the tag should be held parallel to the front or back face of the antenna (where the majority of
RF energy is emitted). If the tag is held sideways (for example, perpendicular to the antenna), you'll
either get no reading or a poor reading distance. Only one transponder tag should be held up to the
antenna at any time. The use of multiple tags at one time will cause tag collisions and the reader may
not detect any of them. The tags available in the Parallax store have a read distance of approximately
3 inches. Actual distance may vary slightly depending on the size of the transponder tag and
environmental conditions of the application.
Communication Protocol
The RFID Read/Write Module is controlled by the host via a standard, asynchronous serial
communications interface configured at 9600 bps, 8 data bits, no parity, 1 stop bit, and least significant
bit first (8N1). The serial data expected and transmitted by the RFID Read/Write Module is 5V TTL-level,
non-inverted.
To communicate with the RFID Read/Write Module, the user must first send a three-byte header string of
!RW (in ASCII), followed by the desired single-byte command (in hexadecimal). Certain commands
require additional data to be sent along with the command. A status/error byte and a varying number of
data bytes will be returned depending on the command called.
Copyright © Parallax Inc.
RFID Read/Write Module, Serial (#28440)
v1.0 6/29/2010 Page 3 of 10
Command Set
0x01: RFID_Read
Read data from a specified address
Input: Address location (1 byte), valid locations are 1-33 decimal
Output: Status byte (1 byte) + data (4 bytes)
Example:
SEROUT RFID_TX, Baud, ["!RW", RFID_Read, ADDR_Serial]
SERIN RFID_RX, Baud, [err, STR data\4]
' Read tag's serial number
' Get status byte & data bytes
0x02: RFID_Write
Write data to a specified address
Input: Address location (1 byte), valid locations are 3-31 decimal + data (4 bytes)
Output: Status byte (1 byte)
Example:
' Write $FEEDBEEF to address 3 (User Data Area)
SEROUT RFID_TX, Baud, ["!RW", RFID_Write, 3, $FE, $ED, $BE, $EF]
SERIN RFID_RX, Baud, [err] ' Get status byte
Note: After writing the specified data to the tag, the RFID Read/Write Module automatically performs a
read function to verify that the data has properly been written.
0x03: RFID_Login
Login to the tag (required to use password protection features)
Input: Password (4 bytes), default = 0x00000000
Output: Status byte (1 byte)
Example:
' Login to tag with password
SEROUT RFID_TX, Baud, ["!RW", RFID_Login, $00, $00, $00, $00]
SERIN RFID_RX, Baud, [err]
' Get status byte
0x04: RFID_SetPass
Change the tag’s password
Input: Current password (4 bytes) + new password (4 bytes)
Output: Status byte (1 byte)
Example:
' Change password from current ($00000000) to new ($FEEDBEEF)
SEROUT RFID_TX, Baud, ["!RW", RFID_SetPass, REP $00\4, $FE, $ED, $BE, $EF]
SERIN RFID_RX, Baud, [err] ' Get status byte
Copyright © Parallax Inc.
RFID Read/Write Module, Serial (#28440)
v1.0 6/29/2010 Page 4 of 10
0x05: RFID_Protect
Enable (lock) or disable (unlock) the tag’s password protection.
Input: Mode (1 byte), 0x00 to unlock, 0x01 to lock
Output: Status byte (1 byte)
Example:
SEROUT RFID_TX, Baud, ["!RW", RFID_Protect, 1] ' Lock the tag
SERIN RFID_RX, Baud, [err]
' Get status byte
Note: When the tag is locked, a successful login using the RFID_Login command is required before you
can enable/disable password protection, change the tag’s password, or read/write to the tag. If the tag is
locked and you are not successfully logged in, the RFID_Read command will return four bytes of 0x00 in
place of the actual user data and the RFID_Write command will return an error.
0x06: RFID_Reset
Log out and reset the tag.
Input: None
Output: Status byte (1 byte)
Example:
SEROUT RFID_TX, Baud, ["!RW", RFID_Reset]
SERIN RFID_RX, Baud, [err]
' Reset the tag
' Get status byte
Note: All user data will remain stored on the tag. You will need to re-login using RFID_Login if you want
to access a locked tag after calling this command. You can also reset the tag by removing it from the
proximity of the RFID Read/Write Module.
0x0F: RFID_ReadLegacy
Read the 40-bit unique serial number from an EM Microelectronics EM4100 read-only tag (used with
Parallax’s RFID Card Reader Serial, #28140, and USB, #28340).
Input: None
Output: Header (1 byte) + data (10 bytes) + footer (1 byte)
Example:
SEROUT RFID_TX, Baud, ["!RW", RFID_ReadLegacy]
SERIN RFID_RX, Baud, [header, STR data\10, footer]
' Read EM4100 unique serial #
' Get header, data, and footer
Note: The header and footer are used to identify that a correct string has been received from the
reader (they correspond to a line feed and carriage return characters, respectively). The middle ten bytes
are the tag's unique ID sent in a printable ASCII string. For example, for a tag with a valid ID of
0F0184F07A, the following bytes would be sent: 0x0A, 0x30, 0x46, 0x30, 0x31, 0x38, 0x34, 0x46, 0x30,
0x37, 0x41, 0x0D.
Copyright © Parallax Inc.
RFID Read/Write Module, Serial (#28440)
v1.0 6/29/2010 Page 5 of 10
Error Checking
The RFID Read/Write Module responds to each command with a single-byte status/error code in
hexadecimal format followed by any returned data, if applicable. In most standard implementations, the
user will repeatedly call the desired function until the ERR_OK status byte is returned, indicating that the
function successfully completed with no errors.
For scenarios where more error checking is desired, the RFID Read/Write Module provides detailed error
code values:
Value
Name
Description
0x01
ERR_OK
No Errors
0x02
ERR_LIW
Could not find a Listen Window (LIW) from the tag
0x03
ERR_NAK
Received a No Acknowledge (NAK), possible communication error or
invalid command/data
0x04
ERR_NAK_OLDPW
Received a No Acknowledge (NAK) sending the current password during
the RFID SetPass command, possible incorrect password
0x05
ERR_NAK_NEWPW
Received a No Acknowledge (NAK) sending the new password during the
RFID SetPass command
0x06
ERR_LIW_NEWPW
Could not find a Listen Window (LIW) from the tag after setting the new
password during the RFID SetPass command
0x07
ERR_PARITY
Parity error when reading data from the tag
Tag Details
The RFID Read/Write Module works exclusively with the EM Microelectronics-Marin SA EM4x50 1kbit
R/W transponder tags at 125kHz. A variety of different tag types and styles exist with the most popular
ones made available from Parallax.
The memory map and corresponding address locations for the EM4x50 tag are shown below. Each
address holds a 32-bit (4 byte) value.
Address (decimal)
Register
Description
0
ADDR_Password
Password (not readable)
1
ADDR_Protect
Protection word
2
ADDR_Control
Control word
3-31
User Data Area
Non-volatile EEPROM storage area for user data (116 bytes)
32
ADDR_Serial
Device serial number (unique, read-only)
33
ADDR_DeviceID
Device identification (used to identify tag family, read-only)
The User Data Area can be optionally secured using a 32-bit password to allow only authorized read and
write operations. This password is stored in ADDR_Password and can be changed by the user via the
RFID_SetPass command with knowledge of the current password. For security reasons, it cannot be read.
As such, if your tag is password-protected and you forget the tag’s password, you will be unable to
retrieve the contents of the User Data Area.
ADDR_Protect and ADDR_Control are modified directly by the RFID Read/Write Module and, in normal
scenarios, should not be changed by the user.
Copyright © Parallax Inc.
RFID Read/Write Module, Serial (#28440)
v1.0 6/29/2010 Page 6 of 10
ADDR_Serial is a unique, read-only serial number with one of 232, or 4,294,967,296, possible values. It
cannot be changed by the user.
ADDR_DeviceID is a read-only value used to identify the specific tag family (for example, EM4150). The
32-bit value contains a family code, version code, reserved/unused bits, and a checksum value. It cannot
be changed by the user.
Further details of the EM4x50 tag can be found at:
www.emmicroelectronic.com/Products.asp?IdProduct=159
Electrical Characteristics
At VCC = +5.0V and TA = 25ºC unless otherwise noted
Parameter
Symbol
Specification
Test Conditions
Unit
Min.
Typ.
Max.
Supply Voltage
VCC
---
4.5
5.0
5.5
V
Supply Current, Idle
IIDLE
---
---
9.4
---
mA
Supply Current, Active
ICC
---
---
108
200
mA
Input LOW voltage
VIL
+4.5V