OFF
MIKROE-1627
36 g
Status:
Thumbstick Click is a compact add-on board that can fulfill your directional analog input needs. This board features COM-09032, a high-quality 2-axis analog output thumbstick from Sparkfun. This small joystick is a 'self-centering' analog type with a black rocker cap similar to the ones used on joypads on popular gaming consoles. It comprises two 10kΩ potentiometers, one for up/down and another for left/right direction. Knowing that this joystick represents an analog type, it connects with mikroBUS™ through the SPI interface through the Microchip's MCP3204 12-bit A/D converter. This Click board™ is suitable for numerous applications as a human-machine interface device (HMI), robotics, and other control interfaces.
Thumbstick Click is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.
This product is no longer in stock
Availability date:
Thumbstick Click is based on the COM-09032, a high-quality 2-axis analog-type thumbstick from Sparkfun. This type of thumbstick has a self-centering feature (spring return) that allows it to center itself the moment when you release it. It also contains a comfortable cup-type black knob/cap, which gives the feel of a thumbstick, making it very similar to the ‘analog’ joysticks used on joypads on popular gaming consoles like PSP joysticks. This feature makes it suitable for numerous applications as a human-machine interface.
It comprises two 10kΩ potentiometers, one for up/down and another for left/right direction, used as dual adjustable voltage dividers providing 2-axis analog input in a control stick form. With the thumbstick fully assembled and functioning, the voltage will follow the motion of the thumbstick as it is moved around.
The measurements of the potentiometer resistance change are needed to read the thumbstick's physical position. That's why the MCP3204, a 12-bit A/D converter with conversion rates of up to 100ksps from Microchip, connects the thumbstick with mikroBUS™ using a simple serial interface compatible with the SPI protocol to determine the value of the joystick's X and Y. As the MCP3204 has a resolution of 12 bits, the values on each analog channel (axis) can vary from 0 to 4095. So, if the stick is moved on the X axis from one end to the other, the X values will change from 0 to 4095, and a similar thing happens when moved along the Y axis. The value of the thumbstick staying in its center position is around 2048. Also, the thumbstick has a pushbutton feature that sends an interrupt signal to the host MCU through the INT line of the mikroBUS™ socket.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via SMD jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. However, the 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.
Type
Pushbutton/Switches
Applications
Can be used for numerous applications as a human-machine interface device (HMI), robotics, and other control interfaces
On-board modules
COM-09032 - two-axis analog-type thumbstick from Sparkfun
Key Features
Low power consumption, high quality, high mechanical and electrical durability, self-centering feature, pushbutton enabled joystick, 2-axis, SPI interface, and more
Interface
GPIO,SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
This table shows how the pinout on Thumbstick 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 | - | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | - | 5 | V |
COM-09032 Potentiometer Resistance | - | 10 | - | kΩ |
ADC Resolution | - | 12 | - | bits |
We provide a library for the Thumbstick 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 Thumbstick Click driver.
Key functions
Get state of thumbstick button function
Get thumbstick position by axis function
Generic read 2 byte of data function
Example Description
The demo application shows clickboard axis postioning and button state.
void application_task ( void )
{
//Button pressed
button_state = thumbstick_button_state( &thumbstick );
if ( old_butt_state != button_state )
{
if ( button_state == THUMBSTICK_PRESS_BUTTON )
{
log_printf( &logger, ">> Button is pressed rn" );
Delay_ms( 100 );
}
else
{
log_printf( &logger, ">> Button is released rn" );
Delay_ms( 100 );
}
old_butt_state = button_state;
}
//Thumbstick postion
thumbstick_get_position( &thumbstick, &thumbstick_pos );
if ( ( old_pos.vertical != thumbstick_pos.vertical ) || ( timer_cnt >= TIMER_FLAG ) )
{
if ( thumbstick_pos.vertical == THUMBSTICK_POSITION_TOP )
{
log_printf( &logger, ">> TOP rn" );
change_state = true;
}
else if ( thumbstick_pos.vertical == THUMBSTICK_POSITION_BOTTOM )
{
log_printf( &logger, ">> BOTTOM rn" );
change_state = true;
}
old_pos = thumbstick_pos;
}
if ( (old_pos.horizontal != thumbstick_pos.horizontal ) || ( timer_cnt >= TIMER_FLAG ) )
{
if ( thumbstick_pos.horizontal == THUMBSTICK_POSITION_LEFT )
{
log_printf( &logger, ">> LEFT rn" );
change_state = true;
}
else if ( thumbstick_pos.horizontal == THUMBSTICK_POSITION_RIGHT )
{
log_printf( &logger, ">> RIGHT rn" );
change_state = true;
}
old_pos = thumbstick_pos;
}
if ( ( timer_cnt >= TIMER_FLAG ) || ( change_state == true ) )
{
timer_cnt = 0;
change_state = false;
}
timer_cnt++;
Delay_ms( 1 );
}
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.