Knob G Click

Product Code: MIKROE-3299

Knob G Click
Knob G Click
Knob G Click
Knob G Click

GST inclusive


Availability: Backorder

Add to Wish List

Featuring highly advanced LED driver IC which features an unparalleled flexibility and uses the I2C communication protocol, 24 individual LEDs which form a LED ring around the encoder, a high-quality rotary encoder with push-button from ALPS, and the debouncing circuitry that contains Schmitt triggers for a high reliability, Knob G click is an ideal solution for building various HMI applications where a precise input is required. Also, it can be used to add various interesting visual effects to any application.

How does it work?

The Knob G click consists of two distinctive sections: the first section is the rotary quadrature encoder which has its outputs routed to the GPIO pins of the mikroBUS. The encoder is supported by a debouncing circuitry, composed of passive elements and a triple inverting Schmitt trigger IC. The second section is the LED driver IC, with accompanying LEDs positioned in a form of a ring around the encoder, which makes them perfectly suited to be used as encoder position indicators.

Knob G click

This Click Board uses the EC12D, a 15-pulse incremental rotary encoder with a push-button, from ALPS. This encoder has very good mechanical specifications: debouncing time for its internal switches ranges down to 2ms, and it can withstand a huge number of switching cycles, up to 30,000. The supporting debouncing circuitry allows the switches to fully settle before the output is triggered: when the encoder contacts are closed, the capacitor will start to discharge through the encoder contacts, and the Schmitt trigger will output a LOW logic level when its low voltage threshold level is reached, and vice versa - when the encoder contacts are open, the capacitor will start to charge through the resistor, and the Schmitt trigger will output a HIGH logic level when its high voltage threshold level is reached. This allows reading the states of two encoder pins and one switch pin directly from the code, with no bulky software debouncing applied. This makes the Knob G click usable directly within the ISRs, with the interrupt-on-change event which allows an absolute accuracy and no skipped pulses (which can occur when a regular software polling technique is used). Encoder pins are labeled as ENA and ENB for the quadrature encoder contacts, and SW for the push-button contact. These pins are routed to the, CS and INT pin of the Mirko BUS, respectively.

LED ring is composed of 24 individual green LEDs which are driven by the PCA9956B, an 8-bit, 24-channel, constant current LED driver, from NXP. This driver IC has many LED driving features, including a constant current sinking capability, which greatly simplifies the design: the maximum current through the LEDs is determined by a single resistor. The structure of this IC is such that it has separate registers for each LED channel, as well as a single register which controls all the LEDs at once. It can use the PWM signal to allow PWM dimming, but it also features current-mode dimming, by scaling down the maximum current through LEDs. The PWM signal can have a low-frequency pulse signal superimposed on a top of it. While the PWM frequency of the driver is 31.25kHz, reducing the LED flickering completely, the low-frequency signal can range from 0 to 122Hz, allowing interesting blinking effects to be produced without using the computing power of the microcontroller (MCU). The LED dimming is very smooth since the PCA9956B supports up to 256 steps for the PWM duty cycle (8-bit). A full list of features can be found in the PCA9956B datasheet, in the download section, below.

The OE pin of the PCA9956B is routed to the PWM pin of the mikroBUS. When the LOW logic level is applied to the OE pin, the LED outputs will be enabled. This pin is pulled to a HIGH logic level by a resistor. Applying a PWM signal at the OE pin will result in the dimming of all LEDs at once. It can be used as another method of dimming, or as the ON-OFF switch for the entire LED ring. The LED driver IC can be reset by pulling the RST pin to a LOW logic level. This pin is pulled to a HIGH level by the pull-up resistor. The pulse can be incredibly short (2.5 µs) but the device will not be ready for another 1.5 ms after the reset pulse. Besides the hardware reset, the PCA9956B supports a software reset, which is necessary after the device is set to operate in the fast I2C mode (including the clock speed above 100 kHz).

The PCA9956B IC uses the 3.3V rail of the mikroBUS so there is no significant voltage drop, which causes thermal dissipation. However, turning on all LEDs at once with the maximum current set can cause the Knob G click to warm up a bit. This is expected, as the thermal dissipation of each channel is adding up to the sum dissipation of the entire IC. The PCA9956B IC features thermal shutdown protection, along with the set of error reporting features: it can report both open-circuit event and short-circuit event for each LED. These errors will be written in the ERR registers, one for each LED channel. The PCA9956B datasheet explains how to interpret the values of these registers.

The I2C address of the PCA9956B can be selected with three SMD jumpers, grouped under the ADDR label. The PCA9956B allows its slave I2C address to be selected from a very wide range of 125 different values. Each of the address pins (A0 to A3) can be left floating, pulled up, pulled down and shorted to VCC or GND. However, some I2C addresses are reserved, so they should be used with care. The datasheet of the PCA9956B offers tables with resistor values for each state of the address pins and reserved I2C addresses. Knob G click uses three 0 Ω SMD jumpers to set the states of these address pins.

The logic voltage level can be selected by the SMD jumper labeled as VCCIO. This jumper determines the logic levels for the logic signals from Schmitt triggers, as well as for the I2C communication with the PCA9956B. This allows the click board to be interfaced with a wide range of different MCUs, both compatible with 3.3V and 5V logic voltage levels.


