The easiest way to operate the RFID. An UART serial module interface to Bolt 18F2550 microcontroller.

 Author: Moises Melendez Reyes

Figure 1


Figure 2


Figure 3


In a previous project, an RFID module with SPI interface microcontroller 18F2550 Bolt system, with the possibility of reading or writing data to the ISO-14443A tag was described.

Although the SPI interface is the most economical solution for handling RFID, the management of the SPI protocol and commands to the RFID module represents considerable extra work for the  microcontroller firmware programmer. Furthermore, the RFID-MF522 and RC522 modules used for the SPI interface, operate at a voltage of 3.3 volts, requiring an additional voltage regulator circuit.

A much simpler solution, if more costly, is to use an RFID-UART interface which greatly simplifies the job of programming the firmware, since the available UART commands are very simple to use. For example, you may request from the microcontroller the ISO-14443A tag's serial number only sending the command '01 'through the serial port. And for convenience, the module operates with a voltage of 5v.

The company is selling a device that can be used in this project: the RFID-UART module


In this project, using a Samsung Galaxy mobile phone as a receiver and display of data, an UART RFID read-write, with operating frequency of 13.56 MHz and serial interface, connected to a Bolt 18F2550 system is described.

Another option for RFID data display, is to use a Laptop computer, either Windows 8 or 7, running Hyperterminal. By means of a USB-Serial cable, the Bolt microcontroller transmits information to the computer via the serial port at a speed of 9600 bps as shown in Figure 3.

The system can be used in the following applications: access control, attendance control, public transportation, parking of vehicles, electronic payment systems, inventory control, registry of credentials in schools and sports clubs, and many others.


THE ISO-14443A TAGS S50:

The UART RFID device receives information from ISO-14443A type tags. These tags contain an EEPROM with capacity of 1 Kb of data storage space. This project tests were performed with both types, card and keychain.



To establish communication between the microcontroller and the mobile, a bluetooth module HC-06 with serial port is used, which allows the wireless transmission of RFID data received by the Bolt microcontroller to the mobile phone. This link, which is a Class 2 in the Bluetooth standard, can operate up to a distance of 10 meters.

In the mobile phone, an application called BlueTerm should run. BlueTerm which is a terminal emulator that allows visualization of the ASCII data sent by the Bolt system.

To properly configure the Bluetooth functionality in your mobile as well as the BlueTerm program, please go to this link

Several test functions for both tag reading and for writing new data were developed.

In particular, a very simple test function that allows to observe the serial number tag on the Bolt system and displaying the data on your LCD (see Figure 1) was developed.

The firmware ANSI C functions available to the RFID-UART module are described in detail below.



Connecting the UART module to RFID-18F2550 Bolt system.

Based on the photo at left, connect devices as shown. The 4-pin auxiliary port will be used to carry out the UART communication.

Connect the RFID-UART module through the 4 dupont cables included in the kit.

RX pin connects to RC1, and the TX pin connects to RC2. Both signals are transmitted and received through 'bit-banging' functions, that is, doing the sampling of each of the bits of the data stream, emulating a standard RS232 asynchronous serial port at 9600 bps.

In this project, the RS232 serial port of Bolt is not used for connection to the RFID module, because it will be used for the Bluetooth interface, for communication with mobile phone. Furthermore, the LCD port will be used to display data.

Important: the dip switches SW3 and SW4 must be in the OFF position to avoid interfering with the signals of the RFID-UART.



To complete the system tests the user must assemble the test equipment as in Figures 1 and 2, shown at the top of this page. Its operation requires the proper firmware has been previously loaded to Bolt system, following the instructions given right away.

The complete folder MPLAB IDE project with the C18 compiler is:


In this program, 7 basic functions for managing RFID-UART module are provided. From these functions is that the user may subsequently deploy their own application. The functions are:



showSerialNumber( ); Displays on the LCD and the serial port RS232, the serial number of tag.
detectCard( ); Displayed on the LCD and RS232 serial port the card detection status.
readDataHex( ); Sends to the serial port RS232, in hexadecimal format, the tag information (stored in 1k EEPROM). User will see only blocks containing information.
readDataAscii( ); Sends to the serial port RS232, in ASCII format, the tag information (stored in 1k EEPROM). User will see only blocks containing information.
clearTAG( ); Erases all EEPROM tag information.
writeDumpTAG( ); Write all EEPROM of tag with ASCII characters and capital letters in alphabetical order. Displays the status of the function on the RS232 serial port.
writeBlockTAG( ); Write in tag EEPROM, information previously provided by the user and sent to the RS232 port status (only sends the blocks containing information).

To test each function, the project file should be opened using MPLAB IDE (file RFIDmoduleC18swserie.mcp) and, once the MPLAB window is ready, in the source program (RFIDmoduleC18swserie.c), locate the 7 functions listed in the table above.

Symbols '//' (indicating comment) must be removed, so that only the function to be tested will be enabled, for example, in the figure below, the user selected function showSerialNumber( ).

Now, you must compile the program (> Project> Built All) and load the resulting file RFIDmoduleC18swserie.hex into your Bolt system. This file is located in the subdirectory named 'Release' in the project folder.

In each test, the tag should be approached at a distance of 2 to 5 cms. to the RFID-UART device, and remain in that position until observing the results on the LCD display or on your mobile phone.


This function allows writing new data to the tag and requires the user to write directly on the program and recompile. The window below shows how to do it. The user must first clear the comment symbol '//' so as to eneble the writeBlockTAG ( ) function. Subsequently, you must enter the block number (in this example is 22) and the text (in this example is 'Hello how are u!'). And now, you must recompile the program and load the. hex file on the Bolt card.

When approaching the RFID tag, this new information is written to the requested block.

- The program only allows you to type in a block at a time. If you want to write information into multiple blocks, you must repeat the procedure as many times as necessary.

- To write completely new information in the tag, first clear all the EEPROM by using the clearTAG ( ) function.


To display the data read from the RFID tag through the UART, the mobile phone must run the application called 'BlueTerm', compatible with the Android operating system (equivalent to 'Hyperterminal' software for Windows), and which is an application of terminal emulator that allows you to send or receive ASCII strings, through the already built-in Bluetooth phone link. This program is free and can be directly downloaded to your mobile phone from the Google Play website.

Manuals spec sheets, and other recommended links:

RFID-UART 13.56 Mhz_Manual.zip


MF522 RFID module connected to Bolt 18F2550, with visualization of data in mobile smartphone.

 The easiest way to manage RFID: an UART serial port interface

Low cost school attendance RFID system, using an Excel spreadsheet.

The functioning of an RFID 13.56 ISO-14443A read/write tag