Add precise rotary input with durable 16-position switching for mode selection and configurable settings
A
A
Hardware Overview
How does it work?
Rotary Switch Click is based on the RDS6-16S-1065-1-SMT, a 16-position notched cap surface-mount rotary DIP switch from Same Sky designed for applications requiring precise rotary input. This high-quality switch offers a 2.54mm pin pitch and continuous 360-degree actuator rotation, making it suitable for various user-selectable settings. Its rotary actuator, designed for durability, features a maximum operating torque of 700gf*cm and a contact resistance of 80mΩ, ensuring reliable operation with every step. The switch is rated for an operating life of approximately 10,000 steps, demonstrating its suitability for repetitive use in applications requiring consistent performance. The RDS6-16S-1065-1-SMT is designed for ease of integration, with its notched cap enabling tactile feedback at each position, providing precise manual control over adjustments. The compact
form makes it ideal for space-constrained designs, while the robust construction ensures it can withstand demanding operating environments. Its reliable performance and long lifespan make it an excellent choice for applications ranging from mode selection in industrial equipment to user-configurable settings in consumer electronics or control interfaces in automotive systems. This Click board™ is designed in a unique format supporting the newly introduced MIKROE feature called "Click Snap." Unlike the standardized version of Click boards, this feature allows the main sensor area to become movable by breaking the PCB, opening up many new possibilities for implementation. Thanks to the Snap feature, the RDS6-16S-1065-1-SMT can operate autonomously by accessing its signals directly on the pins marked 1-8. Additionally, the Snap part includes a specified and fixed screw hole
position, enabling users to secure the Snap board in their desired location. This Click board™ connects to the host MCU via the TCA9536, a 4-bit general-purpose I/O expander from Texas Instruments. Using the I2C communication protocol, the TCA9536 enables straightforward monitoring of the switch's position by reporting its state to the host MCU. This integration simplifies interpreting the switch's output, reducing the need for additional hardware or complex wiring.This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this 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.
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.
Microcontroller Overview
MCU Card / MCU

Architecture
ARM Cortex-M4
MCU Memory (KB)
1024
Silicon Vendor
NXP
Pin count
121
RAM (Bytes)
262144
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Software Support
Library Description
This library contains API for Rotary Switch Click driver.
Key functions:
rotaryswitch_get_position- This function reads the rotary switch position.rotaryswitch_write_reg- This function writes a desired data to the selected register by using I2C serial interface.rotaryswitch_read_reg- This function reads data from the selected register by using I2C serial interface.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief Rotary Switch Click example
*
* # Description
* This example demonstrates the use of Rotary Switch Click board by reading
* and displaying the switch position on the USB UART.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the Click default configuration.
*
* ## Application Task
* Reads the switch position every 20ms and displays it on the USB UART on position change.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "rotaryswitch.h"
static rotaryswitch_t rotaryswitch;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
rotaryswitch_cfg_t rotaryswitch_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.
rotaryswitch_cfg_setup( &rotaryswitch_cfg );
ROTARYSWITCH_MAP_MIKROBUS( rotaryswitch_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == rotaryswitch_init( &rotaryswitch, &rotaryswitch_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( ROTARYSWITCH_ERROR == rotaryswitch_default_cfg ( &rotaryswitch ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
static uint8_t old_position = 0xFF;
uint8_t position = 0;
if ( ( ROTARYSWITCH_OK == rotaryswitch_get_position ( &rotaryswitch, &position ) ) &&
( position != old_position ) )
{
Delay_ms ( 20 );
// Double-check for debouncing
if ( ( ROTARYSWITCH_OK == rotaryswitch_get_position ( &rotaryswitch, &position ) ) &&
( position != old_position ) )
{
old_position = position;
log_printf ( &logger, " Switch position: %.1X\r\n", ( uint16_t ) position );
}
}
Delay_ms ( 20 );
}
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
Category:Pushbutton/Switches

































