Using RFID/NFC and QR-Code in Mobile Phones to Link the Physical and the Digital World

Today it is clear that the most widely used device in the world is the mobile phone. Phones are mostly voice-centric devices, but a wide range of mobile devices now exist on the market offering multiple services and functions. The term smartphone is now used to characterize a mobile phone with special computer-enabled features. Despite the mobile phone evolution, one of the main disadvantages of these devices is that they still have insufficient input capabilities, providing tiny keyboards to do manual entries. Fortunately most smartphones are now equipped with several sensors that can be used to enhance and create new users interfaces. This is the case for integrated cameras that can be used to read visual codes, like Quick Response (QR) Code as well as other sensing technologies such as Radio Frequency Identification (RFID) and the associated Near Field Communications (NFC). The use of these technologies does not only facilitate entering information, but it also allows using mobile phones for interactions with people, places and things, enhancing the usability and usefulness of these devices. The use of QR Codes and RFID tags has significantly evolve in the last decades, they were first used to track products in the industry, but now they have contributed to develop several new concepts that integrate the physical world with the virtual one.


Introduction
Today it is clear that the most widely used device in the world is the mobile phone.Phones are mostly voice-centric devices, but a wide range of mobile devices now exist on the market offering multiple services and functions.The term smartphone is now used to characterize a mobile phone with special computer-enabled features.Despite the mobile phone evolution, one of the main disadvantages of these devices is that they still have insufficient input capabilities, providing tiny keyboards to do manual entries.Fortunately most smartphones are now equipped with several sensors that can be used to enhance and create new users interfaces.This is the case for integrated cameras that can be used to read visual codes, like Quick Response (QR) Code as well as other sensing technologies such as Radio Frequency Identification (RFID) and the associated Near Field Communications (NFC).The use of these technologies does not only facilitate entering information, but it also allows using mobile phones for interactions with people, places and things, enhancing the usability and usefulness of these devices.The use of QR Codes and RFID tags has significantly evolve in the last decades, they were first used to track products in the industry, but now they have contributed to develop several new concepts that integrate the physical world with the virtual one.
In this chapter we describe RFID/NFC and QR-Code technologies.We present the methodologies and the software Application Program Interfaces (APIs) associated with these technologies for their use in mobile phones.QR-Code readers already available on mobile phones are also described and compared.In addition we present several mobile services and projects that base their functionality on the use of these technologies.

Identification, sensing and communication technologies
Automatic identification and data capture (AIDC) techniques provide fast, easy and accurate data collection methods.Once data is captured it can be stored or analyzed by a computer or another device.AIDC methods in general do not require human involvement Near Field Communication (NFC) is also a short-range high frequency wireless communication technology which enables the exchange of data between devices at distances fewer than 10 cm.This technology is an upgrade to RFID technology; it was designed and marketed by the NFC Forum.Table 1 shows a comparison among different technologies of short-range communication.Bluetooth and IrDA are not compatible with NFC but they can be used in combination, for instance NFC can be used for pairing (authenticating) a Bluetooth session used for the transfer of data (Ortiz, 2008).On the other hand NFC is compatible with RFID and basically, both technologies use the same working standards.NFC can be seen as an evolution of RFID, both of them use radiofrequencies for communication; however RFID can operate in a long distance range, therefore it is not suitable for exchanging sensitive information since it can be vulnerable for various kinds of attacks.Contrary NFC has a very short transmission range, in this way NFC-based transactions are inherently secure.
The International Standard Near Field Communication -Interface and Protocol, ISO/IEC 18092 (NFCIP-1), defines communication modes for NFC interface and protocol.According to this standard, NFC can operate in active or passive mode.In active mode, the devices generate their own electromagnetic field independently, while in passive mode only one of the devices is capable of generating an electromagnetic field and the other extracts energy from it to operate and transmit the required information.NFCIP-1 defines the following operating speeds: 106, 212, 424 and 848 Kb/s.One of the key elements of NFC enabled devices is the ability to read different types of tags.This facility of NFC technology is a key enabler for many applications.NFC tags are passive devices with no power of their own.In order to read a tag the users almost touches it with an NFC-enabled device.A small amount of power is taken by the NFC tag from the reader/writer to power the tag electronics.The tag is then enabled to transfer a small amount of information to the NFC reader


