Medical applications with implantable sensors and industrial sensor tags call for miniaturized hardware with very low power consumption and easy wireless access. The NFC interface is a very suitable medium for such applications due its capability of powering the sensors, thereby avoiding bulky batteries and wireless interface to user hardware. It is particularly applicable in cases where the instantaneous sensor readings are required with less data logging when the user is not present and a smartphone-based interface due to wide adoption of NFC across mobile platforms. The project implements an Android OS-based miniaturized NFC interface platform to access analog sensors with real-time signal plotting and digital output control.
App user guideAs shown in the video the solution is capable of real time analog input sensing with a continuous time graph plot of one of the inputs. The app is automatically started on sensing the Tag and starts reading data on reintroducing the phone into the sensor’s NFC field. It allows the user to start and stop sensing inputs. The start button should be pressed before connecting to the sensor. Pressing the stop button safely disconnects the tag from the phone and stops reading, plotting of analog inputs. To restart communication the user needs to press start and reintroduce the sensor tag in the phone’s NFC field. A digital output control is also provided and was connected externally to one of the analog inputs in to illustrate real-time sensing in the video.
The connection status is provided at the top of the screen. If the connection with the tag fails during communication, the tag should be reintroduced to the phone’s NFC field. The application can be minimized during operation and reopened to continue data transfer. Additional test options to change screen text and register display of NFC output is also provided for easy debug and design extension.
HardwareThe RF430FRL152H was used in this application to implement the NFC to sensor interface. The device has the advantage of incorporating a 3-channel sigma delta ADC with an MCU and NFC radio in a single low power device. The MCU is factory programmed to log ADC values according to NFC commands which offloads MCU programming to the android code and simplifies manufacturing. The ADC also includes a thermistor interface with bias current sources for resistive sensors. The NFC temperature-sensing patch was leveraged in the project due to the board flexibility and low solution size. The scanner can be any android device that supports NFC. The device features FRAM memory which is non volatile like Flash but allows quick access to program variables and ADC outputs like RAM.
SoftwareThe main part of the project was the Android application development, which communicates with the default firmware on the RF430FRL152H present in the sensor interface board. The NFC-V class (ISO15693) in the Android development library was leveraged here. ISO15693 does not use the standard NDEF format used in most NFC tag applications and is classified as a NFC-V tech tag with I/O interface.
The application was configured to open automatically on sensing the sensor tag by adding intent filters and requesting NFC permissions on the androidmanifest.xml file. The layout was created in the graphical XML editor tool with relative tile alignment and button based function call (linked in the main Java source file).
The control flow of the design is given by the mainactivity.java file, which includes general android application life cycle methods and methods triggered by the NFC intent.
The life cycle methods of the app are as follows:onCreate
(starts with application initialization on detection of NFC tag): The output fields and graph display of the application are initialized and linked to the XML layout file. The graphview library was leveraged to generate the real-time graph. The NFC adapter of the phone is detected and initialized. The app displays an error message if NFC is disabled and shuts down if the device does not support NFC.
onResume
(called afteronCreate
or when app brought into foreground): Foreground dispatch is enabled to prevent the app from restarting if the NFC connection is re-established when the app is running. The method also continuously updates the display by parsing the global receive variable containing data from NFC communication running on a parallel thread. The new ADC readings are appended to the graphview object to create a real-time plot.
onPause
(called when application is moved to background): The foreground dispatch is disabled and display stops updating.
The NfcVreaderTask runs the communication thread asynchronous to the display update after NFC detection raises an intent. It includes these methods: onPostexecute
and doInBackground
. The tag read is detailed in the function readTagData
. The sensor read steps are as follows:
- The tag type is verified to be NfcV and a connection is established with the nfcV.connect() function.
- The NfcV.transcieve is used repeatedly to configure the NFC tag and read acknowledgement or sensor reading. A test block is read prior to verify successful communication.
- The ADC channels are enabled and configured to 12 bit decimation for faster sampling rate with a write to registers in block 0x02. The ADC constant current bias for resistive sensors is enabled, digital interrupt pin used for digital output is enabled and sampling is started with a write to block 0x00. The digital output is set using the checkbox field on the app.
- The newly generated ADC data is read from block 0x09 and stored in a global variable, which is then parsed into a hexadecimal value representing ADC outputs. Confirmation of the previous step is read from block 0x0A.
An extension of the application would include logging of sensor reading into the cloud for easy access of pattern data and data analytics.
Comments