Intermediate
30 min

Upgrade your projects with all-in-one sensing solution based on the IQS621 and MK64FN1M0VDC12

Sensory fusion: touch, magnetism, and beyond!

ProxFusion 2 Click with Clicker 2 for Kinetis

Published Aug 07, 2023

Click board™

ProxFusion 2 Click

Dev Board

Clicker 2 for Kinetis

Compiler

NECTO Studio

MCU

MK64FN1M0VDC12

Our groundbreaking solution, combining capacitive touch, Hall-effect, and inductance sensing capabilities, aims to provide a comprehensive and versatile sensing platform that opens the door to a myriad of applications across various industries

A

A

Hardware Overview

How does it work?

ProxFusion 2 Click is based on the IQS621, a multifunctional sensor with ambient light (ALS), capacitive touch, Hall-effect, and inductance sensing capabilities, from Azoteq. Their IQ Switch® ProxFusion® sensor series is one of the first to incorporate several sensory functions on the same die. This makes the IQS62x series perfectly suited for compact designs, such as those used in IoT or various home automation systems. The IQS621 IC does not sacrifice any feature in favor of having multiple sensors on the same chip; on the contrary, it offers all the key features commonly found on other stand-alone sensors. The sensitivity of IQS621 is improved by using a regulated and stable internal power supply, along with the Automatic Tuning Implementation (ATI) technology, which provides consistent readings, regardless of environmental conditions. The capacitive sensor is based on the proven ProxSense® technology. It allows self-capacitance sensing, adjustable proximity and touch thresholds, alternative ATI modes, and individual sensitivity setups. The IQS621 offers two distinctive user interfaces that can be used with the capacitive sensor: Discrete Button UI and Hysteresis UI. Both interfaces offer programmable registers to set up the sensing parameters, such as

thresholds, filter settings, ATI settings, and more. While the Discrete prox/touch UI is more suited to be used as the ON/OFF switch detector, the Hysteresis UI can program sensing of more complex events. An inductive sensor is also present on this IC. It can be used to detect the presence of metal objects. Again, two distinct user interfaces are available, each with its own set of registers. There is a Discrete Button UI, as well as the Hysteresis UI. The detection thresholds are widely adjustable, allowing reliable detection of even smaller metallic objects. ProxFusion® 2 click has the PCB trace coil area, which allows inductive detection. The same area of the Click board™ is used to sense capacitive events. The IQS621 also features an ambient light sensor (ALS). The ALS UI outputs readings directly in Lux, requiring no additional conversion. The ALS response is calibrated according to the human eye. It also features an IR filter, reducing the influence of infrared light. The ALS includes a selectable range and two threshold settings for day/night indication. ALS enables the design of smart light switches: detecting night/day events might be used to regulate the lighting, for example. Hall-effect sensors can be used to detect changes in the magnetic field. Unlike the capacitive and

inductive sensors, the Hall sensor requires no external parts since Hall plates are embedded into the IC. Hall-sensor allows several events to be detected, as an advanced signal processing algorithm supports it. Besides other features, it can detect field pole orientation (N/S), allowing it to be used as a switch. This allows it to be used for different kinds of contactless HMIs. A temperature sensor is one of the most commonly used sensors. It can be found even on other sensors, such as pressure or humidity, since the temperature affects readings. The role of the thermal sensor in IQS621 is no different: it is used to provide a calibration base for other sensors on this IC. However, this sensor can also monitor the ambient temperature in any application. Finally, each detected ON/OFF type event can be monitored in the Global events register. This is very useful as the host MCU can only poll a few registers to discover these events. The communication with the IQS621 is done over the I2C interface with the additional RDY pin. This pin is routed to the INT pin of the mikroBUS™ and indicates a communications window. The Click board™ is designed to work with 3.3V only. A proper level translation circuit should be used when using it with MCUs that use 5V levels for their communication.

ProxFusion 2 Click top side image
ProxFusion 2 Click bottom side image

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.

Clicker 2 for Kinetis dimensions image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

NXP

Pin count

121

RAM (Bytes)

262144

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Data Ready
PB13
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PD8
SCL
I2C Data
PD9
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

ProxFusion 2 Click Schematic schematic

Step by step

Project assembly

Clicker 2 for PIC32MZ front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Clicker 2 for Kinetis as your development board.

Clicker 2 for PIC32MZ front image hardware assembly
Buck 22 Click front image hardware assembly
Prog-cut hardware assembly
Micro B Connector Clicker 2 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Flip&Click PIC32MZ MCU step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for ProxFusion 2 Click driver.

Key functions:

  • proxfusion2_detect_touch - Function for detecting touch

  • proxfusion2_detect_dark_light - Function for read ambient light

  • proxfusion2_detect_hall - Function for read Hall-effect

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * \file 
 * \brief ProxFusion2 Click example
 * 
 * # Description
 * This example demontrates the use of ProxFusion 2 Click board.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver and performs the click default configuration.
 * 
 * ## Application Task  
 * - Checks whether Touch is detected and measures the output detection.
 * - Measures Ambient lighting - whether it's Light or Dark, ALS range and ALS output.
 * - Checks the orientation of the magnet and measures the HALL output.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "proxfusion2.h"

// ------------------------------------------------------------------ VARIABLES