Tag 4 Type: Defined to be compatible with ISO14443A and B standards.These tags are pre-configured at manufacture and they can be read, re-writable, or read-only.They have a memory capacity up to 32 kbytes.The communication speed is in the range of 106 kbit/s and 424 kbit/s.
In addition, the NFC specification also includes a common data format to exchange and store information using NFC-enabled devices and tags.This is the Data Exchange Format (NDEF).It can be used to store different types of objects encapsulated in several records.Each record contains information about the data or payload that it encloses, for this, it includes three parameters: the payload length, the payload type, and an optional payload identifier.NDEF can be used to encapsulate one or more message payloads of different applications, which may be of different sizes and types.Type identifiers may be URIs, MIME media types, or NFC-specific types.The payload length is an unsigned integer which indicates the number of bytes and cross-references between them.Figure 1 shows a NDEF message.It consists of one or more records, where the first record is marked with the Message Begin (MB) flag and the last one with the Message End (ME) flag (NFC Forum, 2006).The minimum length of a message is one record.In this case both flags, MB and ME, are placed in the same record.It takes at least two records to consider a segment payload.
There is no limit to the maximum number of records.The main characteristic of a QR Code compared with a traditional bar code is that it contains information in both the vertical and horizontal directions, while a bar code contains data in one direction only.For this reason QR code holds a considerably greater volume of information.In addition it can encode several types of data including symbols, control codes, binary data, and multimedia data.The typical barcode holds a maximum of 20 digits, while the maximum data capacities of a QR code are 7,089 characters for numeric data, 4,296 characters for alphanumeric data, 2,953 bytes for binary data, and 1,817 characters for Japanese Kanji and Kana data.Fig. 2 shows a QR Code compared with a traditional bar code.QR Code is faster to read than other two-dimensional code, because it contains three large square patterns in the corners that are used for position detection.Additionally, the patterns are used to detect the size, the angle and the outer shape of the symbol.When a reader scans a symbol, it first detects these patterns.Once the position patterns have been detected the scanner can rapidly read the inside-code in all directions.The inside code consists of several small blocks where the information is encoded.The decoding speed of the QR Code can be 20 times faster than that of other 2D symbols (Soon, 2008).The structure of a QR code is shown in figure 3. It can be observed that a QR includes information to provide error correction capability.
Thanks to this capability it is possible to read the code even if it presents some distortions or damage.There are four different error correction levels, each one with an approximately percentage of the symbol area that can be restored at maximum: Level L (7%), M (15%), Q (25 %), and H (30%).This level can be configured by the user when he/she creates the symbol.If there is a high probability that the code will be distorted due to the usage environment, it is recommended to choose Level H for a 30% correction level.
There are 40 symbol versions of QR Code, each version has a different number of black squares that are called modules, more modules means that more information can be stored but also a bigger size of the QR Code.The minimum size is 21 x 21 modules (version 1) and the maximum size is 177 x 177 modules (version 40).Mobile applications use only versions 1 to 10 to take into account camera phone limitations (Kato & Tan, 2007).
QR code can be easily generated using free on-line generators.They can be printed on plain paper using an ordinary printer and attached to any object.Today we can see QR codes often in the media, like TV shows and newspapers.They are commonly used to store URLs or other small identifiers like e-mails and phone numbers that can be read using mobile devices.Once the information stored in the QR code is decoded the appropriate content is retrieved from a remote server, facilitating mobile navigation.Besides this, QR codes can have other several applications as explained in the following sections.

Using QR Code and RFID/NFC in mobile phones
The software and the application programming interfaces (APIs) required for providing the capability of reading QR Codes and RFID/NFC tags with a mobile phone depends on the operating system and the programming platform of the device.Currently there are several mobile operating systems and platforms available.The next sections explain the use of QR code and RFID/NFC in some of the most commonly used mobile platforms (e.g.Java ME, Android).Unfortunately at the moment (mid-2011), iPhone platform does not support RFID/NFC communication.

QR Code and mobile phones
QR codes can be decoded using mobile phones equipped with a camera and an appropriate scanner.In Java ME the mobile phone must support the Mobile Media API or MMAPI in order to take pictures.The MMAPI is documented as the JSR 135 in the Java Community Process (JCP); it extends the functionality of the Java ME platform by providing audio, video, and other time-based multimedia support to resource-constrained devices.
In Android platform the Camera class included in the android.hardwarepackage is used to set image capture settings, start/stop preview, snap pictures, and retrieve frames for encoding video.The actual camera hardware is managed by the Camera service.The Camera class is a client of this service.To access the camera device, the CAMERA permission must be added to the Android Manifest.The manifest must include also the <uses-feature> element to declare camera features used by the application.To read QR-Codes the auto-focus feature must be included, as a result the manifest should include the following lines: <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera"/> <uses-feature android:name="android.hardware.camera.autofocus"/> In the iPhone platform the UIImagePickerController class can be used for taking pictures and movies on supported devices.
Any Java ME based application requires taking a picture or snapshot, before any type of action can be performed.Others platforms like Android and iPhone can provide zero-click experience by using scanning type applications to read the code.In all cases an appropriate algorithm must be used to read and interpret the code.
Some recent mobile phones include pre-installed QR code readers, for example Nokia Barcode Reader is pre-installed on the N82, N93, N93i, N95, E66, E71 and E90 mobile phones (Nokia, 2008).Most Android mobile phones also include a preinstalled barcode reader.In addition there are several readers available for different mobile platforms like: BeeTagg, QuickMark, Kaywa, Zxing, among others.Once the appropriate QR code reader is installed on the mobile device, users only require taking a snapshot of the code to decode it.Additionally some readers are able to take the appropriate action depending on the code's content, for instance if the code contains an URL, the reader may launch a browser.Very few readers are open source providing the capability to developers to add more functionality to the reader besides the ones that it includes.Table 2 shows a comparison of the QR code readers that we consider the more popular at the moment.

