Intermediate
30 min

Provide a more intuitive and seamless control experience with MTCH105 and STM32F446RE

Unleash your creativity with capacitive touch

Cap Extend 3 Click with Nucleo 64 with STM32F446RE MCU

Published Oct 08, 2024

Click board™

Cap Extend 3 Click

Dev Board

Nucleo 64 with STM32F446RE MCU

Compiler

NECTO Studio

MCU

STM32F446RE

Designed to revolutionize user interfaces, our capacitive touch buttons offer a sleek and modern alternative to traditional mechanical buttons, elevating the overall design aesthetics of your solutions

A

A

Hardware Overview

How does it work?

Cap Extend 3 Click is based on the MTCH105, a five-channel proximity/touch controller with active guarding capability from Microchip. The MTCH105 IC uses a sophisticated scan optimization algorithm to attenuate noise from the signal actively. A good SNR is an essential prerequisite when implementing reliable capacitive touch detection. Good SNR, automatic environmental compensation, low power consumption, and simple I/O interface make this IC a perfect solution for building the Cap Extend 3 Click with four reliable touchpad sensors. The surface of Cap Extend 3 click is protected with acrylic glass. If a touch event is detected on one of the sensors connected to input pins of the IC (MTI0 to MTI4), the state of the corresponding channel output pin (MTO0 to MTO4) will be pulled to a logic LOW level, indicating that the channel has been activated - touch has been detected on that specific channel. This will also be indicated by a LED related to the activated channel. The output pins are working in an open drain configuration, thus, are pulled HIGH by the onboard resistors. Although the IC has five channels, only four buttons are implemented, as one of the channels is multiplexed with the active guard functionality. The guard control (GC) pin is multiplexed with the MTO2 pin, while the GUARD pin is multiplexed with the MTI2 pin. If the GC pin is pulled down to a GND level, it will set the MTI2/GUARD pin into the GUARD mode, which can absorb the noise around

the sensor pads. A PCB trace connected to this pin surrounds all the sensor pads, providing active guarding and enhancing the SNR significantly. It should be noted that when the Active Guard is activated, a LED on the MTO2 pin will be lit, indicating that the Guard function is enabled. A small onboard SMD jumper, labeled as JP2, can be left unpopulated, disconnecting the guard pin from the network of PCB traces that surround the sensor pads. This option is useful when the external sensor pads are used or when the active guard function is not required so that the MTI2/MTO2 can be used as an additional external cap touch sensor. Cap Extend 3 click also allows connecting of external sensors through the connector labeled as J1. The MTCH105 allows sensors of various sizes and shapes to be used and sensors made of several different materials - carbon printing on plastic film, Indium Tin Oxide (ITO) pad, wire/cable, and more. The external sensors connector allows expanding touch capabilities of the Cap Extend 3 beyond the click itself. All five channels are routed to this connector so that users can decide on their preferred sensor configuration and if the active guard feature will be used or replaced by another sensor. The sensitivity of the sensor pads can be adjusted via the onboard potentiometer connected between the VCC and GND. The potentiometer acts as a voltage divider, with its wiper connected to the MTSA pin of the MTCH105. Raising the

voltage level of this pin will result in the lower sensitivity of the MTCH105 inputs. The onboard SMD jumper labeled as the MODE SEL is used to select the working mode of the device. The device can work in either normal or low-power mode. While working in normal mode, the burst scan of the inputs will happen continuously, providing the shortest detection time. When set to work in the low power mode, the device will have a delay of 256ms between each burst scan interval. It will allow for significantly reduced power consumption, but the touch detection can be longer in this case. The device will work normally when the MTPM pin is set to the VCC level by switching the MODE SEL jumper to the position labeled HIGH. When the MODE SEL jumper is set to the position labeled as LOW, the MTPM pin will be set to the GND level, and the device will work in the low power mode. The device also features a timeout reset. This function is useful when a foreign object or its state obstructs the sensor pad and is otherwise stuck as activated. When the channel stays activated for 10 seconds, the corresponding channel will be reset and recalibrated. All the five-channel output pins of the MTCH105 are routed to the mikroBUS™ so that the MCU can easily read and detect their states. The channels are routed to the AN, PWM, INT, RST, and CS pins of the mikroBUS™.

Cap Extend 3 Click hardware overview image

Features overview

Development board

Nucleo-64 with STM32F446RE MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin

headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is

provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.

Nucleo 64 with STM32F446RE MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

512

Silicon Vendor

STMicroelectronics

Pin count

64

RAM (Bytes)

131072

You complete me!

Accessories

Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Nucleo-64 accessories 1 image

Used MCU Pins

mikroBUS™ mapper

Sensor 0 State
PC0
AN
Sensor 1 State
PC12
RST
Sensor 2 State
PB12
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Sensor 3 State
PC8
PWM
Sensor 4 State
PC14
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

Cap Extend 3 Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-64 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo 64 with STM32F446RE MCU as your development board.

Click Shield for Nucleo-64 front image hardware assembly
Nucleo 64 with STM32F401RE MCU front image hardware assembly
EEPROM 13 Click front image hardware assembly
Prog-cut hardware assembly
Nucleo-64 with STM32XXX MCU MB 1 Mini B Conn - 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
Clicker 4 for STM32F4 HA 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 Cap Extend 3 Click driver.

Key functions:

  • capextend3_Touch_0 - Function reads state of AN pin

  • capextend3_Touch_1 - Function reads state of RST pin

  • capextend3_Touch_2 - Function reads state of CS pin

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 Cap Extend 3 Click example
 * 
 * # Description
 * This application features four capacitive sensor pads, 
 * that can sense touch through a variety of different materials.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialize GPIO Driver
 * 
 * ## Application Task  
 * Depending on which button is touched the usb uart
 * will show number of that button.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "capextend3.h"

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

static capextend3_t capextend3;
static log_t logger;

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

void application_init ( void )
{
    log_cfg_t log_cfg;
    capextend3_cfg_t cfg;

    /** 
     * 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.
    capextend3_cfg_setup( &cfg );
    CAPEXTEND3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    capextend3_init( &capextend3, &cfg );
}

void application_task ( void )
{
    uint8_t touch_0;
    uint8_t touch_1;
    uint8_t touch_2;
    uint8_t touch_3;
    uint8_t touch_4;

    touch_0 = capextend3_touch_0( &capextend3 );
    touch_1 = capextend3_touch_1( &capextend3 );
    touch_2 = capextend3_touch_2( &capextend3 );
    touch_3 = capextend3_touch_3( &capextend3 );
    touch_4 = capextend3_touch_4( &capextend3 );
    
    if ( touch_2 == 0 )
    {
       log_printf( &logger, "Active Guard\r\n" ); 
    }
    if ( touch_0 == 0 )
    {
       log_printf( &logger, "Touch 0 \r\n" ); 
    }
    if ( touch_1 == 0 )
    {
       log_printf( &logger, "Touch 1 \r\n" ); 
    }
    if ( touch_3 == 0 )
    {
       log_printf( &logger, "Touch 3 \r\n" ); 
    }
    if ( touch_4 == 0 )
    {
       log_printf( &logger, "Touch 4 \r\n" ); 
    }
    if ( ( touch_0 && touch_1 && touch_2 && touch_3 && touch_4 ) == 0 ) 
    {
        log_printf( &logger, "------------------------\r\n" ); 
    }
    Delay_ms( 100 );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}


// ------------------------------------------------------------------------ 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.