Enhance user experiences in your products with our RGB driver, allowing for customized color schemes and mood-enhancing lighting
A
A
Hardware Overview
How does it work?
LED Driver 3 Click is based on the NCP5623B, a triple output RGB LED driver controlled through the I2C protocol from ON Semiconductors. This IC has an internal DC/DC converter that works as a high-efficiency charge pump, providing the required DC voltage for all three LED segments. The current flow through each LED segment is regulated by an internal current mirror associated with each channel. The gradual dimming function allows an easy way of dimming RGB LED intensity. With a simple I2C command, it is possible to trigger either upward or downward dimming. Dimming will affect the current through the LED segments, but the internal current limiter does not exceed the maximum allowed current set by the onboard resistor. The integrated PWM operates with five bits, having 32 steps to cover the associated LED channel's full modulation (0 to 100%). A value of 0x00h will turn the associated
LED completely OFF, while 0x1Fh will set the LED to a programmed LED current value. The last three bits (MSB) are used to set the desired command register: PWM1, PWM2, PWM3, dimming direction, gradual dimming, LED current, and more. It should be noted that the gradual dimming function affects the illumination by changing the LED current intensity, while PWM affects the associated LED illumination by changing the pulse width - e.g., it is possible to set the desired color by setting the PWM modulation of each color component, and then gradually dim the brightness of the final color mix up or down by the gradual dimming option - affecting the current through all the LED segments simultaneously. It is also possible to set the fixed value for the current through the LED segments via the I2C interface when gradual dimming is not needed. To allow operation on both 3.3V and 5V MCUs, LED Driver 3
Click employs PCA9306, a dual bidirectional I2C/SMBUS voltage level translator from Texas Instruments. This IC allows the click board to be interfaced with 3.3V and 5V MCUs. The logic voltage level shifting is done automatically, so no SMD jumpers are needed in this case. Both 3.3V and 5V rails are needed for this circuit to be operational. The click board is also equipped with an RGB LED. This is a high-brightness RGB LED with a wide viewing angle that can get very hot and bright while operated with maximum current. For this reason, care must be taken not to touch it or watch directly at the LED. SCL1 and SDA1 lines from the I2C level shifter are routed to the standard mikroBUS™ I2C pins, labeled as SCL and SDA. The click board™ already contains pull-up resistors, so no additional parts are needed to work with the click board.
Features overview
Development board
UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build
gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li
Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker 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
Type
8th Generation
Architecture
ARM Cortex-M0
MCU Memory (KB)
32
Silicon Vendor
STMicroelectronics
Pin count
48
RAM (Bytes)
8192
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output
After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.
After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.
Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.
Software Support
Library Description
This library contains API for LED Driver 3 Click driver.
Key functions:
leddriver3_set_rgb_color
- This function sets the color of the rgb LEDs through the parameters for red, green and blueleddriver3_set_color
- This function sets colorleddriver3_set_timer
- This function sets timer for increase or decrease light
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief LedDriver3 Click example
*
* # Description
* This app changes color and intensity of light.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Driver initialize.
*
* ## Application Task
* Changes color and intensity of light.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "leddriver3.h"
// ------------------------------------------------------------------ VARIABLES
static leddriver3_t leddriver3;
static log_t logger;
static leddriver3_rgb_t rgb;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
leddriver3_cfg_t cfg;
/**
* 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 ----\r\n" );
// Click initialization.
leddriver3_cfg_setup( &cfg );
LEDDRIVER3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
if ( LEDDRIVER3_INIT_ERROR == leddriver3_init( &leddriver3, &cfg ) )
{
log_info( &logger, "---- Init Error ----\r\n" );
log_info( &logger, "---- Run program again ----\r\n" );
for ( ; ; );
}
log_info( &logger, "---- Init Done ----\r\n" );
}
void application_task ( void )
{
rgb.red = 0x40;
rgb.green = 0x7F;
rgb.blue = 0x80;
leddriver3_set_intensity( &leddriver3, LEDDRIVER3_INCREMENT | LEDDRIVER3_INTENSITY_8 );
leddriver3_set_timer( &leddriver3, LEDDRIVER3_TIMER_8ms | LEDDRIVER3_TIMER_16ms );
leddriver3_set_color( &leddriver3, LEDDRIVER3_COLOR_RED );
Delay_ms( 1000 );
leddriver3_set_intensity( &leddriver3, LEDDRIVER3_CONSTANT | LEDDRIVER3_INTENSITY_16 );
leddriver3_set_color( &leddriver3, LEDDRIVER3_COLOR_PURPLE );
Delay_ms( 1000 );
leddriver3_set_color( &leddriver3, LEDDRIVER3_COLOR_BLUE );
Delay_ms( 1000 );
leddriver3_set_rgb_color( &leddriver3, &rgb );
Delay_ms( 1000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END