RFID/NFC in mobile phones
NFC technology is currently mainly intended to be used with mobile phones.As explained in section 2.1, this technology is based on a very short-range protocol that requires that the devices almost touch each other to establish communication or to read an RFID tag.
An NFC-enabled mobile device must have the appropriate hardware; it includes a Radio Frequency Unit, a baseband processor and a NFC Controller with an antenna.It also includes a secure smartcard chip known as the secure element that can be used for tag emulation mode allowing the mobile device to be used as a smart card.This means that the NFC-enabled mobile phone can operate in the following modes as depicted in figure 4 Besides the required hardware the mobile device must use appropriate software to establish an NFC connection.The next section describes the available APIs that can be used to implement NFC communication.

JSR-257
Nokia was the first one to introduce RFID/NFC enabled mobile phones.In 2007 the company launched the 6131 NFC phone, which was the first integrated NFC handset that was available to the public.Nokia Corporation also led the research group that developed the Contactless Communication API or JSR-257 (JSR 257 Expert Group, 2006), which is a Java ME optional package that allows applications to access information on contactless targets, such as RFID tags and bar codes, including QR-Codes.This API provides easy access to various targets, and provides mechanisms to discover and communicate with them transferring and receiving information.The API uses the NFC Data Packaging Format (NDEF) to exchange information between NFC devices and RFID tags.Using this data format the application developer can exchange NDEF formatted data with a target without knowing its physical type.
Figure 5 shows the structure of the Contactless Communication API.

Fig. 5. JSR-257 API Overview
As it can be observed the API consists of five packages as follows:  javax.microedition.contactless.The first step for a RFID/NFC application is to discover the available targets (tags or devices) in order to be able to receive later notifications about them.This package is then required to implement any NFC application since it provides target discovery using the DiscoveryManager class.Tag: Represents a tag that has been scanned by the device.When a tag is discovered, a Tag object is created and enfolded inside an Android's intent.The NFC dispatch system is then in charge of sending the intent to a compatible activity.
The android.nfc.techpackage provides access to a specific tag technology once a tag has been read.Each type of tag contains different features and even a scanned tag can support multiple technologies (i.e.MifareClassic, NfcA and NDEF).This package contains one interface and nine classes as follows:  TagTechnology.This interface provides access to tag properties according to the tag technology.


The classes in the android.Applications developed to use the NFC API, must also request permission from the user before establishing NFC communication.This is done in the manifest file where the following declaration has to be added: <uses-permission android:name="android.permission.NFC"> In the same way, it is also recommendable to add another line in the manifest that allows filtering the application in the Android Market, so it is only discoverable by users with NFCenabled devices.The manifest requires the following line : <uses-feature android:name= "android.hardware.nfc"android:required = "true">

Open NFC
One of the main issues of mobile software development is heterogeneity.Today mobile phones range from several development platforms as well as operating systems and hardware.This is a challenge for both developers and final users.When talking of RFID/NFC for example, the APIs provided are commonly written to perform well under a determined type of hardware or mobile device.JSR-257 for example is intended for CLDC/MIDP devices, while Android NFC API works for NXP controller chips used in the first NFC Android phone, the Google Nexus S.However, allowing interoperability between various types of NFC hardware and software can help accelerating the adoption of NFC technology in the market.This is the idea of the Open NFC project Open NFC can be used to developed different mobile applications since it includes several levels of functionality.The platform allows developing applications that involve peer-topeer communications, Bluetooth and Wi-Fi, and interactions with single-wire protocol subscriber identity module (SIM) cards used in some mobile devices as well as in FeliCa, Mifare and ISO 14443 RFID tags.
In order to be hardware independent the Open NFC relies on a Hardware Abstraction Layer (HAL) to access NFC hardware.Each NFC hardware needs a specific implementation of the NFC HAL. Figure 6 shows the architecture of Open NFC platform.As explained before both technologies, RFID/NFC and QR Code, can be considered as AIDC techniques and used with mobile phones.In Table 3 we summarized the characteristics of both technologies and compared them.

Availability in mobile phones
High: Any camera-enabled mobile phone, several include preinstalled readers.
Low: Only NFC-enabled devices

Cost
Low: Tags can be printed in any printer, using common paper Medium/High: Depends on the NFC/RFID tag or smartcard to be used.

