Open NFCSense Library

Related tags

JSON OpenNFCSense
Overview

OpenNFCSense API

Open-source API of NFCSense for the Processing programming environment (http://processing.org/). Please refer to the following workflow to start experiencing the NFCSense!

by Dr. Rong-Hao Liang (Last update: May 26, 2021)

Now it's V2: Basic Tutorial and Examples are available!

NFCSense Cheatsheet

NFCSense Project website:

Check the Open Access Paper at ACM Digital Library:

NFCSense Video Tutorials

IMAGE ALT TEXT HERE

All the examples shown in the videos are in the /examples folder

Prerequisite (for V2)

  • 1x Arduino Uno board
  • 1x RC522 NFC reader
  • A few NFC tags (e.g., Mifare 1k, NTAG213, NTAG215)
  • A computer installed Processing and Arduino IDEs

Download (/download)

The OpenNFCSense API V2 of the Processing Library (OpenNFCSense4P-2.zip) in zip format.

Install the processing library - OpenNFCSense API

  • Video: Episode 0: Setting Up the OpenNFCSense API
  • Unzip and put the extracted OpenNFCSense folder into the libraries folder of your Processing sketches. Reference and examples are included in the OpenNFCSense folder. Then, Restart your Processing software. New examples can be found in the processing library.

Preparation: Upload the Arduino code (/arduino) and Connect the Reader

  • Video: Episode 0: Setting Up the OpenNFCSense API
  • Upload the arduino code to your Arduino board first! This software works with a microcontroller connected to an RC522 NFC/RFID Reader and run the Arduino code: NFCSense4P_ArduinoUno_RC522_v1.ino.
  • Connect the RC522 NFC reader to the Arduino board as follows (via the Arduino's SPI) Hardware Configuration

Use the OpenNFCSense API by Examples

e1_SingleTagRotation

  • Video: Episode 1: Making Toys with Things That Rotate
  • Video: Episode 2: Making Educational Toys with Lego Bricks
  • Open the example e1_SingleTagRotation.pde
  • Attach an NFC tag to anything that spins, such as a fidget spinner.
  • Run the processing sketch, scan the tag, and keep the tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of "Black spinner" with yours, save the CSV file.
  • Run the processing sketch again, spin the your spinner, and then you will see the object info and the rotation frequecy shown on the screen as "Recent tag: [Label] is spinning at ? Hz".
  • In the data/tagProfile.csv, You may replace the "Black spinner" label to any name (avoid using comma). You can make another row with the same format to be able to recognize multiple spinners!

e2_SingleTagSwinging

  • Open the example e2_SingleTagSwinging.pde
  • Attach an NFC tag to anything that swings, such as a finger.
  • Run the processing sketch, scan the tag, and keep the tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of "Swing" with yours, save the CSV file.
  • Run the processing sketch again, spin the your spinner, and then you will see the object info and the rotation frequecy shown on the screen as "Recent tag: [Label] is swining at ? Hz".
  • In the data/tagProfile.csv, You may replace the "Swing" label to any name (avoid using comma). You can make another row with the same format to be able to recognize swinging objects!

e3_TagSequence

  • Open the example e3_TagSequence.pde
  • Attach an NFC tag to the bottom of any objects, such as a duplo block that has a letter printed on its surface. Maintain z=8-25mm (for Mifare 1k or NTAG 213/215 tags) distance between the tag and the reader with an optional linear track for reliable tracking.
  • Run the processing sketch, scan the tag, and keep the tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Then, close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID with yours, save the CSV file.
  • Run the processing sketch again, scan your object, and then you will see object shown in list of a recent tag.
  • In the data/tagProfile.csv, You may replace the "A" label to any name (avoid using comma). Likewise, you add the 2nd, 3rd, and more object's UIDs and label to the CSV profile. Save the profile and run the processing sketch again, and your reader should be able to read all of them.
  • The list of "recent tag" will be cleared up when the reader does not read a new tag for 1000 ms (1 s) by default. You may change it to 2 seconds by setting up a parameter to the constructor as nfcs = new OpenNFCSense4P(this, "demo.csv", 300, 300, 2000) to set the TTL timer2 to 2000.

e4_CompoundRotation

  • Open the example e4_TagSequence.pde
  • Attach 3 NFC tags to anything that spins, such as a fidget spinner. Don't let the tags overlap.
  • Run the processing sketch, scan one of the tag, and keep the first tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Then, rotate the object counterclockwisely and get the second tag's 4-byte UID. Then rotate the object counterclockwisely and get the third tag's 4-byte UID. close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of the three "white spinner" tags with yours. The first tag goes first, and then the second and the third. Save the CSV file after it's done.
  • Run the processing sketch again, spin the object, and then you will see the object's info, the rotation direction and frequecy shown on the screen as "Recent tag: [Label] is spinning \n (counter)clockwise at ? Hz". In recent tags you also see the sequence of the tag presence.
  • In the data/tagProfile.csv, You may replace the "White spinner" label to any name (avoid using comma). Likewise, you add more object's UIDs and label to the CSV profile. Save the profile and run the processing sketch again, and your reader should be able to read all of them.

e5_CompoundLinear

  • Open the example e5_CompoundLinear.pde
  • Attach 2 NFC tags to anything that moves linearly, such as a trolley. Don't let the tags overlap. Maintain z=8-25mm (for Mifare 1k or NTAG 213/215 tags) distance between the tag and the reader with a linear track for reliable tracking.
  • Run the processing sketch, scan one of the tag, and keep the first tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Then, scan the second tag and get its 4-byte UID. Close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of the two "trolley" tags with yours. The first tag goes first, and then the second. Replace the number 34.0 of the both tag with the actual distance between the center of the two tags (e.g., set 38.0 when the distance is 38mm). Save the CSV file after it's done.
  • Run the processing sketch again, move the object linearly, and then you will see the object's info, the movement direction and speed shown on the screen as "Recent tag: [Label] is moving \n forward/backward at ? km/h". In recent tags you also see the sequence of the tag presence.
  • In the data/tagProfile.csv, You may replace the "Trollety" label to any name (avoid using comma). Likewise, you add more object's UIDs and label to the CSV profile. Save the profile and run the processing sketch again, and your reader should be able to read all of them.

e6_SingleTagHovering

  • Open the example e6_SingleTagHovering.pde
  • Attach 1 NFC tags to the top of anything that moves linearly, such as a boat. Maintain z = 7-25 mm (for Mifare 1k or NTAG 213/215 tags) distance between the tag and the reader with a linear track for reliable tracking.
  • Run the processing sketch, scan the tag, and keep the tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of the "boat" tags with yours. Save the CSV file after it's done.
  • Run the processing sketch again, move the object linearly, and then you will see the object's info, the movement direction and speed shown on the screen as "Recent tag: [Label] is sliding at ? km/h". Note: This speed is not correct yet. We measure the tag activation path length using a ruler. By checking the moving bar on the screen, we can get the reader of the path activation length as X mm.
  • In the data/tagProfile.csv, replace the L1 from 43.0 to the X that you measured (e.g., 39.0 when X = 39mm). You may replace the "Boat" label to any name (avoid using comma). Save the profile and run the processing sketch again, and your reader will be able to read the correct speed of the tag movement.
  • Likewise, you can add more object's UIDs, label, and L1 to the CSV profile.

e7_SingleTagSlidingHovering

  • Open the example e7_SingleTagSlidingHovering.pde
  • Attach 1 NFC tags to the bottom of anything that moves linearly, such as a figurine. Maintain less than 6mm distance (for Mifare 1k or NTAG 213/215 tags) between the tag and the reader with a linear track.
  • Run the processing sketch, scan the tag, and keep the tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of the "figurine" tags with yours. Save the CSV file after it's done.
  • Run the processing sketch again, move the object linearly, and then you will see the object's info, the movement direction and speed shown on the screen as "Recent tag: [Label] is sliding at ? km/h". Note: This speed is not correct yet. We need to measure the tag activation path lengths with a ruler.
  • Two tag activation path lengths have to be measured: 1) L1 for Sliding, and 2) L2 for Hovering. For L1 (sliding), since there will be 3 segments of activation that are observable, check the longest one on the screen so that you can get the L1 = X mm. For L2 (hovering), put a spacer below the tag to make the z>6mm. There will be only one segment of activation that is observable so that you can get L2 = Y mm.
  • In the data/tagProfile.csv, replace the L1 from 39.0 to the X that you measured and the L2 from 43.0 to the Y that you measured. You may replace the "Figurine" label to any name (avoid using comma). Save the profile and run the processing sketch again, and your reader will be able to read the correct speed of the tag movement in the both modes. The hovering speed can be less accurate if the object is above z=25mm.
  • Likewise, you can add more object's UIDs, label, L1 and L2 to the CSV profile.

