How to use an Arduino NFC Reader
This document provides some useful information about how you can use an Arduino NFC reader. This type of reader can be used in many of your Arduino projects, so it is worth to read that guide. The guide itself contains the basics of NFC technology, demonstrates how an NFC reader connects to the Arduino and lastly, a step by step guide shows how to use the NFC reader with Ozeki 10. So, let's get started.
What is NFC?
Near field communication (NFC) are protocols that electronic devices use to communicate and transfer data between each other. Near field communication devices have to be very near to each other, usually between 10cm, but the range can vary depending on the device that is transmitting and the size of the tag. NFC tags require no power input whatsoever. They use magnetic induction between two small loop antennas. The tags these days carry between 96 and 4,096 bytes of information.
How does NFC work?
Just like Bluetooth and Wi-Fi, and all manner of other wireless signals, NFC works on the principle of sending information over radio waves. he technology used in NFC is based on older RFID (Radio-frequency identification) ideas, which used electromagnetic induction in order to transmit information. The former can be used to induce electric currents within passive components as well as just send data. This means that passive devices don’t require their own power supply. They can instead be powered by the electromagnetic field produced by an active NFC component when it comes into range.
To determine what sort of information will be exchanged between devices, the NFC standard currently has three distinct modes of operation. Perhaps the most common use in smartphones is the peer-to-peer mode. This allows two NFC-enabled devices to exchange various pieces of information between each other. In this mode, both devices switch between active when sending data and passive when receiving.
Read/write mode, on the other hand, is one-way data transmission. The active device, possibly your smartphone, links up with another device in order to read information from it. NFC advert tags use this mode.
The final mode of operation is card emulation. The NFC device can function as a smart or contactless credit card and make payments or tap into public transport systems.
Arduino NFC Reader wiring diagram
How to use an Arduino NFC Reader in Ozeki
NFC Reader connection forwards all data read from a keycard's memory to your selected Ozeki software connection. RC522 and PN532 NFC readers are supported as NFC reader connections. You can test if your RFID keycards work by using the test GUI as you can see in the 3rd video, below. To use the NFC Reader in Ozeki, you first need to download Ozeki Robot Developer. Ozeki Robot Developer will install the Arduino libraries needed to use this sensor efficiently.
Download Ozeki Robot Developer
After Ozeki Robot developer is installed, you need to upload the NFC Reader control code to your Arduino. You can find the code and download instructions on the following pages. The upload process includes two steps: first you need to format the EEPROM of the arduino, then you need to upload the control code. The procedure is very simple, it only takes a few seconds.
Upload the NFC Reader code to Arduino Uno
Upload the NFC Reader code to Arduino Mega 2560
Upload the NFC Reader code to Arduino Nano
Upload the NFC Reader code to Ozeki Matrix
Upload the NFC Reader code to Raspberry Pi
The arduino sensors and Ozeki will communicate over the USB port using the Ozeki NFC Reader protocol. This protocol makes it possible for you to use the sensor directly on your PC. You will be able to control this sensor through the web based user interface or you will be able to communicate with it using Ozeki Chat. You can read more about chat control on the following page.
How to communicate with the NFC Reader using chat
It is important to understand chat control, because when you build a robot, the way you wish to control this sensor is by sending and receiving messages. If you open the Ozeki Robot Developer app, you will see, who you can write a C#.Net program to work with this sensor.
Connection steps
- Connect the NFC reader to the Arduino using the wiring diagram
- Plug the Arduino board into your computer
- Check the COM ports to make sure your Arduino is connected
- Open the Arduino application on the PC
- Upload example code to the Arduino
- Open Ozeki 10 GUI in your browser
- Select the connection of the NFC reader
- Test the NFC reader
System overview
The system we suggest consists of an NFC reader, that is wired to the analog port of your Arduino. The Arduino will be responsible for reading data from this device in real-time. The brain of the system will be running on a PC (Figure 2). On the PC, Ozeki 10 will be able to manage the communication. You can easily run Ozeki 10 using a webbrowser
Prerequisites
- A RC522 or PN532 NFC reader
- Ozeki 10 installed on your computer
- Programmable board (Arduino Mega/Nano/Uno, Ozeki NFC Host or Raspberry Pi)
- USB cable is needed between Arduino Mega/Nano/Uno, Ozeki NFC Host and your computer
Step 1 - Wire the RC522 NFC reader to your Arduino
You can see how to wire the RC522 NFC reader to any of the following boards:
- Arduino Uno
- Ozeki NFC Host
- Raspberry Pi
(If you use Raspberry Pi please jump to 'Step 3')
After wiring, please plug the board to your computer!
Step 2 - Upload code to the microcontroller
Step 3 - Start Ozeki 10 to try the NFC reader
Step 4 - Wire the PN532 NFC reader to your Arduino
You can see how to wire the PN532 NFC reader to any of the following boards:
- Arduino Uno
- Ozeki NFC Host
- Raspberry Pi
(If you use Raspberry Pi please jump to 'Step 3')
After wiring, please plug the board to your computer!
Step 5 - Upload code to the microcontroller
Step 6 - Start Ozeki 10 to try the NFC reader
Step 7 - Configure your NFC reader in Ozeki 10
In order to configure your NFC reader (attached to your Arduino) in Ozeki 10, that is installed on your computer, you need to open the graphical user interface (GUI) of Ozeki 10. You can open the GUI by entering the URL of the computer into your webbrowser. For example, if our PC has an IP address of 192.168.1.5, we would enter http://192.168.1.5:9513 into our webbrowser.
Step 8 - Understand the NFC reader protocol
The NFC Reader can communicate with Ozeki through the following protocol.
References:
https://www.androidauthority.com
More information
- Arduino sensors and actuators
- How to use an analog sensor in arduino
- How to use a button controller in arduino
- How to use a buzzer in arduino
- How to use dc motors in arduino
- How to use a dht sensor in arduino
- How to use an EEPROM Manager in arduino
- How to use a gyroscope sensor in arduino
- How to use id manager in arduino
- How to use IR transceiver in arduino
- How to use an analog joystick in arduino
- How to use a keyboard in arduino
- How to use an LCD display in arduino
- How to use an NFC Reader in arduino
- How to use an optical gate in arduino
- How to use a register in arduino
- How to use an RF 433 MHz transceiver
- How to use an RF 2.4 GHz transceiver
- How to use an RGB LED in arduino
- How to use an RGB sensor in arduino
- How to use a rotary encoder in arduino
- How to use a servo motor in arduino
- How to use a stepper motor in arduino
- How to use a switch in arduino
- How to use a temperature sensor in arduino
- How to use a timer in arduino
- How to use an ultrasonic sensor in arduino