Users Learning Curve
Low: Most users are already familiar with mobile cameras.
Medium: Users require learning NFC basis.

Security
Low: Information can be read easily by any camera-enabled device.
High: Devices must be very close to read information

Storage capacity
High High

Damage resistance
Medium: QR Code includes error correction data that allows up to 30% recovery of a distorted or damaged tag.
Low: If wires are damaged tag cannot be read.

Visibility requirement
High: Code must be visible and well illuminated.None: Tags can be hidden.

Table 3. QR-Code and NFC comparison
The main disadvantage of NFC is that at the moment the number of NFC-enabled mobile phones is still very limited, while QR Code can be read with any camera-enabled mobile phone.Another important aspect is that QR Code tags can be printed with any ordinary printer using common paper, while NFC and RFID tags or smartcards require special devices to write data on them.Some researchers and engineers consider that as the number of NFCenabled mobile phones is increasing, QR Code will be replaced by this technology.We disagree with this assumption, and we consider that both technologies will coexist for a long time.QR code has the advantage of being almost free and easy to use, while NFC technology offers security and interoperability with different type of tags, besides both technologies are useful for several type of applications as will be seen in the following sections.

Related technologies
The use of mobile devices to link physical objects in the real world to the digital one using RFID, NFC and QR Code has impacted several technologies like Internet of Things, Object Hyper linking and Mixed Reality.These concepts are described in the following sections.

Internet of Things (IoT)
The IoT concept defines a new paradigm to identify and communicate with smart objects.The basic idea of this concept is the pervasive presence of different things or objects like tags, sensors, and mobile phones that can interact with each other and also with their neighbors through unique addressing schemes in order to reach common goals (Atzori et al., 2010).This concept relies in the possibility of implementing a global infrastructure of networked physical objects (Guinard & Trifa, 2009).
One of the basis of IoT is radio frequency identification (RFID), however the IoT concept allows communication between the physical world and the digital world also using other visual markers and embedded computers.In this way the information about everyday objects can be accessible in mobile devices.The IoT is still an emerging concept since several issues are still in progress like: addressing scheme, security, networking and standardization, however it promises to be a concept that will impact our everyday lives, just like the Internet itself has done.The U. S. National Intelligence Council lists the IoT among the six technologies that may impact U.S. national power by 2025 (Iera et al., 2010); similar results can be expected in many countries.
Although the IoT implementation is still in progress, several innovative applications already use this concept.Some of them require the use of NFC-enabled mobile devices as a key implementation element.

Object hyperlinking
Object hyperlinking is a new term that extends the current Internet to the real world.This is done attaching tags to real world objects, this tags contain URLs that can be read with a mobile device in order to retrieve and display information about the objects, like if we use a web browser and enter the object's URL.Besides this use, object hyperlinking may be useful for other applications like administering data objects in data bases or with text content management.The object hyperlinking concept allows using several tagging systems.
An object hyperlinking system requires the following components (Wikipedia, 2011): 1.An object marked with a visual tag containing an URL is mandatory.As mentioned before different tagging systems may be use, RFID and QR-Codes are two of them.In addition SMS tags, virtual tags and hardlinks have also been used.An SMS tag consists of an alphanumeric code that can be printed on a marker.In order to retrieve the information about the object, the user must send this code using the SMS service.
Virtual tags as the name implies do not include any physical tag on the object.Instead a URL is associated with a set of geographical coordinates.These tags can only be read with a GPS-equipped mobile phone.A hardlink consists of an alphanumeric combination that is included in a URL.This URL targets a hardlink database containing information about the object.2.An appropriate reader in order to retrieve information from the tag is also required; this may consist of a camera, a GPS or an RFID reader depending on the tagging system used.3. The mobile device used to retrieve information must include the required software to read and display tags.4. Since the information is retrieved from the Internet, a wireless network is also required, such as WiFi, WiMax or 3G networks.5. Information on each linked object.This information could be in existing Web pages, existing databases of price information etc., or have been specially created.
6. Finally the mobile device must have an appropriate display to show the information on the linked object.
Object hyperlinking is being well accepted in several fields and new ones that have emerged as mixture of social and commercial applications.

Mixed and augmented reality
Milgram & Kishino (1994) defined mixed reality as "...anywhere between the extreme of the virtuality continuum.",where the Virtuality Continuum extends from the completely real through to the completely virtual environment with augmented reality and augmented virtuality ranging between, as depicted in figure 7. It can be said that Virtual Reality (VR) is when participants are completely immersed in a fictitious world that can take some properties of the real world but that replaces it with a simulated one.The road from the real world to a virtual one may include other environments where the participants are still connected with a real world while enhancing it with other contents, merging both worlds in some way.This concept can be referred as Mixed Reality (MR) and Augmented Reality.Augmented reality (AR) refers to augmenting the real-world with content generated with a computer or another device.This content can include sound, video, graphics, and other data.

