NFC eeprom

Smartphone as payment method

NFC is ISO 14443 compliant and integrates many contactless cards, including bank cards that support MasterCard PayPass or VISA PayWave. The plastic card contains a microprocessor with an OS and a payment application for interacting with the data of a specific client. As soon as the card is inserted into or swiped across the terminal, it receives power to run the operating system. In the case of contactless cards, power, as we have already said, is obtained using the electromagnetic field of the reader.

With the advent of contactless cards, in fact, not necessarily a card can act as a payment instrument, but a smartphone, watch, key fob, and so on – it’s not the form that matters, but the presence of the necessary set of functions. Indeed, in smartphones with NFC support, as well as in plastic cards, there is a microprocessor. From Android 4.

To manage contactless applications remotely, smartphone manufacturers and service providers connect to TSM, a service that provides access to secure data on NFC-enabled terminals. It remotely controls the Secure Element chips in smartphones, while the smartphone itself is a kind of modem operating through a secure communication channel.

When making purchases over 1,000 rubles, you may be asked to enter a PIN code or sign a receipt – everything depends on the bank.

Connection and setup

The RFID/NFC scanner connects via the I²C/TWI protocol and uses the IRQ interrupt pin. To assemble the module, three three-wire loops are used.

When connected to Arduino or Iskra JS, it is convenient to use Troyka Shield.

NFC Tags

This is another common way to use NFC on a smartphone. NFC tags have become very popular in shopping and advertising areas: they are embedded in posters, billboards, placed on goods in stores. Usually these are small stickers, the cost of which does not exceed 50 rubles. The costs are minimal, but what an effect! From getting more details about a concert or merchandise to a link to a trailer for a new movie.

NFC eeprom

You can create your own NFC tags, upgrade them, and then use them in your daily life. As a rule, third-party software like NFC TagWriter is used for this. The application is quite simple and allows you to write many types of data to the tag – from a contact and a phone number to a web browser bookmark.

In fact, NFC tags are a real gift when it comes to automation. For example, you can stick a tag on your laptop and use the Trigger app to set the hotspot to turn on by selecting “Wireless & LAN” as the action. The simpler solution is to write the Wi-Fi password on the tag, stick it on the router, and then whenever guests ask for the password, send them to the NFC tag. Or else: set a mark near the bed and make it so that when touched on the smartphone, airplane mode is turned on (again using Trigger).

It will also be useful for motorists – they wrote down the algorithm for starting the navigator on the label, pasted it on the holder for the smartphone, and every time you install the device in this place, the navigator will start automatically.

And there are still very, very many such examples of the use of NFC tags. Often, the emergence of new cases is not limited by technology at all, but by the user’s imagination.

Work examples

Let’s look at a few examples of how an NFC scanner works.

To use the scanner with Arduino, use the Adafruit PN532 library.
nfc.ino#include {amp}lt;Wire.h{amp}gt;#include {amp}lt;SPI.h{amp}gt;// RFID/NFC library#include {amp}lt;Adafruit_PN532 .h{amp}gt;

// interrupt pin#define PN532_IRQ 9 // create an object to work with the scanner and pass two parameters to it // the first is the interrupt pin number // the second is the number 100 // from Adafruit there was a software reset of the shield // in the RFID/NFC 13 scanner .56 MHz (Troyka-module) this pin is not used // therefore, we transfer a number greater than any Arduino pin
Adafruit_PN532nfc(PN532_IRQ,100);

void setup(void){
Serial.begin(9600);//initialize RFID/NFC scanner
nfc.begin();int versiondata = nfc.getFirmwareVersion();if(!versiondata){
Serial.print(“Didn’t find RFID/NFC reader”);while(1){}}

Serial.println(“Found RFID/NFC reader”);// configure the module
nfc. SAMConfig();
Serial.println(“Waiting for a card.”);}

void loop(void){uint8_t success;// buffer for storing card ID uint8_t uid[8];// card buffer size uint8_t uidLength;// listen for new labels
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid,{amp}amp;uidLength);// if the card is found if(success){// output the received data to the console
Serial.println(“Found a card”);
Serial.print(“ID Length: “);
Serial.print(uidLength, DEC);
Serial.println(“bytes”);
Serial.print(“ID Value: “);
nfc. PrintHex(uid, uidLength);
Serial.println(“”);
delay(1000);}}
Open the Serial port and apply cards one by one to the reader. The ID Value line displays a unique card number.

Read and output the card ID to the Serial port. To use the RFID/NFC scanner with Iskra JS, use the @amperka/nfc library. It provides simple operation with the module and hides all the subtleties of the data exchange protocol between the scanner and the control board.

nfc-test.js
 // configure I2C1 for the module to work 
 I2C1.  setup  (  {  sda  :   SDA  ,   scl  :   SCL  ,   bitrate  :  400000  }  )  ; 

 // connect the module to I2C1 and interrupt pin  var   nfc   =   require  (  '@amperka/nfc'  ) . connect  (  {  i2c  :   I2C1  ,   irqPin  :   P9  }  )  ; 

 // activate the module 
 nfc.  wakeUp  (  function  (  error  )  {  if  (  error  )  { 
     print  (  'NFC wake up error'  ,   error  )  ;  }  else  { 
     print  (  'NFC wake up OK'  )  ;  // listen for new labels 
     nfc.  listen  (  )  ;  }  }  )  ; 

nfc.  on  (  'tag'  ,  function  (  error  ,   data  )  {  if  (  error  )  { 
     print  (  'tag read error'  )  ;  }  else  {  // print the received data to the console 
     print  (  data  )  ;  } 

   // listen for a new label every second 
   setTimeout  (  function  (  )  { 
     nfc.  listen  (  )  ;  }  ,  1000  )  ;  }  )  ; 

After downloading the code, we will attach the cards to the scanner one by one. The unique card number is displayed in the uid line

Opening all doors

Someone implements this at home, but mostly the use of NFC for user identification and control is typical for enterprises and organizations. Turnstiles and locks are configured in such a way that with the help of a label, which is a pass, they decide whether to give its owner permission to enter or not.

With NFC, all doors really open in a smartphone — if not literally, then figuratively for sure. In fact, the user receives a universal tool that, despite the speed limits, finds its application in a variety of situations. Here we are faced with another problem – the degree of prevalence of technology among service providers. The only thing that an ordinary user can do in this case is to use NFC as often as possible to show its relevance.

NFC remote

Let’s try to control three LEDs using an RFID / NFC scanner, each LED will have its own card. When a known card is presented, the LED will switch. For the convenience of monitoring the work, we will send the name of the read card to the Serial port.

Connection diagram

NFC eeprom

Let’s add three Piranha LEDs to the previously assembled circuit.

Instead of conclusion

Perhaps the best part about NFC is that the technology is available to a wide range of users. More and more manufacturers do not leave their smartphones without NFC, so it is available in devices like

(for $321.99 with code Mi5SGBS until 31.12) and

, and in flagships like

. The diversity is also pleasing

NFC eeprom

What about Apple and its iPhone 7, you ask? Alas, the manufacturer limits the operation of the NFC chip in its smartphone, and it can only be used for the Apple Pay payment system. In the fall, however, it launched in Russia, so at least some plus.

How do you use NFC in your daily life? Share your experience with us in the comments.

RFID/NFC technology

RFID and NFC are two closely related wireless communication technologies that are used around the world for access control, cargo tracking, security systems and contactless payments. N FC is an extension of RFID technology.

Leave a Reply

Your email address will not be published. Required fields are marked *