e8_SingleTiltedTagSliding

  • Open the example e8_SingleTiltedTagSliding.pde
  • Attach 1 tilted (between 60-75 degree) NFC tags to the bottom of anything that moves linearly, such as a car. Maintain less than 22mm distance (for Mifare 1k or NTAG 213/215 tags) between the tag's center and the reader with a linear track.
  • Run the processing sketch, scan the tag, and keep the tag's 4-byte Universal ID (UID0,UID1,UID2,UID3) shown in the console. Close the processing sketch.
  • Open the data/tagProfile.csv in the examples' folder, replace the UID of the "Car" tags with yours. Save the CSV file after it's done.
  • Run the processing sketch again, move the object linearly, and then you will see the object's info, the movement direction and speed shown on the screen as "Recent tag: [Label] is sliding forward/backward at ? km/h". Note: This speed is not correct yet. We need to measure the tag activation path lengths with a ruler.
  • Since there will be 2 segments of activation that are observable, check the longest one on the screen so that you can get the L1 = X mm.
  • In the data/tagProfile.csv, replace the L1 from 31.0 to the X that you measured. You may replace the "Car" label to any name (avoid using comma). Save the profile and run the processing sketch again, and your reader will be able to read the correct speed of the tag movement in both directions.
  • Likewise, you can add more object's UIDs, label, L1 to the CSV profile.