Fig. 7. Reality-Virtuality Continuum
Even though the MR concept was defined since 1994 it is until now that, thanks to the advances in the design of interactive technologies, it has been possible to start using mixed reality environments.Mobile mixed reality occurs when we use mobile technology, including wireless communication, mobile devices and mobile software to enhance or supplement the physical world with digital content.This can be done using several sensors available in mobile devices like GPS, camera, accelerometer, wireless sensitivity, compass direction, and sound and image recognition that can take properties and data from the real world in order to process it and provide enhanced content obtained from the digital world.
Since not all mobile phones in the market have all these sensors capabilities, RFID and QR code can be used as a first step to implement mobile mixed reality systems.These technologies can be used to link the physical objects to the mobile device in order to provide enhanced visions to the user, allowing in some way the mixed reality content.

Applications and projects
In the next sections several projects found from the literature are presented.These projects illustrate how the use of mobile phones to link physical objects tagged with RFID/NFC tags or QR Codes can impact several important areas like education, health, culture and others.

Education
The study of QR codes and RFID tags in education can be placed in the context of mobile learning and ubiquitous learning.Mobile learning, also known as m-learning, can be described from different perspectives, considering that it allows people to learn without restriction of location (Lam et al., 2010) using wireless technologies and mobile applications.Though m-learning provides mobility, it is not context sensitive.A new mode of learning mechanism called u-learning is context aware and also provides anywhere, anytime learning using various mobile and sensor technologies.Several researches and institutions have found interesting ways to apply QR-codes and RFID tags for the m-learning and ulearning process.
The University of Bath is the predecessor of applying QR-codes in education (Law & So, 2010).They have incorporated this technology in several aspects related with the learning process.For instance, they use QR-Codes in the library to provide information about the books.They have also developed an enhancement for Moodle which automatically includes the QR code for the page that has been printed.The QR code contains the URL of the page on that particular Moodle course.They have also added QR codes on posters that can be found around the campus, on Websites and service blogs for bookmarking, in handbooks linking to activities, and in marketing materials from departments.
According to Susono & Shimomura (2006) in Japan almost 100% of college students have mobile phones, for this reason they are commonly used for education purposes.In their work they reported the use of mobile phones and QR-Codes to conduct surveys during class, this with the intention of providing feedback to the teacher at the middle of a long class (i.e. 90 minutes).With this project students answer a survey using their mobile devices and QR-Codes to choose from different options.They send the answer to a server and the teacher can have immediate feedback in order to improve his/her class if needed.
Another particular field in education where QR Code and RFID/NFC can be very useful is Outdoor learning; this is an education approach that can be very effective for multiple areas.
For instance, Law & So (2010) propose using QR-Code in math and sciences trials.For this, QR-codes containing questions can be placed outdoors on different locations and students use their mobile phones to read the questions in order to answer them.Liu, et al. (2009) proposed the concept of Environment of Ubiquitous Learning with Educational Resources (EULER) using mobile devices and RFID tags for outdoor natural science learning.RFID tags are located on several learning objects, and can be used by the student to download context-aware content to the mobile device.The student can then immediately browse the provided content that can include audio, video and augmented reality content.In this work a PDA was used to read RFID tags, however similar works could be implemented using NFC-enabled mobile phones and the appropriate API.Mandula et al. (2011) used mobile devices and RFID to implement a u-learning system, in this case for an indoor learning environment, like botanical gardens, smart museums or a smart lab.RFID tags are used to enable the learner to access the learning content of an object according to the surrounding context.This tags are placed on learning objects (e.g.smart posters), and when a student comes in proximity with her/his mobile phone, the mobile client application captures the object ID and sends it to the application server for processing.At a remote server, relevant content corresponding to object ID is fetched and presented to the learner's mobile device using WLAN or 3G networks.
Mobile and ubiquitous learning can be also very useful for language learning as it has been showed by Law & So (2010) who proposed using QR-Codes for an English Listening Exercise in the area of self-directed multimedia learning activities.In this case QR-Codes containing links to Websites for direct audio playback are placed onto worksheets.The QR codes link directly to the Web-based audio depository prepared by the teachers.Similar works can be implemented using RFID or NFC tags.
These projects are just a few examples of how QR code and NFC can be used on mobile phones to link physical objects, in this case, worksheets or objects existing in nature, labs or classrooms to implement m-learning and u-learning applications.

