TouchKey 2 click
TouchKey 2 click

Description of product

TouchKey 2 click has four capacitive pads powered by Microchip's ATtiny817 which has an integrated touch QTouch® controller. The click is designed to run on a 3.3V power supply. The four LEDs onboard the click indicate when the Key (Pad) is pressed. TouchKey 2 click communicates with the target microcontroller over UART interface (SPI interface is optional).

High moisture tolerance

You can use TouchKey 2 click in all kinds of conditions, without fearing something will happen to it due to moisture and water droplets falling on it.

The plastic overlay on the TouchKey 2 click protects the board from moisture. Thanks to this feature the electronic components are safe. The ATtiny817 has a driven shield for improved moisture and noise handling performance.

ATtiny817 features

Microchip's ATtiny817 is a microcontroller that uses an 8-bit AVR® processor with hardware multiplier, running at up to 20MHz and with up to 8KB Flash, 512 bytes of SRAM and 128 bytes of EEPROM.

ATtiny817 uses the latest technologies from Microchip with a flexible and low power architecture including Event System and SleepWalking, accurate analog features and advanced peripherals.

Capacitive touch interfaces with proximity sensing and driven shield are supported with the integrated QTouch® peripheral touch controller.

The module supports wake-up on touch from power-save sleep mode.

Button features

Capacitive buttons can be toggled even when placed under a layer of glass or paper.

How it works

There are four LEDs for four touch keys. If key A is pressed LED_A is ON, etc. In addition, there is UART communication between ATtiny817 and main MCU.

Note: The header onboard the TouchKey 2 click can be used for device programming. Current firmware sends data packets via UART (on which the demo example in our library is based). SPI communication is possible with firmware modifications. 

Specifications

TypeCapacitive
ApplicationsA replacement for mechanical buttons
On-board modulesATtiny817 from Microchip
Key FeaturesFour capacitive touch pads, 3.3V power supply, protective plastic overlay
Key BenefitsHigh moisture tolerance
InterfaceGPIO,SPI,UART
Input Voltage3.3V
CompatibilitymikroBUS
Click board sizeL (57.15 x 25.4 mm)

Pinout diagram

This table shows how the pinout on TouchKey 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).

NotesPinMikrobus logo.pngPinNotes
NC1ANPWM16NC
ResetPC5_TARGET_RESET2RSTINT15NC
SPI Chip SelectPC3_SPI_SS3CSTX14PA1_UART_TXDUART transmit
SPI ClockPC0_SPI_SCK4SCKRX13PA2_UART_TXDUART receive
SPI Master Input Slave OutputPC1_SPI_MISO5MISOSCL12NC
SPI Master Output Slave InputPC2_SPI_MOSI6MOSISDA11NC
Power supply+3.3V73.3V5V10NC
GroundGND8GNDGND9GNDGround

Buttons and LEDs

DesignatorNameType (LED, BUTTON…)Description
PWRPWRLEDPower Supply Indication LED.
LD1ALEDKey A Press Indication LED
LD2BLEDKey B Press Indication LED
LD3CLEDKey C Press Indication LED
LD4DLEDKey D Press Indication LED
J1PDIHeaderProgramming header

Maximum ratings

DescriptionMinTypMaxUnit
Power Supply Voltage-0.53.36V
Current into VDD pin100200mA
Reset pin Voltage-0.53.313V
I/O pin sink/source Current-4040mA

Programming

Code examples for TouchKey 2 click, written for MikroElektronika hardware and compilers are available on Libstock.

This code snippet initializes the MCU and display, and in an endless loop recognizes which key is being pressed. The key that was touched last is shown on the display.

01 void main( void )
02 {
03     system_init();
04     display_init();
05 
06     TFT_Set_Font( &HandelGothic_BT21x22_Regular, CL_RED, FO_HORIZONTAL );
07     TFT_Write_Text( "Press Any On-board Key", 50, 120 );
08 
09     while( true )
10     {
11         // Key A has been pressed
12         if( key_A_pressed && old_key != KEY_A )
13         {
14             display_key( "A", CL_RED );
15             key_A_pressed = false;
16             old_key = KEY_A;
17         }
18         // Key B has been pressed
19         else if( key_B_pressed && old_key != KEY_B )
20         {
21             display_key( "B", CL_GREEN );
22             key_B_pressed = false;
23             old_key = KEY_B;
24         }
25         // Key C has been pressed
26         else if( key_C_pressed && old_key != KEY_C )
27         {
28             display_key( "C", CL_BLUE );
29             key_C_pressed = false;
30             old_key = KEY_C;
31         }
32         // Key D has been pressed
33         else if( key_D_pressed && old_key != KEY_D )
34         {
35             display_key( "D", CL_PURPLE );
36             key_D_pressed = false;
37             old_key = KEY_D;
38         }
39     }
40 }

Downloads