Type Rotary encoder
Applications Knob G click is an ideal solution for building various HMI applications, where a precise input is required. Also, it can also be used to add various interesting visual effects to any application.
On-board modules PCA9956B, an 8-bit, 24-channel, constant current LED driver, from NXP; 74HC3G14DC, a triple inverting Schmitt trigger IC, from Nexperia
Key Features A reliable symmetrical debouncing circuit, a very flexible and powerful PWM LED driver which features several different dimming options, constant current through LEDs can be selected by a single resistor, smooth dimming in 256 steps for each LED channel, 24-segment LED ring that can be used for the visual feedback, etc.
Interface I2C,GPIO
Input Voltage 3.3V,5V
Compatibility mikroBUS
Click board size L (57.15 x 25.4 mm)

Pinout diagram

This table shows how the pinout on the Knob G Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).

Notes Pin Mikrobus logo.png Pin Notes
Encoder OUT A ENA 1 AN PWM 16 OE Control PWM Signal
 PCA9956B Reset RST 2 RST INT 15 SW Encoder Button OUT
Encoder OUT B ENB 3 CS RX 14 NC  
  NC 4 SCK TX 13 NC  
  NC 5 MISO SCL 12 SCL I2C Clock
  NC 6 MOSI SDA 11 SDA I2C Data
Power supply 3V3 7 3.3V 5V 10 5V Power supply
Ground GND 8 GND GND 9 GND Ground

Onboard settings and indicators

Label Name Default Description
PWR PWR - Power LED indicator
JP0, JP2 ADDR Right I2C slave address selection: left position GND (0), right position VCC (1)
JP1 ADDR Left I2C slave address selection: left position GND (0), right position VCC (1)
JP3 VCCIO Left Logic voltage level selection: left position 3.3V, right position 5V

Note: please consult the datasheet of the PCA9956B if you need to change the default I2C slave address

Software support

We provide a library for the Knob G click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Library Description

The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in the register and reads data from the register. The library includes the function for reading the Encoder position and sets a new start position. The user also has the functions for full control LEDs.

Key functions:

  • void knobg_setLedState(uint8_t led, uint8_t state) - Functions for setting the led state
  • void knobg_getEncoderPosition(int32_t *position, uint8_t *dir) - Functions for getting Encoder position
  • void knobg_encoderNewStartPosition(int32_t position) - Functions for set new start encoder position

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes I2C module, sets INT pin, AN pin and CS pin as INPUT and sets RST pin and PWM pin as OUTPUT
  • Application Initialization - Initialization driver init, reset the device, enable led output, set output gain on maximum and sets new start position of the encoder.
  • Application Task - (code snippet) - The Task application has 3 test modes: * The first example is setting BRIGHTNESS on all LEDs. * Other examples put the LED in the position read from the encoder. * The third example sets the LED to be read while the encoder registers the clockwise movement and turn off those LEDs that the encoder reads when moving in a counterclockwise direction. * The example is changed by pressing the SW button
void applicationTask()
    knobg_getEncoderPosition(&encoder_newPosition, &direction);
    if(knobg_getSWButtonState() == 0)
        if(SW_State >= 3) SW_State = 0;
        knobg_setBrightness(_KNOBG_BRIGHTNESS_ALL_LED, 0x00);
        Delay_ms( 300 );
    /* Logs position */
    if(encoder_newPosition != encoder_oldPosition)
        WordToStr(encoder_newPosition, demoText);
        mikrobus_logWrite(" EnCoder position : ", _LOG_TEXT);
        mikrobus_logWrite(demoText, _LOG_LINE);
    encoder_oldPosition = encoder_newPosition;
        /* Brightness */
        case 0:
            if(cnt > 127) cnt = 0;
            knobg_setBrightness(_KNOBG_BRIGHTNESS_ALL_LED, cnt);
            Delay_ms( 15 );
        /* Encoder with one led*/
        case 1:
            if(encoder_newPosition > 24) knobg_encoderNewStartPosition( 1 );
            if(encoder_newPosition < 1) knobg_encoderNewStartPosition( 24 );

            if(direction == 1)
                knobg_setLedState(encoder_newPosition, _KNOBG_LED_ON);
                knobg_setLedState(encoder_newPosition - 1, _KNOBG_LED_OFF);
                knobg_setLedState(encoder_newPosition, _KNOBG_LED_ON);
                knobg_setLedState(encoder_newPosition + 1, _KNOBG_LED_OFF);
        /* Encoder with all led */
        case 2:
            if(encoder_newPosition > 24) knobg_encoderNewStartPosition( 1 );
            if(encoder_newPosition < 1) knobg_encoderNewStartPosition( 24 );
            if(direction == 1)
                knobg_setLedState(encoder_newPosition, _KNOBG_LED_ON);
                knobg_setLedState(encoder_newPosition + 1, _KNOBG_LED_OFF);


The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

  • I2C

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.


This click board is supported with mikroSDK - MikroElektronika 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.


 mikroBUS™ Standard specification 

 LibStock: mikroSDK 

 Click board catalog

 Knob G Click Libstock 

 Knob G Click Schematic

 Knob G Click 2D and 3D files

 PCA9956B Datasheet

Write a review
Your Name:

Your Review:
Note: HTML is not translated!
Bad           Good

Enter the code in the box below:

Tags: Knob, G, Click, MIKROE, 3299,

© 2019, MG Automation Technologies. Powered by MG Super LABS.Find us on Google+
Designed with by