static proxfusion2_t proxfusion2;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    proxfusion2_cfg_t proxfusion2_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.
    proxfusion2_cfg_setup( &proxfusion2_cfg );
    PROXFUSION2_MAP_MIKROBUS( proxfusion2_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == proxfusion2_init( &proxfusion2, &proxfusion2_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( PROXFUSION2_ERROR == proxfusion2_default_cfg ( &proxfusion2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint8_t als_range = 0;
    uint8_t hall_detect = 0;
    uint16_t read_data = 0;
    if ( PROXFUSION2_TOUCH_DETECTED == proxfusion2_detect_touch( &proxfusion2 ) )
    {
        log_printf( &logger, " TOUCH: YES\r\n" );
    }
    else
    {
        log_printf( &logger, " TOUCH: NO\r\n" );
    }
    read_data = proxfusion2_read_data( &proxfusion2 , PROXFUSION2_HYSTERESIS_UI_OUTPUT );
    log_printf( &logger, " LEVEL: %u\r\n\n", read_data );
 
    if ( PROXFUSION2_AMBIENT_DARK == proxfusion2_detect_dark_light( &proxfusion2, &als_range ) )
    {
        log_printf( &logger, " AMBIENT: DARK\r\n" );
    }
    else
    {
        log_printf( &logger, " AMBIENT: LIGHT\r\n" );
    }
    log_printf( &logger, " RANGE: %u\r\n", ( uint16_t ) als_range );
 
    read_data = proxfusion2_read_data( &proxfusion2, PROXFUSION2_ALS_UI_OUTPUT );

    log_printf( &logger, " LEVEL: %u\r\n\n", read_data );
 
    hall_detect = proxfusion2_detect_hall( &proxfusion2 );
    if ( PROXFUSION2_HALL_NORTH == hall_detect )
    {
        log_printf( &logger, " HALL: NORTH\r\n" );
    }
    else if ( PROXFUSION2_HALL_SOUTH == hall_detect )
    {
        log_printf( &logger, " HALL: SOUTH\r\n" );
    }
    else
    {
        log_printf( &logger, " HALL: UNKNOWN\r\n" );
    }
    read_data = proxfusion2_read_data( &proxfusion2, PROXFUSION2_HALL_EFFECT_UI_OUTPUT );
    log_printf( &logger, " LEVEL: %u\r\n", read_data );
    
    log_printf( &logger, " --------------\r\n" );
    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END
/*!
 * \file 
 * \brief ProxFusion2 Click example
 * 
 * # Description
 * This example demontrates the use of ProxFusion 2 Click board.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver and performs the click default configuration.
 * 
 * ## Application Task  
 * - Checks whether Touch is detected and measures the output detection.
 * - Measures Ambient lighting - whether it's Light or Dark, ALS range and ALS output.
 * - Checks the orientation of the magnet and measures the HALL output.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "proxfusion2.h"

// ------------------------------------------------------------------ VARIABLES

static proxfusion2_t proxfusion2;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    proxfusion2_cfg_t proxfusion2_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.
    proxfusion2_cfg_setup( &proxfusion2_cfg );
    PROXFUSION2_MAP_MIKROBUS( proxfusion2_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == proxfusion2_init( &proxfusion2, &proxfusion2_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( PROXFUSION2_ERROR == proxfusion2_default_cfg ( &proxfusion2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint8_t als_range = 0;
    uint8_t hall_detect = 0;
    uint16_t read_data = 0;
    if ( PROXFUSION2_TOUCH_DETECTED == proxfusion2_detect_touch( &proxfusion2 ) )
    {
        log_printf( &logger, " TOUCH: YES\r\n" );
    }
    else
    {
        log_printf( &logger, " TOUCH: NO\r\n" );
    }
    read_data = proxfusion2_read_data( &proxfusion2 , PROXFUSION2_HYSTERESIS_UI_OUTPUT );
    log_printf( &logger, " LEVEL: %u\r\n\n", read_data );
 
    if ( PROXFUSION2_AMBIENT_DARK == proxfusion2_detect_dark_light( &proxfusion2, &als_range ) )
    {
        log_printf( &logger, " AMBIENT: DARK\r\n" );
    }
    else
    {
        log_printf( &logger, " AMBIENT: LIGHT\r\n" );
    }
    log_printf( &logger, " RANGE: %u\r\n", ( uint16_t ) als_range );
 
    read_data = proxfusion2_read_data( &proxfusion2, PROXFUSION2_ALS_UI_OUTPUT );

    log_printf( &logger, " LEVEL: %u\r\n\n", read_data );
 
    hall_detect = proxfusion2_detect_hall( &proxfusion2 );
    if ( PROXFUSION2_HALL_NORTH == hall_detect )
    {
        log_printf( &logger, " HALL: NORTH\r\n" );
    }
    else if ( PROXFUSION2_HALL_SOUTH == hall_detect )
    {
        log_printf( &logger, " HALL: SOUTH\r\n" );
    }
    else
    {
        log_printf( &logger, " HALL: UNKNOWN\r\n" );
    }
    read_data = proxfusion2_read_data( &proxfusion2, PROXFUSION2_HALL_EFFECT_UI_OUTPUT );
    log_printf( &logger, " LEVEL: %u\r\n", read_data );
    
    log_printf( &logger, " --------------\r\n" );
    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.