Implement access control systems for secured entry with RFID card or tag authentication
A
A
Hardware Overview
How does it work?
RFID 2 Click is based on the ID-12LA-SA, an advanced low-cost RFID reader module designed for stand-alone or remote-controlled applications to identify and track tags attached to objects from ID Innovations. The ID-12LA-SA requires a supply voltage of up to 5V, supports normal mode (autonomous mode) of operation, incorporates internal antennas, and has read ranges of 12cm and 18cm. In normal mode, when a card is presented to the reader, the reader searches for the card in its EEROM memory (the EEROM area stores the password and the reader polling address as well as timing and other values), and if there is a match module sends feedback information through interrupt pin labeled as CP. This mode stops operating if the reader module detects a valid polled command. It is crucial to mention that it protects so that the reader
requires password authorization for system changes and the addition or removal of cards. In this way, the EEROM can be made safe and only restored with the password. The ID-12LA-SA module communicates with MCU using the UART interface that operates at 9600 bps by default configuration with commonly used UART RX and TX pins for data transfer. The ID-12LA-SA module sends the ID data to the TX UART pin for monitoring, and in Normal mode, the reader sends the ID data of every card it reads. As mentioned previously in the product description, additional functionality such as Reset and ‘Card Present’ interrupt is provided and routed at RST and INT pins of the mikroBUS™ socket labeled as RST and CP. The RFID 2 Click also features the CMT-8540S-SMT magnetic buzzer that sounds for approximately one second when a card is
detected, controlled by the NE555 precision timer capable of producing highly accurate time delays from Texas Instruments. Signal frequency determines the sound pitch, and the duty cycle determines the amplitude (sound volume), so the user can create a sound pattern of their choice. It also possesses the card read status LED indicator labeled READ, which indicates a successful detection of the ID card. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
Clicker 2 for Kinetis is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit ARM Cortex-M4F microcontroller, the MK64FN1M0VDC12 from NXP Semiconductors, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a JTAG programmer connector, and two 26-pin headers for interfacing with external electronics. Its compact design with clear and easily recognizable silkscreen markings allows you to build gadgets with unique functionalities and
features quickly. Each part of the Clicker 2 for Kinetis development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Clicker 2 for Kinetis programming method, using a USB HID mikroBootloader or an external mikroProg connector for Kinetis programmer, the Clicker 2 board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Micro-B cable, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or
using a Li-Polymer battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several user-configurable buttons and LED indicators. Clicker 2 for Kinetis is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU

Architecture
ARM Cortex-M4
MCU Memory (KB)
1024
Silicon Vendor
NXP
Pin count
121
RAM (Bytes)
262144
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for RFID 2 Click driver.
Key functions:
rfid2_generic_write
- This function writes a desired number of data bytes by using UART serial interface.rfid2_generic_read
- This function reads a desired number of data bytes by using UART serial interface.rfid2_reset
- This function resets the chip.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief RFID 2 Click Example.
*
* # Description
* This example reads and processes data from RFID 2 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes UART module and sets RST pin as OUTPUT and INT pin as INPUT, also,
* initializes Driver init and reset chip.
*
* ## Application Task
* Reads the ID card (HEX) and logs data on the USB UART.
*
* ## Additional Function
* - static void rfid2_clear_app_buf ( void ) - Function clears memory of app_buf.
* - static err_t rfid2_process ( void ) - The general process of collecting data the module sends.
*
* @author Jelena Milosavljevic
*
*/
#include "board.h"
#include "log.h"
#include "rfid2.h"
#define PROCESS_BUFFER_SIZE 200
static rfid2_t rfid2;
static log_t logger;
static char app_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
static int32_t app_buf_cnt = 0;
/**
* @brief RFID 2 clearing application buffer.
* @details This function clears memory of application buffer and reset its length and counter.
* @note None.
*/
static void rfid2_clear_app_buf ( void );
/**
* @brief RFID 2 data reading function.
* @details This function reads data from device and concatenates data to application buffer.
*
* @return @li @c 0 - Read some data.
* @li @c -1 - Nothing is read.
* @li @c -2 - Application buffer overflow.
*
* See #err_t definition for detailed explanation.
* @note None.
*/
static err_t rfid2_process ( void );
void application_init ( void ) {
log_cfg_t log_cfg; /**< Logger config object. */
rfid2_cfg_t rfid2_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
rfid2_cfg_setup( &rfid2_cfg );
RFID2_MAP_MIKROBUS( rfid2_cfg, MIKROBUS_1 );
err_t init_flag = rfid2_init( &rfid2, &rfid2_cfg );
if ( UART_ERROR == init_flag ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms( 100 );
rfid2_reset( &rfid2 );
Delay_ms( 100 );
app_buf_len = 0;
app_buf_cnt = 0;
log_info( &logger, " Application Task " );
log_printf( &logger, "*** Please, put your ID card.***\r\n" );
log_printf( &logger, "*** ID card :\r\n" );
}
void application_task ( void ) {
app_buf_len = rfid2_generic_read( &rfid2, app_buf, PROCESS_BUFFER_SIZE );
if ( app_buf_len > 0 ) {
log_printf( &logger, "%s", app_buf );
memset( app_buf, 0, PROCESS_BUFFER_SIZE );
}
}
void main ( void ) {
application_init( );
for ( ; ; ) {
application_task( );
}
}
static void rfid2_clear_app_buf ( void ) {
memset( app_buf, 0, app_buf_len );
app_buf_len = 0;
app_buf_cnt = 0;
}
static err_t rfid2_process ( void ) {
int32_t rx_size;
char rx_buff[ PROCESS_BUFFER_SIZE ] = { 0 };
rx_size = rfid2_generic_read( &rfid2, rx_buff, PROCESS_BUFFER_SIZE );
if ( rx_size > 0 ) {
int32_t buf_cnt = 0;
if ( app_buf_len + rx_size >= PROCESS_BUFFER_SIZE ) {
rfid2_clear_app_buf( );
return RFID2_ERROR;
}
else {
buf_cnt = app_buf_len;
app_buf_len += rx_size;
}
for ( int32_t rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) {
if ( rx_buff[ rx_cnt ] != 0 ) {
app_buf[ ( buf_cnt + rx_cnt ) ] = rx_buff[ rx_cnt ];
}
else{
app_buf_len--;
buf_cnt--;
}
}
return RFID2_OK;
}
return RFID2_ERROR;
}
// ------------------------------------------------------------------------ END