รหัสสินค้า | SG00482 |
หมวดหมู่ | NFC/RFID/MagneticCard |
ราคา | 1,850.00 บาท |
สถานะสินค้า | พร้อมส่ง |
จำนวน | ชิ้น |
Near Field Communication (NFC), also known as short-range wireless communication, is a short-range high-frequency wireless communication technology that allows non-contact point-to-point data transmission (within ten centimeters) to exchange data between electronic devices. . This technology evolved from contactless radio frequency identification (RFID) and is backward compatible with RFID. It was first developed by Sony and Philips, and is mainly used to provide M2M (Machine to Machine) communication in handheld devices such as mobile phones. Because of the natural security of near field communication, NFC technology is widely used in POS mobile payment, bus cards, bank cards, access cards, water cards and other occasions.
Connection Diagram
Gravity: UART & I2C NFC Module I2C connection diagram (Arduino UNO)
Gravity: UART & I2C NFC Module UART connection diagram (USB to UART+PC)
Gravity: UART & I2C NFC Module UART connection diagram (MEGA2560)
No. | Label | Description |
---|---|---|
1 | D/T | I2C data SDA or UART transmission TXD |
2 | C/R | I2C clock SCL or UART receive RXD |
3 | GND | Power negative |
4 | VCC | Power positive (3.3V ~ 5.5V) |
5 | / | I2C/UART selector |
6 | IRQ | Interruption output |
7 | ON | Power indicator (red) |
8 | / | NFC antenna |
Read/write S50 NFC Card
#include <DFRobot_PN532.h>
#define BLOCK_SIZE 16
#define PN532_IRQ 2
#define INTERRUPT 1
#define POLLING 0
// The block to be read
#define READ_BLOCK_NO 2
DFRobot_PN532_IIC nfc(PN532_IRQ, POLLING);
uint8_t dataRead[16] = {0};
void setup() {
Serial.begin(115200);
Serial.print("Initializing");
while (!nfc.begin()) {
Serial.print(".");
delay (1000);
}
Serial.println();
Serial.println("Waiting for a card......");
}
void loop() {
// For S50 card/tag, block 1-2, 4-6, 8-10, 12-14... 56-58, 60-62 are for user data
// You can read/write these blocks freely.
// Use "MifareClassic_ReadAllMemory.ino" to check all the blocks
if (nfc.scan()) {
if (nfc.readData(dataRead, READ_BLOCK_NO) != 1) {
Serial.print("Block ");
Serial.print(READ_BLOCK_NO);
Serial.println(" read failure!");
}
else {
Serial.print("Block ");
Serial.print(READ_BLOCK_NO);
Serial.println(" read success!");
Serial.print("Data read(string):");
Serial.println((char *)dataRead);
Serial.print("Data read(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
Serial.print(dataRead[i], HEX);
Serial.print(" ");
dataRead[i] = 0;
}
Serial.println();
}
delay(500);
}
}
#include <DFRobot_PN532.h>
#define BLOCK_SIZE 16
#define PN532_IRQ 2
#define INTERRUPT 1
#define POLLING 0
// The block to be written
#define WRITE_BLOCK_NO 2
DFRobot_PN532_IIC nfc(PN532_IRQ, POLLING);
uint8_t dataWrite[BLOCK_SIZE] = {"Hello World !"};
void setup() {
Serial.begin(115200);
Serial.print("Initializing");
while (!nfc.begin()) {
Serial.print(".");
delay (1000);
}
Serial.println();
Serial.println("Waiting for a card......");
}
void loop() {
// For S50 card/tag, block 1-2, 4-6, 8-10, 12-14... 56-58, 60-62 are for user data
// You can read/write these blocks freely.
// Use "MifareClassic_ReadAllMemory.ino" to check all the blocks
if (nfc.scan()) {
if (nfc.writeData(WRITE_BLOCK_NO, dataWrite) != 1) {
Serial.print("Block ");
Serial.print(WRITE_BLOCK_NO);
Serial.println(" write failure!");
}
else {
Serial.print("Block ");
Serial.print(WRITE_BLOCK_NO);
Serial.println(" write success!");
Serial.print("Data written(string):");
Serial.println((char *)dataWrite);
Serial.print("Data written(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
Serial.print(dataWrite[i], HEX);
Serial.print(" ");
}
}
}
delay(500);
}
This tutorial presents a basic usage of the module with Arduino UNO.
Attention
- Every time switching the interfaces, you need to reset the controller to communicate normally.
- Because UNO only has one serial port for communication with the PC, the maximum speed of its soft serial port is only 38400, which can't reach 115200 of the serial port of the NFC module. Please use the I2C interface instead.
- The chip may become hot during working. DO NOT touch or cover it.
/*!
@flie NFC_cardinfo.ino
@Copyright [DFRobot](https://www.dfrobot.com), 2016
@Copyright GNU Lesser General Public License
@version V1.0
@date 07/03/2019
@brief This demo runs on the arduino platform.
Download this demo to read the basic information of the card,
including UID, manufacturer, storage space, RF technology etc.
Suported NFC card/tag:
1.MIFARE Classic S50/S70
2.NTAG213/215/216
3.MIFARE Ultralight
This demo and related libraries are for DFRobot Gravity: I2C&UART NFC Module
Product(CH): https://www.dfrobot.com.cn/goods-2029.html
Product(EN): https://www.dfrobot.com/product-1905.html
*/
#include <DFRobot_PN532.h>
#define BLOCK_SIZE 16
#define PN532_IRQ (2)
#define INTERRUPT (1)
#define POLLING (0)
// Use this line for a breakout or shield with an I2C connection
// Check the card by polling
DFRobot_PN532_IIC nfc(PN532_IRQ, POLLING);
struct card NFCcard;
void setup() {
Serial.begin(115200);
//Initialize the NFC module
while (!nfc.begin()) {
Serial.println("initial failure");
delay (1000);
}
Serial.println("Please place the NFC card/tag on module..... ");
}
void loop() {
//Scan, write and read NFC card every 2s
//Print all what is to be written and read
if (nfc.scan()) {
//Read the basic information of the card
NFCcard = nfc.getInformation();
Serial.println("----------------NFC card/tag information-------------------");
Serial.print("UID Lenght: "); Serial.println(NFCcard.uidlenght);
Serial.print("UID: ");
for (int i = 0; i < NFCcard.uidlenght; i++) {
Serial.print(NFCcard.uid[i], HEX);
Serial.print(" ");
}
Serial.println("");
Serial.print("AQTA: "); Serial.print("0x"); Serial.print("0"); Serial.print(NFCcard.AQTA[0], HEX); Serial.print(""); Serial.println(NFCcard.AQTA[1], HEX);
Serial.print("SAK: "); Serial.print("0x"); Serial.println(NFCcard.SAK, HEX);
Serial.print("Type: "); Serial.println(NFCcard.cardType);
Serial.print("Manufacturer:"); Serial.println(NFCcard.Manufacturer);
Serial.print("RF Technology:"); Serial.println(NFCcard.RFTechnology);
Serial.print("Memory Size:"); Serial.print(NFCcard.size); Serial.print(" bytes(total)/"); Serial.print(NFCcard.usersize); Serial.println(" bytes(available)");
Serial.print("Block/Page Size:"); Serial.print(NFCcard.blockSize); Serial.println(" bytes");
//Serial.print("Sector Size:"); Serial.print(NFCcard.sectorSize); Serial.println(" bytes");
Serial.print("Number of Blocks/pages:"); Serial.println(NFCcard.blockNumber);
}
else {
//Serial.println("no card!");
}
delay(2000);
}
/*!
@flie MifareClassic_ReadWrite.ino
@Copyright [DFRobot](https://www.dfrobot.com), 2016
@Copyright GNU Lesser General Public License
@version V1.0
@date 07/03/2019
@brief This demo runs on the arduino platform.
Download this demo to learn how to wirte data to card.
We can read the data on the card to see if the write is successful.
This demo and related libraries are for DFRobot Gravity: I2C NFC Module
Product(CH): https://www.dfrobot.com.cn/goods-2029.html
Product(EN): https://www.dfrobot.com/product-1905.html
*/
#include <DFRobot_PN532.h>
#define BLOCK_SIZE 16
#define PN532_IRQ (2)
#define INTERRUPT (1)
#define POLLING (0)
//use this line for a breakout or shield with an I2C connection
//check the card by polling
DFRobot_PN532_IIC nfc(PN532_IRQ, POLLING);
uint8_t dataWrite[BLOCK_SIZE] = {"DFRobot NFC"};
uint8_t dataRead[16] = {0};
struct card NFCcard;
void setup() {
Serial.begin(115200);
while (!nfc.begin()) {
Serial.println("initial failure");
delay (1000);
}
Serial.println("Waiting for a card......");
}
void loop() {
//Scan, write and read NFC card every 2s
//Print all what is to be written and read
if (nfc.scan()) {
NFCcard = nfc.getInformation();
if ((NFCcard.AQTA[1] == 0x02 || NFCcard.AQTA[1] == 0x04)) {
Serial.print("Data to be written(string):");
Serial.println((char *)dataWrite);
Serial.print("Data to be written(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
Serial.print(dataWrite[i], HEX);
Serial.print(" ");
}
Serial.println();
//Write data(16 bytes) to sector 1
if (nfc.writeData(2, dataWrite) != 1) {
Serial.println("write failure!");
}
//Read sector 1 to verify the write results
nfc.readData(dataRead, 2);
Serial.print("Data read(string):");
Serial.println((char *)dataRead);
Serial.print("Data read(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
Serial.print(dataRead[i], HEX);
Serial.print(" ");
dataRead[i] = 0;
}
Serial.println();
}
else {
Serial.println("The card type is not mifareclassic...");
}
}
else {
//Serial.println("no card");
}
delay(2000);
}
/*!
@flie read_S50_INTERRUPT.ino
@Copyright [DFRobot](https://www.dfrobot.com), 2016
@Copyright GNU Lesser General Public License
@version V1.0
@date 07/03/2019
@brief This demo runs on the arduino uno platform
Download this demo to learn how to read data on card and read data by interrupt.
We can read the data on the card to see if the write is successful
This demo and related libraries are for DFRobot Gravity: I2C&UART NFC Module
Product(CH): https://www.dfrobot.com.cn/goods-2029.html
Product(EN): https://www.dfrobot.com/product-1905.html
*/
#include <DFRobot_PN532.h>
#define BLOCK_SIZE 16
#define PN532_IRQ (2)
#define INTERRUPT (1)
#define POLLING (0)
//use this line for a breakout or shield with an I2C connection
//check the card by interruption
DFRobot_PN532_IIC nfc(PN532_IRQ, INTERRUPT);
uint8_t dataWrite[BLOCK_SIZE] = {"DFRobot NFC"};
uint8_t dataRead[16] = {0};
struct card NFCcard ;
void setup() {
Serial.begin(115200);
while (!nfc.begin()) {
Serial.println("initial failure");
delay (1000);
}
Serial.println("Waiting for a card......");
}
void loop() {
//Print all what is to be written and read
if (nfc.scan() == true) {
NFCcard = nfc.getInformation();
if (NFCcard.AQTA[1] == 0x02 || NFCcard.AQTA[1] == 0x04) {
Serial.print("Data to be written(string):");
Serial.println((char *)dataWrite);
Serial.print("Data to be written(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
Serial.print(dataWrite[i], HEX);
Serial.print(" ");
}
Serial.println();
//Write data(16 bytes) to sector 1
if (nfc.writeData(2, dataWrite) != 1) {
Serial.println("write failure!");
}
//Read sector 1 to verify the write results
nfc.readData(dataRead, 2);
Serial.print("Data read(string):");
Serial.println((char *)dataRead);
Serial.print("Data read(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
//data[i] = dataRead[i];
Serial.print(dataRead[i], HEX);
Serial.print(" ");
dataRead[i] = 0;
}
}
else {
Serial.println("The card type is not mifareclassic...");
}
}
else {
//Serial.println("no card");
}
delay(1000);
}
/*!
@flie read_S50_uart.ino
@Copyright [DFRobot](https://www.dfrobot.com), 2016
@Copyright GNU Lesser General Public License
@version V1.0
@date 07/03/2019
@brief This demo runs on the Arduino MEGA2560 platform.
Download this demo to learn how to read data on card and read data through serial ports.
Read the data on the card to see if the write is successful.
This demo and related libraries are for DFRobot Gravity: I2C&UART NFC Module
Product(CH): https://www.dfrobot.com.cn/goods-2029.html
Product(EN): https://www.dfrobot.com/product-1905.html
*/
#include <DFRobot_PN532.h>
#define BLOCK_SIZE 16
//Initialize MEGA2560
DFRobot_PN532_UART nfc;
struct card NFCcard ;
void setup() {
Serial.begin(115200);
while (!nfc.begin(&Serial3)) {
Serial.println("initial failure");
delay (1000);
}
Serial.println("Waiting for a card......");
}
uint8_t dataWrite[BLOCK_SIZE] = {"DFRobot NFC"}; /*Write data page */
uint8_t dataRead[16] = {0};
void loop() {
//Scan, write and read NFC card every 2s
//Print all what is to be written and read
if (nfc.scan() == true) {
NFCcard = nfc.getInformation();
if (NFCcard.AQTA[1] == 0x02 || NFCcard.AQTA[1] == 0x04) {
Serial.print("Data to be written(string):");
Serial.println((char *)dataWrite);
Serial.print("Data to be written(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
Serial.print(dataWrite[i], HEX);
Serial.print(" ");
}
Serial.println();
//Write data(16 bytes) to sector 1
if (nfc.writeData(2, dataWrite) != 1) {
Serial.println("write failure!");
}
//Read sector 1 to verify the write results
nfc.readData(dataRead, 2);
Serial.print("Data read(string):");
Serial.println((char *)dataRead);
Serial.print("Data read(HEX):");
for (int i = 0; i < BLOCK_SIZE; i++) {
//data[i] = dataRead[i];
Serial.print(dataRead[i], HEX);
Serial.print(" ");
}
}
else {
Serial.println("The card type is not mifareclassic...");
}
}
else {
//Serial.println("no card");
}
delay(2000);
}
ชำระเงินค่าสินค้าโดยการโอนเงินเข้าบัญชีธนาคาร KBANK, SCB, BBL,TMB
กรุณาเก็บหลักฐานการโอนเงินของท่านไว้เพื่อแจ้งการชำระเงินด้วยค่ะ
ท่านสามารถแจ้งการชำระเงินผ่านระบบอัตโนมัติได้โดย Click Link ข้างล่างค่ะ
https://www.arduitronics.com/informpayment
หน้าที่เข้าชม | 15,375,394 ครั้ง |
ผู้ชมทั้งหมด | 5,878,472 ครั้ง |
เปิดร้าน | 21 พ.ค. 2556 |
ร้านค้าอัพเดท | 6 ก.ย. 2568 |