Health
The use of mobile technologies and applications for public health practice has led to the development of a new concept known as mobile health or mHealth.mHealth consists in using mobile communications-such as PDAs and mobile phones-for health services and information (Vital Wave Consulting, 2009).Recently several mHealth applications are beginning to incorporate RFID and QR-Codes.These technologies can be particularly useful for remote monitoring of health parameters.For instance, Gentag (Gentag, 2011) is developing a line of medical RFID patches that have patented as "smart" skin-patch technology to enable physicians and patients to monitor their health wirelessly.This line of patches include: A glucose-monitoring skin patch, a cardiac-monitoring skin patch, a UVmonitoring skin patch and a biomarker skin test patch.The first market application for the smart skin patch is a patient ID and fever onset bandage that integrates Gentag's proprietary sensor circuit in a disposable skin patch.Applications include using cell phones for monitoring the fever onset in a child, patient monitoring in hospitals, or remotely monitoring the well-being of elderly relatives via cell phones or the Internet (Sharma & Siddiqui, 2010).Another Gentag's health application is related with counterfeit drugs prevention.They have developed an RFID tag that is intended to be placed inside the caps of pharmaceutical bottles allowing consumers to check the authenticity of the product directly with their cell phones prior to purchase or use.
Other practical use of QR-code and RFID/NFC technologies for mHealth applications is patients' identification for retrieving or storing their information on electronic health records (EHR).For example Yu-Chi W. et al. (2009) propose using RFID enabled smartcards to allow patients accessing health data held in different systems, and share this information with their familiars and doctors.This smartcards could be also read using mobile phones allowing further uses of the proposed systems.Other works propose the use of this technology to identify patients in healthcare services implemented in developing countries, where maintaining accurate electronic health records can be a difficult task (Zalzala et al., 2011;Marcus et al., 2009).In the same way QR codes can also be used to retrieve health records or medical information.For instance people with some medical conditions can store medical information that can be quickly accessed in case of an emergency (Beck, 2011) We have also proposed incorporating QR Codes to wellness applications (e.g.calorie and fitness trackers), as AIDC techniques that allow retrieving nutrimental information from food (Vazquez-Briseno, et al., 2010).We have developed a prototype called CalReader using Android platform and Zxing reader.We are also working in incorporating NFC tags to this application.

Entertainment and culture
Recently RFID/NFC and QR codes have been used to enhance visits to museums and art galleries, particularly for guided visits.Tags can be added to objects allowing visitors to retrieve more information about them using their mobile phones.Another interesting application has been proposed by Haberman O. et al. (2010).In this work tags are used to create an intelligent or augmented painting that delivers multimedia content to the audience using an NFC-enabled mobile device.The same artist that created the painting provides additional information about several aspects of it.This information has been stored on multimedia content as audio and video and placed on a server.In the original painting several hidden tags were placed.Visitors could intuitively find these tags and retrieve the content.They revealed that this was a pleasant experience that enhanced their appreciation and comprehension of the painting.
The Tales of Things project (Tales of Things, 2010), developed in collaboration among several universities in the United Kingdom, is a project that links digital content to physical objects using QR codes and mobile devices.This project has been developed with the idea of cataloguing physical objects with QR code and sharing their histories or information on line.
The idea is to gather enough information about today's objects to provide this information to future generations and also to preserve social history.This project has already been implemented at the Scotland: A Changing Nation gallery, where Around 80 objects have been tagged with QR codes (National Museums Scotland, n.d.).People can add their memories or comments about the objects using the Tales of Things Website.The Tales of Things project is also open to people who desires to add new objects and their memories.People can upload an image of any object, they have to provide some information about it, as well as a hyperlink for extra content.The Tales of Things site generates the corresponding QR Code that links the provided content with the object.
QRator (QRator, 2011) is another interesting project powered by the Tales of Things.The project is intended to enhance museum interpretation by allowing members of the public to type in their own comments and interpretation of museum objects.Their interpretation becomes part of the objects history that can be shared with the community using QR-codes.Content currently covers two museums at University College London (UCL); The Grant Museum of Zoology and The Petrie Museum of Egyptology.At the Grant Museum ten iPads are attached to displays, each one holds a current question which visitors can respond to on the iPad itself, via Twitter or the Tales of Things app on their smart phones reading the QR-Code display along with the question.

Commerce
One of the main application areas of QR-Code and RFID/NFC technologies is mobile commerce or m-commerce, which involves any commerce activity such as ticketing, banking or purchasing goods and services, using mobile devices.With these AIDC methods mcommerce applications are being improved with new and effectives ways of reducing mobile inputs from the user.
There are diverse applications of 2D barcodes in m-commerce, according to Gao et al.(2007) these applications can be classified into: Wireless advertising and marketing, wireless trading (pre-sale/sale-and-buy/post-sale), product information tracking and checking, mobile security, mobile customer and product verification and wireless payment.
As mentioned before, Asia is at the moment the region where the fastest development of mobile 2D barcode industry and specifically QR-Code has occurred.In this area, and particularly in Japan and South Korea, QR Code can be found in many places to enable mcommerce activities, for instance: (Soon, 2008):


On buildings for allowing users to retrieve information about the companies that are operating inside the buildings.


