Our LED flashlight solution is designed to be your trusted light source in challenging conditions, offering extended runtime and superior performance
A
A
Hardware Overview
How does it work?
LED Flash 2 Click is based on the MIC2870, a synchronous boost flash LED driver from Microchip, which can be set to work in a Flash or Torch mode. It uses integrated inductive boost converter with 2 MHz switching frequency, which allows the use of a very small inductor and output capacitor. The operating mode can be set both with the dedicated pins and the I2C interface commands. The I2C interface is quite fast and it can operate up to 3.4 MHz. The I2C clock speed ensures fast communication and therefore minimal response time. This is a very important feature when used as a flashlight for the camera applications, where an instant reaction is needed. The click board comes equipped with the two XPCWHT-L1-R250, high brighness LED elements. When working in the Flash mode, the current through the single LED channel is maximized and determined by the resistors, connected to the FRSET input of the MIC2870 IC. On the Led Flash 2 click, the maximum current is set by the 10K
resistor, to 750mA per LED channel. This current can be additionally limited by selecting the desired flash current level percentage in the flash control register (01h). The flash safety timeout feature automatically shuts down the flash current, if the flash mode is enabled for an extended period of time. The timeout can be set by the corresponding bits in the flash control register (01h). For more information about the available registers and their values, consult the MIC2870 datasheet. Flash inhibition pin, or the FI pin - routed to the mikroBUS™ AN pin, with the corresponding bit in the Torch control register (02h), is used to limit the Flash mode current value to the Torch mode current value. This will effectively override the Flash mode. For the Torch mode operation, the current is set to a lower value than for the Flash mode - with the 10K resistor connected to the TRSET, this current is set to 187.5mA. Similar as for the Flash mode, the torch control register (02h) controls the percentage of
the current, set by the TRSET resistor. Rising edge on the TEN or FEN - routed to the mikroBUS™ INT and PWM pins, will activate the Torch mode or the Flash mode, respectively. These modes can also be activated by setting the corresponding bits in the control registers. EN pin - routed to the mikroBUS™ RST pin, along with the corresponding bit in the status register (00h), is used to enable the MIC2870 IC. Setting this pin to a HIGH logic level will put the IC into the standby state. Driving this pin low for more than 1 second - or setting the bit to a low state will put the MIC2870 IC into a shutdown mode, the lowest power consumption mode for this click board™. All the control pins are internally pulled to a LOW logic state, so there is no need to use any pull-down resistors for this purpose, which further simplifies application designs with this click board™.
Features overview
Development board
EasyAVR v7 is the seventh generation of AVR development boards specially designed for the needs of rapid development of embedded applications. It supports a wide range of 16-bit AVR microcontrollers from Microchip and has a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB. The development board is well organized and designed so that the end-user has all the necessary elements in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyAVR v7 allows you to connect accessory boards, sensors, and custom electronics more
efficiently than ever. Each part of the EasyAVR v7 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-12V AC or 9-15V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B)
connector. Communication options such as USB-UART and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets which cover a wide range of 16-bit AVR MCUs. EasyAVR v7 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
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
2048
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
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for LED Flash 2 Click driver.
Key functions:
ledflash2_read_register
- This function reads raw data from any registerledflash2_write_register
- This function writes data into any registerledflash2_toggle_flash_inhibit
- This function will set the flash inhibit pin to either 1 or 0
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 LedFlash2 Click example
*
* # Description
* This app demonstrate flash and torch mode on LED light.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes device and sets the click into "OFF" mode.
*
* ## Application Task
* This function will demonstrate how to use the flash mode,
* and the torch mode, with different power settings.
* It will then turn the click off.
*
* ## NOTE
* LED lights can be very bright, even on lowest power settings.
* Avoid looking directly into the light when click is in operation.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "ledflash2.h"
// ------------------------------------------------------------------ VARIABLES
static ledflash2_t ledflash2;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
ledflash2_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 ----" );
// Click initialization.
ledflash2_cfg_setup( &cfg );
LEDFLASH2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
ledflash2_init( &ledflash2, &cfg );
ledflash2_set_mode( &ledflash2, LEDFLASH2_MODE_OFF, 0, 0 );
log_printf( &logger, "Initialized...\r\n" );
}
void application_task ( void )
{
Delay_ms( 1000 );
log_printf( &logger, "Do not look directly into the led lights.\r\n" );
log_printf( &logger, "Triggering flash in 5...\r\n" );
Delay_ms( 1000 );
log_printf( &logger, "4...\r\n" );
Delay_ms( 1000 );
log_printf( &logger, "3...\r\n" );
Delay_ms( 1000 );
log_printf( &logger, "2...\r\n" );
Delay_ms( 1000 );
log_printf( &logger, "1...\r\n" );
Delay_ms( 1000 );
log_printf( &logger, "Cheese!\r\n" );
ledflash2_set_mode( &ledflash2, LEDFLASH2_MODE_FLASH, LEDFLASH2_CUR_50, LEDFLASH2_FTMR_312 );
Delay_ms( 350 );
ledflash2_set_mode( &ledflash2, LEDFLASH2_MODE_OFF, 0, 0 );
Delay_ms( 2000 );
log_printf( &logger, "Switching to the torch mode in a moment...\r\n" );
Delay_ms( 2000 );
ledflash2_set_mode( &ledflash2, LEDFLASH2_MODE_TORCH, LEDFLASH2_CUR_100, 0 );
Delay_ms( 3000 );
log_printf( &logger, "Dimming the torch light...\r\n" );
for ( uint8_t cnt = LEDFLASH2_CUR_100; cnt <= LEDFLASH2_CUR_18; cnt++ )
{
ledflash2_set_mode( &ledflash2, LEDFLASH2_MODE_TORCH, cnt, 0 );
Delay_ms( 500 );
}
Delay_ms( 1000 );
log_printf( &logger, "Switching off...\r\n" );
ledflash2_set_mode( &ledflash2, LEDFLASH2_MODE_OFF, 0, 0 );
log_printf( &logger, "------------------------------------------------\r\n" );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END