How does it work?
Ambient 21 Click is based on the TSL2591, a high-sensitivity light-to-digital converter from ams AG. The TSL2591 provides ambient light sensing (ALS) that approximates the human eye response to light intensity under various lighting conditions and through different attenuation materials. It has a flexible and wide operating range of up to 88klx with the highest sensitivity of 188μlx, even when mounted behind dark glass. This sensor comes in a UV-rejection package enabling its operation in IR light environments making this board most suitable for various brightness control functions, helping to reduce power consumption.
The TSL2591 contains two integrating analog-to-digital converters (ADC) that integrate currents from two photodiodes, one broadband photodiode (visible plus infrared) and one infrared-response photodiode. These ADCs convert the photodiode currents into a digital output representing the irradiance measured on each channel. Ambient 21 Click communicates with an MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting Standard Mode operation with a clock frequency of 100kHz and Fast Mode up to 400kHz.
Integration of both channels co-occurs. Upon completion of the conversion cycle, the conversion result is transferred to the appropriate channel data registers. The transfers are double-buffered to ensure that the integrity of the data is maintained. After the transfer, the device automatically begins the next integration cycle. This sensor also supports an interrupt feature, routed to the INT pin on the mikroBUS™ socket, that simplifies and improves system efficiency by eliminating the need to poll a sensor for a light intensity value. The purpose of the interrupt function is to detect a meaningful change in light intensity, where the user can define the concept of a significant change in light intensity and time or persistence. Users can define a threshold above and below the current light level, where an interrupt generates when the conversion value exceeds either of these limits.
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. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Specifications
Type
Optical
Applications
Can be used for obtaining ambient light data in applications such as automatic residential and commercial lighting management
On-board modules
TSL2591 – light-to-digital converter from ams AG
Key Features
Low power consumption, corresponds to a dark window because of high sensitivity, close responsivity to the human eye, I2C interface, wide and flexible operational range, stable performance over temperature, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on Ambient 21 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 |
Ambient 21 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
Spectral Range | 0 | – | 88.000 | lx |
Wavelength | 400 | – | 1.000 | nm |
Software Support
We provide a library for the Ambient 21 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 Ambient 21 Click driver.
Key functions
-
ambient21_get_int_pin
This function returns the INT pin logic state. -
ambient21_read_raw_data
This function checks if the data is ready and then reads the raw ADC data from two channels. -
ambient21_measure_light_level
This function reads the raw ADC data from two channels and then measures the light level in lux based on those readings.
Example Description
This example demonstrates the use of Ambient 21 Click board™ by measuring the ambient light level in Lux.
void application_task ( void )
{
uint16_t lux;
if ( !ambient21_get_int_pin ( &ambient21 ) )
{
if ( AMBIENT21_OK == ambient21_measure_light_level ( &ambient21, &lux ) )
{
log_printf ( &logger, " Ambient light level [Lux]: %urnn", lux );
}
}
}
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.Ambient21
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. A UART terminal is available in all Mikroe compilers.
mikroSDK
This Click board™ is supported by a mikroSDK – Mikroe Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.