On the packaging of fruits or vegetables to retrieve information about the name of the farm from which the fruits and vegetables are grown and harvested; also the fertilizers and insecticide used.


On food packages to download information on cooking recipes.


On maps in the Tokyo subway and central bus stations for location based services, for instance, passengers can find out the arrival time of the next bus.


On bills for ePayment services of tickets for trains and airlines services.


On TV programming guides to view information about programs.
In the same way, RFID/NFC technology is now being widely used in these countries for mcommerce applications.For instance, in Japan and South Korea people can now purchase food at McDonalds through their cell phones and also know when their order is ready (Shuman, 2007) in this restaurants.Customers must download a McDonalds application to their phone.There are RFID readers at the tables and RFID menus that have RFID built in chips.Customers then, with the reader plugged to their phones, can point at the item in the menu that they want to order.In Japan people can also pay through the cell phone number, or through an RFID chip, using the mobile e-wallet system developed by DoCoMo (Selfservice world, 2008), which turns the smart phone into a type of credit card.This mobile payment tendency thru NFC is starting to be used worldwide.Spain realized a precommercial NFC trial showing that this technology can be used successfully in this country.
The trial started by giving 1500 customers a Samsung S530 NFC, to make payments in taxis, markets and retail stores at the city of Sitges in Spain.The project "Mobile Shopping Sitges 2010" (Telefonica, 2010) was promoted by Telefonica Movistar a mobile phone network provider, together with La Caixa bank and Visa.Payments up to 20€ were automatic, but larger transactions required a PIN, introduced at the business terminal to approve purchase.
The participants were trained with information on how to use their phones for the transactions, by Telefonica.The payment platform at that time was only trough La Caixa bank, but is expected to expand the service to other banks.The trial lasted six months and is now completed, but the phones were left in circulation so they can continue to be used.It is planned to extend this service to the city of Barcelona.
In the United States the Google Wallet application has recently been launched.This is an Android app that turns the mobile phone into a wallet using the user's registered credit cards (Google wallet, 2011).In this way, users are able to pay and make savings using their mobile phones and NFC technology.The application is being release with the Nexus S 4G mobile phone on Sprint operator.Merchants affiliated to the Google Wallet program are called SingleTap merchants.In these places users can pay using their mobile phone as well as redeem offers and earn loyalty points.Google is planning in a near future to add other functionalities like storing boarding passes, keys, ID and tickets.The Google Wallet now supports Citi MasterCard and Google Prepaid Card, and can be used in any Mastercard Pay Pass accepted business.Users can also be sync to Google offers, through NFC at SingleTap participating places.Other companies are joining to offer their savings and loyalty programs through Google Wallet.
Besides m-payments, there are also other interesting applications for QR-Code and NFC in commerce services.For instance , Fu, (2011) proposes the use of QR Code in a mall shopping guide service.In this work QR Codes are used to store information about products in a shopping mall, including latitude and longitude location of the product.Once the code is recognized, communication with a server is used to identify the customer's current position, as well as to provide different services like receiving the latest promotions of businesses and finding the best route from his current location to the destination.Chyi-Ren et al. (2011) propose using QR codes in a location-based mobile advertisement publishing system for vendors.This system is able to provide vendors a convenient way for creating and editing advertisements that may include the vendor's location as well as discount coupons stored on a QR code.Advertisement data desired by the consumers can be viewed when a QR code is scanned, thus providing information for the consumer to access.Linli et al.,(2010) implemented a universal mobile ticketing system where QR Codes are used as electronic receipts.This system can be used in several areas where receipts are required, for instance, for booking hotel rooms.The final receipt is generated with the client, instead of the server, in this case, the mobile phone, security is guaranteed by adding digital signatures thru the use of Message-Digest Algorithm (MD5).

Other applications
RFID and QR Code can be applied to a wide range of applications and areas, besides the ones described in the preceding sections.For instance Hsu, et al. (2010) implemented a Human-Building-Computer Interaction (HBCI) system using QR Codes to connect buildings to its occupants.The purpose of this system is to allow users to interact with the objects in a physical environment, namely rooms and appliances in a building, in order to maximize a users' comfort inside a building and minimize total energy usage via remote monitoring and control of devices.QR code tags are used as links to the remote server containing information about rooms or appliances that are considered objects in the HBCI system.Each object has a set of services that the user can monitor via QR codes, for instance: "Room Temperature", "Lighting" and "Energy consumption".When a user wants to retrieve information about and object, for instance a refrigerator, he/she needs to scan de QR code attached to the object to identify it and retrieve the web resources available for that object.
Users could obtain a list of available services for electronic objects including the "Energy" service that could use to observe a graph about the energy usage history.The user could use another service in the same object to remotely turn on or off the HBCI object.Cunha et al. (2010) used QR codes and NFC tags to implement a Viticulture Service-Oriented Framework (VSOF).The tags are used to connect remote parcels to a central server in order to retrieve and send useful information for the vineyard management.By pointing a mobile device to a tag, the viticulturalist may download data such as climatic data or upload information such as disease and pest incidence in a simple way, without having to provide coordinates or any other references, and without having to return to a central office.
Both type of tags are used along with 1D Barcode and GPS to provide multi-tag capabilities to the system in order to be used in environments with different features (e.g.no nfcenabled or GPS-enabled phone available) As it can be seen from the examples presented in this section the use of QR Code and RFID/NFC for mobile services can be applied to many fields.In the near future we will see more applications since these technologies are still being incorporated to new and innovative services.

