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
Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand
functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,
which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.
Microcontroller Overview
MCU Card / MCU

Architecture
PIC32
MCU Memory (KB)
2048
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
524288
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 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
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
* \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 );
}
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:LED Drivers
































