OFF
MIKROE-3409
23 g
Status:
Analog Key Click is an analog keyboard on a Click board™. It contains six tactile pushbuttons, used to select one of six different voltage levels. The idea behind this click is very simple: six resistors form a voltage divider. The resistors are connected in series between the VCC and the GND. Each button selects one of the six middle taps, allowing six different voltage levels to be selected. The voltage is available at the AN pin of the mikroBUS™, which is additionally protected by an operational amplifier, configured as a buffer. This allows both protection and a proper impedance at the analog input pin of the microcontroller.
This product is no longer in stock
Availability date:
Featuring six high-quality pushbuttons, a simple debouncing circuit, and the output op-amp buffer, this Click board™ is an ideal solution for different applications controlled by discrete voltage levels, but also for applications which have restricted number of free pins. This type of keyboard can be used as password terminals for small alarm systems, for selecting an option in various embedded applications, and for all kinds of small DIY projects where low pin count is a big concern.
As already mentioned, the working principle of this Click board™ is very simple: it contains a voltage divider, formed by six 1 kΩ resistors. Those resistors are connected in series, and each connection point is routed to one pin of the SPST pushbutton. The KMR2 series KMR221 tactile buttons are high-quality SPST switches produced by CKSwitches, a company specialized in production of various types of quality switches. These buttons are rated to endure up to 300,000 switching cycles and have very low ON resistance of less than 100 mΩ. The buttons are rubberized and have a pleasant tactile feel when pressed.
By pressing a button, the respective connection point becomes redirected to the input of the OPA344, a low-power operational amplifier from Texas Instruments, which is configured to work with the unity gain, forming a buffer for the input of the microcontroller (MCU). This prevents changes of the impedance at the MCU input pin, as well as a limited amount of ESD protection.
By substituting the voltage divider resistors with two equivalent resistances (RE1 for the upper set of resistors, and RE2 for the lower set of resistors) the principle can be understood even better: when the top button is pressed (T1), the equivalent RE1 resistance will be 0 Ω, so regardless of the RE2 resistance, the voltage at the AN pin will be equal to VCC. When the second button (T2) is pressed, the equivalent RE1 resistance will be 1 kΩ, while the RE2 resistance will be 5K. The voltage at the AN pin can now be easily calculated by using the simple voltage divider formula:
VOUT=VCC ∙ RE2 / (RE1+RE2)
RE1 will be 2 kΩ, and RE2 will be 4 kΩ when the third (T3) button is pressed, and so on. Following this principle, the discrete voltage level for each button can be easily calculated, depending on the value of the VCC.
The VCC voltage for the voltage divider can be selected using the SMD jumper on the Click board™, labeled as VSEL. This jumper selects either a 3.3V or 5V mikroBUS™ power rail as the VCC source. Since there are many MCUs that cannot tolerate 5V on their pins, the VSEL position is set to 3.3V by default. However, if the 5V operation is required for specific application, it is enough to move the position of the VSEL jumper to the 5V position.
The selected output voltage appears at the AN pin of the mikroBUS™, labeled as VO on Analog Key click. It can be then sampled by the A/D converter of the MCU and used to control a device. Since Analog Key click requires just a single pin for its operation, it is perfectly suited for applications where the pin count restriction is a big problem.
Type
Pushbutton/Switches
Applications
It is an ideal solution for different applications controlled by discrete voltage levels, but also for applications which have restricted number of free pins including password terminals for small alarm systems, for selecting an option in various embedded applications, and for all kinds of small DIY projects where low pin count is a big concern.
On-board modules
KMR221, a tactile push-button by CKSwitches; OPA344, a low-power operational amplifier from Texas Instruments.
Key Features
Analog keyboard requires a single MCU pin, high quality buffer op-amp, rubberized tactile pushbuttons with very high endurance and low ON resistance, and more.
Interface
Analog
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V or 5V
This table shows how the pinout on Analog Key Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | - | Power LED indicator |
JP1 | VSEL | Left | Power supply voltage selection: left position 3.3V, right position 5V |
We provide a library for the Analog Key Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on MIKROE github account.
Library Description
This library contains API for Analog Key Click driver.
Key functions
This function returns which button is pressed.
This function sets the resolution.
Example Description
This example logs which button is pressed.
void application_task ( void )
{
float an_voltage = 0;
analogkey_key_id_t key;
float an_average = 0;
an_voltage = analogkey_read_voltage( &analogkey );
if ( an_voltage > 0.2 )
{
an_average += an_voltage / ANALOGKEY_N_SAMPLES;
for ( uint8_t cnt = 0; cnt < ANALOGKEY_N_SAMPLES - 1; cnt++ )
{
an_voltage = analogkey_read_voltage( &analogkey );
an_average += an_voltage / ANALOGKEY_N_SAMPLES;
}
}
if ( ( key = analogkey_get_key( &analogkey, an_average ) ) != ANALOGKEY_TOUCH_KEY_NONE )
{
log_printf( &logger, " T%u is pressed.rn", (uint16_t)key );
while ( analogkey_read_voltage( &analogkey ) > 0.2 ) {
Delay_ms ( 1 );
}
log_printf( &logger, " T%u is released.rn", (uint16_t)key );
Delay_ms ( 10 );
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on MIKROE github account.
Other MIKROE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
This Click board™ is supported with mikroSDK - MIKROE Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.
NOTE: Please be advised that any peripheral devices or accessories shown connected to the Click board™ are not included in the package. Check their availability in our shop or in the YMAN section below.