How does it work?
2×2 RGB Click is based on the KTD2052A, a 12-channel RGB LED driver from Kinetic Technologies. It can be powered from mikroBUS™ socket supply rails, both with 3.3V and 5V selected over the VCC SEL. A 4-wire bus is multiplexed to reduce the pin count, as each pin on the bus integrates a switch to the input voltage and a programmable low-dropout current sink regulator. The driver is capable of 14 million colors with a controllable LED current from 125μA to 24mA in 125μA steps. There is also a night mode (8μA to 1.5mA in 8μA steps). There are 12 independent exponential fade engines with ultra-smooth 3072-step fade resolution and a 3-bit programmable fade rate.
2×2 RGB Click uses a standard 2-Wire I2C interface to communicate with the host MCU, supporting clock frequency of up to 1MHz. The I2C interface allows you to set the ON/OFF status and individual LED current, as well as adjust the fade rate. An internal flexible pattern generator with a watchdog counter enables set-and-forget pattern executions, while more complex patterns may be executed from system firmware via the I2C interface.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VIO 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.
Specifications
Type
LED Matrix
Applications
Can be used for the development of AI smart speakers, Bluetooth/Wi-Fi loudspeakers, automotive indicators and ambiance lighting, IoT, gaming, consumer electronics, and more
On-board modules
KTD2052A – 12-channel RGB LED driver from Kinetic Technologies
Key Features
The driver can drive up to 12 LEDs (4RGB LEDs), multiplexed LED current driver outputs, 14 million colors, 12 independent exponential fade engines, a flexible pattern generator with watchdog, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on 2×2 RGB Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Power Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | VIO SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
2×2 RGB Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Software Support
We provide a library for the 2×2 RGB 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 2×2 RGB Click driver.
Key functions
-
c2x2rgb_set_rgb_led
2×2 RGB set RGB LED function. -
c2x2rgb_set_control
2×2 RGB set control function.
Example Description
This example demonstrates the use of the 2×2 RGB Click board™ by controlling the color of the LEDs [1-4].
void application_task ( void )
{
log_printf( &logger, "rnRED: " );
for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
{
if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, DEMO_LED_CURRENT,
C2X2RGB_LED_CURRENT_OFF,
C2X2RGB_LED_CURRENT_OFF ) )
{
log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
}
Delay_ms( 200 );
}
log_printf( &logger, "rnGREEN: " );
for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
{
if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, C2X2RGB_LED_CURRENT_OFF,
DEMO_LED_CURRENT,
C2X2RGB_LED_CURRENT_OFF ) )
{
log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
}
Delay_ms( 200 );
}
log_printf( &logger, "rnBLUE: " );
for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
{
if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, C2X2RGB_LED_CURRENT_OFF,
C2X2RGB_LED_CURRENT_OFF,
DEMO_LED_CURRENT ) )
{
log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
}
Delay_ms( 200 );
}
log_printf( &logger, "rnWHITE: " );
for ( uint8_t led_pos = C2X2RGB_SET_LD1; led_pos <= C2X2RGB_SET_LD4; led_pos++ )
{
if ( C2X2RGB_OK == c2x2rgb_set_rgb_led( &c2x2rgb, led_pos, DEMO_LED_CURRENT,
DEMO_LED_CURRENT,
DEMO_LED_CURRENT ) )
{
log_printf( &logger, "LD%d ", ( uint16_t ) led_pos );
}
Delay_ms( 200 );
}
log_printf( &logger, "rn----------------" );
}
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:
- MikroSDK.Board
- MikroSDK.Log
- Click.2x2RGB
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.
mikroSDK
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.