Enable easy control and customization of LED-based features in your electronic gadgets with our flexible LED driver
A
A
Hardware Overview
How does it work?
LED Driver 6 Click is based on the AL1781, a single-channel PWM dimmable linear LED driver by Diodes Incorporated. It is a constant-current driver, which can sink up to 1500mA. It has a low-side current sink, which allows LED strips or LED bulbs to be connected in the common-anode topology for increased effectiveness and power optimization. The constant current through the connected LED can be selected by an SMD jumper labeled as ILED between two values: 1A and 1.5A. The AL1781 IC can be operated with a PWM signal in the frequency range from 1kHz to 40kHz. Applying the PWM signal with a duty cycle of less than 4ms makes it possible to tune the light intensity of the connected LED light element. A LOW pulse width of more than 4ms will set the device into the low-power mode (suspend). The lowest light intensity that can be reached by applying the PWM frequency of 1kHz is 0.1%, while 40kHz allows the lowest brightness level of 4% of the full light intensity. A High PWM frequency allows for less visible flickering but simultaneously limits the lowest light intensity level. PWM1 and PWM2 pins of the AL1781 are routed to the mikroBUS™ PWM and CS pins and are labeled as PW1 and PW2. Adaptive Thermal Management (ATM) scheme is one of the key features of the AL1781. It can be used to optimize the power
consumption by adjusting the voltage of the external power supply unit (PSU): the excessive voltage applied to the connected LED will be dissipated as heat within the AL1781 IC. Therefore, the voltage level of the external PSU should be kept above the forward voltage of the connected LED plus minimum voltage headroom (VF + VLED_REG). The ATM injects current through the LEDPG pin of the AL1781. This current is converted to a voltage level, and it is sampled by the MCP3221, a low-power 12-bit A/D converter with an I2C interface, by Microchip. It has its I2C pins routed to the respective mikroBUS™ I2C pins, allowing the host MCU to read the LEDPG voltage and adjust the PSU voltage. Please note that if an external PSU with no external regulation is used, its voltage should stay within the mentioned range (VF of the connected LED element + VLEDx_REG as per AL1781 datasheet). However, the voltage should always stay below 30V. The AL1781 IC also integrates many protection features for increased reliability: undervoltage, open or short circuit at the output, and thermal protection. If any of these protections become activated, a fault event will be reported on a dedicated pin labeled FAULTB. This pin is routed to the mikroBUS™ INT pin and is asserted to a LOW logic level when a fault event occurs. Deep Dimming
Capability helps with power efficiency. Subjective perception of the light intensity differs from the measured light. For example, the light intensity of 10% (with respect to the applied duty cycle) is perceived as 32% of the full light intensity. Deep Dimming Capability helps with energy saving, providing an optimal light output. Deep Dimming down to 0.1% is possible with the AL1781 IC since it can be operated with a pulse width as low as 1µS while still providing good linearity. LED driver 6 Click is designed to use an external PSU and an MCU. The full potential of the LED driver 6 Click is achieved when combined with a dedicated ambient light sensing Click board™ such as Ambient 5 Click: by receiving information about the ambient light intensity from Ambient 5 Click, the MCU can generate PWM signal with respect to the required intensity tuning and send it to LED driver 6 Click to regulate the intensity of the ambient lighting. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
Fusion for TIVA v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 32-bit ARM® Cortex®-M based MCUs from Texas Instruments, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over a WiFi network. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for TIVA v8 provides a fluid and immersive working experience, allowing access
anywhere and under any circumstances at any time. Each part of the Fusion for TIVA v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for TIVA v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development 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-M4
MCU Memory (KB)
1024
Silicon Vendor
Texas Instruments
Pin count
212
RAM (Bytes)
262144
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for LED Driver 6 Click driver.
Key functions:
leddriver6_set_duty_cycle
- Generic sets PWM duty cycleleddriver6_pwm_stop
- Stop PWM moduleleddriver6_pwm_start
- Start PWM module.
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 Leddriver6 Click example
*
* # Description
* This application designed to be used in tunable Smart Connected Lighting applications.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes I2C driver and PWM driver for the LED driver 6 control.
*
* ## Application Task
* This is an example that demonstrates the use of the LED Driver 6 Click board.
* This example shows the automatic control LED light intensity,
* the first intensity of light is rising and then the intensity of light is falling.
* Results are being sent to the Usart Terminal where you can track their changes.
*
* @author Nikola Peric
*
*/
#include "board.h"
#include "log.h"
#include "leddriver6.h"
static leddriver6_t leddriver6;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_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... ----" );
leddriver6_cfg_t leddriver6_cfg;
// Click initialization.
leddriver6_cfg_setup( &leddriver6_cfg );
LEDDRIVER6_MAP_MIKROBUS( leddriver6_cfg, MIKROBUS_1 );
if ( leddriver6_init( &leddriver6, &leddriver6_cfg ) == LEDDRIVER6_INIT_ERROR )
{
log_info( &logger, "---- Application Init Error. ----" );
log_info( &logger, "---- Please, run program again... ----" );
for ( ; ; );
}
log_info( &logger, "---- Application Init Done. ----" );
leddriver6_set_duty_cycle ( &leddriver6, 0.0 );
if ( leddriver6_pwm_start( &leddriver6 ) == LEDDRIVER6_INIT_ERROR )
{
log_info( &logger, "---- PWM can't be started. ----" );
log_info( &logger, "---- Please, run program again... ----" );
for ( ; ; );
}
log_info( &logger, "---- PWM is started. ----" );
log_info( &logger, "---- Application Task ----" );
Delay_ms( 500 );
}
void application_task ( void )
{
static int8_t duty_cnt = 1;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
leddriver6_set_duty_cycle ( &leddriver6, duty );
log_printf( &logger, "Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
Delay_ms( 500 );
if ( 10 == duty_cnt )
{
duty_inc = -1;
}
else if ( 0 == duty_cnt )
{
duty_inc = 1;
}
duty_cnt += duty_inc;
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END