e9_Demo

  • Open the example e9_Demo.pde
  • Copy the lines that you just created from the tagProfile.csv files in the previous examples to the demo.csv.
  • Run the processing sketch, then every object's movement mode and it's correct speed can be detected.

e0_App_Boilerplate

  • Open the example e0_App_Boilerplate.pde
  • Copy the lines that you just created from the tagProfile.csv or demo.csv files in the previous examples to the demo.csv.
  • Now you can use this processing sketch as a boilerplate to create your own applications.

Cheatsheet (/docs)

The 1-page Summary of how the proposed algorithm works.

Documentation

The full documentation will be available soon!

Source (/src)

The source code of the OpenNFCSense library (GNU GPLv3 copyleft license)

Cite this Work:

If you use this library, please cite the original NFCSense paper as following

  • ACM format:
Rong-Hao Liang and Zengrong Guo. 2021. NFCSense: Data-Defined Rich-ID Motion Sensing for Fluent Tangible Interaction Using a Commodity NFC Reader. In <i>Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems</i> (<i>CHI '21</i>). Association for Computing Machinery, New York, NY, USA, Article 505, 1–14. DOI:https://doi.org/10.1145/3411764.3445214
  • bibtex format:
@inproceedings{10.1145/3411764.3445214,
author = {Liang, Rong-Hao and Guo, Zengrong},
title = {NFCSense: Data-Defined Rich-ID Motion Sensing for Fluent Tangible Interaction Using a Commodity NFC Reader},
year = {2021},
isbn = {9781450380966},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3411764.3445214},
doi = {10.1145/3411764.3445214},
abstract = { This paper presents NFCSense, a data-defined rich-ID motion sensing technique for fluent tangible interaction design by using commodity near-field communication (NFC) tags and a single NFC tag reader. An NFC reader can reliably recognize the presence of an NFC tag at a high read rate (∼ 300 reads/s) with low latency, but such high-speed reading has rarely been exploited because the reader may not effectively resolve collisions of multiple tags. Therefore, its human–computer interface applications have been typically limited to a discrete, hands-on interaction style using one tag at a time. In this work, we realized fluent, hands-off, and multi-tag tangible interactions by leveraging gravity and anti-collision physical constraints, which support effortless user input and maximize throughput. Furthermore, our system provides hot-swappable interactivity that enables smooth transitions throughout extended use. Based on the design parameters explored through a series of studies, we present a design space with proof-of-concept implementations in various applications. },
booktitle = {Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems},
articleno = {505},
numpages = {14},
keywords = {Tags, Rich-ID, Motion Sensing, Fluent, Tangible Interaction, Physical Constraints, NFC},
location = {Yokohama, Japan},
series = {CHI '21}
}

License (GNU GPLv3 copyleft license)

OpenNFCSense is an open-source software under the terms of GNU GPLv3 copyleft license. Anyone can use this, for any purpose. Since a copyleft license requires that the project developed around your software be distributed under the same (or similar) license, you must give all users of your work the freedom to carry out all of copying, distribution and modification activities if the work is based on OpenNFCSense.

We also offer closed-source license which give you the ability not redistribute your software as open-source too. Contact the authors via ([email protected]) if you are interested.

In any form of copying, distribution and modification, you must include the following description in your source code, as mentioned in https://www.gnu.org/licenses/

/*========================================================================== 
//  OpenNFCSense4P (v1) - Open NFCSense API for Processing Language
//  Copyright (C) 2021 Dr. Rong-Hao Liang
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <https://www.gnu.org/licenses/>.
//==========================================================================*/
You might also like...

Android processing and secured library for managing SharedPreferences as key-value elements efficiently and structurally.

Android processing and secured library for managing SharedPreferences as key-value elements efficiently and structurally.

Memo Android processing and secured library for managing SharedPreferences as key-value elements efficiently and structurally. 1. Depend on our librar

Jun 30, 2022

A modern and lightweight library for working with email addresses in Java

JMail A modern, fast, zero-dependency library for working with email addresses and performing email address validation in Java. Built for Java 8 and u

Dec 22, 2022

A wayfast raycast java library.

NOTE: Rayfast is still in development and is not completely stable api-wise. GridCasting likely will not change, however Area3d's may have some improv

Dec 20, 2022

A JSON Transmission Protocol and an ORM Library for automatically providing APIs and Docs.

A JSON Transmission Protocol and an ORM Library for automatically providing APIs and Docs.

🚀 零代码、热更新、全自动 ORM 库,后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构。 🚀 A JSON Transmission Protocol and an ORM Library for automatically providing APIs and Docs.

Dec 31, 2022

Configuration library based on annotation processing

net.cactusthorn.config The Java library with the goal of minimizing the code required to handle application configuration. Motivation The inspiring id

Jan 8, 2023

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Dec 30, 2021

Simple, efficient Excel to POJO library for Java

ZeroCell ZeroCell provides a simple API for loading data from Excel sheets into Plain Old Java Objects (POJOs) using annotations to map columns from a

Dec 8, 2022

An expressive Mock Object library for Test Driven Development

JMock Library Maven dependency groupIdorg.jmock/groupId artifactIdjmock-junit5/artifactId version2.12.0/version scope

Aug 23, 2022

Java library to represent monetary amounts.

Joda-Money Joda-Money provides a library of classes to store amounts of money. Joda-Money does not provide, nor is it intended to provide, monetary al

Jan 4, 2023
Owner
Rong-Hao Liang
Rong-Hao Liang is an assistant professor of Department of Industrial Design, Eindhoven University of Technology, The Netherlands.
Rong-Hao Liang
Open Liberty is a highly composable, fast to start, dynamic application server runtime environment

Summary A lightweight open framework for building fast and efficient cloud-native Java microservices: Open Liberty is fast to start up with low memory

Open Liberty Project 1k Dec 21, 2022
High performance JVM JSON library

DSL-JSON library Fastest JVM (Java/Android/Scala/Kotlin) JSON library with advanced compile-time databinding support. Compatible with DSL Platform. Ja

New Generation Software Ltd 835 Jan 2, 2023
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 8, 2023
Screaming fast JSON parsing and serialization library for Android.

#LoganSquare The fastest JSON parsing and serializing library available for Android. Based on Jackson's streaming API, LoganSquare is able to consiste

BlueLine Labs 3.2k Dec 18, 2022
A modern JSON library for Kotlin and Java.

Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: String json = ...; Moshi moshi = new Mos

Square 8.7k Dec 31, 2022
JSON to JSON transformation library written in Java.

Jolt JSON to JSON transformation library written in Java where the "specification" for the transform is itself a JSON document. Useful For Transformin

Bazaarvoice 1.3k Dec 30, 2022
Sawmill is a JSON transformation Java library

Update: June 25, 2020 The 2.0 release of Sawmill introduces a breaking change to the GeoIpProcessor to comply with the updated license of the MaxMind

Logz.io 100 Jan 1, 2023
MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJO to JSON in a declarative way.

MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJ

Andrei Ciobanu 59 Sep 17, 2022
Genson a fast & modular Java <> Json library

Genson Genson is a complete json <-> java conversion library, providing full databinding, streaming and much more. Gensons main strengths? Easy to use

null 212 Jan 3, 2023
Lean JSON Library for Java, with a compact, elegant API.

mJson is an extremely lightweight Java JSON library with a very concise API. The source code is a single Java file. The license is Apache 2.0. Because

Borislav Iordanov 77 Dec 25, 2022