Conclusion
In this chapter we have explained the use of mobile phones for linking physical objects with the digital world using AIDC techniques.We have described QR Code and RFID/NFC technologies as well as the APIs required for implementing mobile applications with them.Several projects described in this chapter show the usefulness of this type of applications.These projects impact important fields in our lives such as education, health, commerce among others.There is no doubt that with the growing number of NFC and camera-enabled mobile phones available in the market these applications will become essential tools for everyday life.

Fig. 3 .
Fig. 3. Structure of a QR Code The elements contained in a QR code are the following: a. Position Pattern.Three big squares in the corners used for detecting the position, the size and the angle of the QR Code.b.Alignment Pattern.A pattern used for correcting the distortion of the QR Code.These distortions could occur for example when attaching the codes onto a curved surface.c.Timing Pattern.It consists in white and black modules arranged alternately and placed between two position patterns.It is used to determine the central coordinate of each cell in the QR Code.d.Quiet Zone.A margin space that makes easier to detect the QR Code.At least four cells are required for the quiet zone.e.Data Area.The area in the QR Code that contains the data (for example a URL) encoded in binary numbers.The data area also includes Reed-Solomon codes to provide error correction functionalities.
nfc.tech package correspond to the tag technologies implementations; the following are available to provide I/O operations for the corresponding tag: IsoDep, MifareClassic, MifareUltralight, Ndef, NfcA, NfcB, NfcF and NfcV.It is mandatory for all Android NFC devices to provide TagTechnology implementations for the following: NFC-A, NFC-B, NFC-F, NFC-V, IsoDep and NDEF.

Table 1 .
Comparing NFC to other close range communication technologies (Source: NFC Forum) PlainTagConnection interface that defines the basic mechanism to communicate with this type of RFID tags.javax.microedition.contactless.sc.This package enables communication with external smart cards.This is done using the ISO14443Connection interface.javax.microedition.contactless.visual.This package includes the required interfaces and methods to generate visual tags as well as for reading them.Tags can be generated using the interface ImageProperties.It can be observed that this package is built on top of the Generic Connection Framework (GCF).It extends the javax.microedition.io.Connection.This is done because tags connections may also be opened manually and in this case they do not require DiscoveryManager functionality.javax.microedition.contactless is the only mandatory package in the specification, this means that the rest of the packages can be left unimplemented.A reference implementation is required to provide a list of the target types that it supports.This list of targets corresponds to the packages that must be implemented.This class represents an NDEF record; it is delivered in a NdefMessage.Each record has a type that describes the type of data that is being carried in the record, such as text, URL, smart poster or MIME data.
It also provides other classes and interfaces common to all targets.javax.microedition.contactless.ndef.This package contains classes and interfaces needed to communicate with tags that have NDEF formatted data.In order to use this feature the application must register with an NDEF Record Listener to receive notifications about tags or devices.javax.microedition.contactless.rf.This package allows communication with RFID tags that do not have NDEF formatted data.It only contains the3.2.2 Android NFC APIAndroid platform includes the NFC API from version 2.3.In Version 2.3.3 an improved and extended support for this technology was added.From this version it allows mobile interaction with several types of tags, including the following (Android Developers, 2011):An Android device that includes NFC support, like the Nexus S, acts in reader/writer mode when the screen is on.In this mode the device looks for NFCs tags and starts activities to handle them.Android 2.3.3 also includes some limited Peer to Peer support.The NFC API is available in the android.nfcandandroid.nfc.techpackages.The android.nfcpackagecontains the high-level classes that allow interaction with the NFC adapter of the mobile device.It includes functionalities to represent discovered tags, and to use the NDEF data format.This package includes the following classes:NdefRecord: . Open NFC™ is a NFC protocol stack developed by Inside Secure Company, and that is now available in an open source edition under the Apache™ License, Version 2.0.Open NFC acts as middleware for NFC-enabled phones, and the applications written for them.The platform is intended to be used by developers of different mobile platforms and operating systems, allowing them to create applications that will perform well between various types of NFC hardware and software, since it can operate with any NFC-compliant chip.Besides, the applications developed with this platform can also be utilized by any phone manufacturer.