The LTR-329ALS-01 offers six programmable gain settings, ranging from 1x up to 96x. This allows operating flexibility, as the sensor can be used in both very bright and very dim environments. Ambient 8 click can be used for a rapid development of various cost-effective applications that rely on light intensity sensing, including optical switches, backlight dimming applications for mobile and handheld devices, light metering applications (lux meters), and similar.
How does it work?
The main component of the Ambient 8 click is the LTR-329ALS-01, a high accuracy ambient light sensor (ALS) with I2C interface, from LiteOn. This sensor has an excellent IR filtering capability, offering a spectral response similar to a response of a human eye. By utilizing two sensitive photo-diodes (PDs), of which one is sensitive to IR light only, the ALS IC is able cancel out the effect of the IR light spectrum. The dynamic range for the ambient light sensor is very large, starting down from 0.01 lx up to about 64 klx. Besides two PDs, the IC incorporates a temperature compensation, and a logic section with the I2C interface. A high dynamic range along with a linear response over the entire range, allows this sensor to be placed behind a dark glass or panels made of other semi-transparent materials.
The LTR-329ALS-01 sensor uses a set of configuration registers, which allow very simple operation. By default, the ALS sensor is set to the standby mode. It does not perform any conversions until set up in the active mode. The Click board™ is supported by the mikroSDK compatible library, which simplifies the development by offering simple functions. However, more detailed explanation of each register and its function can be found in the datasheet of the LTR-329ALS-01.
There is also a set of four 8-bit output registers, which contain the conversion data from both PDs. Once the firmware starts reading their value, all four output registers will become locked, preventing any further changes. This allows for data consistency during the I2C reading sequence. There is also a status register, which indicates availability of new conversion data at the output registers. The output data is in LSB/MSB format, 16-bit value which is spread across two 8-bit registers.
There are two parameters that affect the overall sensing speed and the output rate: the LTR-329ALS-01 allows to set up both the integration time, and the measurement rate. The integration time improves the noise and the accuracy at the cost of reduced output data rate, while the measurement rate is the rate at which the measurements are made. The maximum value of the integration time is 350ms, while the slowest measurement rate is 2 seconds.
A selectable sensitivity allows a very wide dynamic range for the ALS measurement. There are three sensitivity bits, allowing the sensitivity to be set to six different values: 1x, 2x, 4x, 8x, 48x, and 96x. This offers six different luminosity ranges to be covered. When the gain is set to 1x, the ALS sensor can read the whole range from 1 lx up to 65535 lx (1 lx/LSB sensitivity). By increasing the gain setting, the resolution is increased, but the upper measurement limit is reduced. For example, gain 2x will reduce the maximum value to 32768 lx, resulting with 0.5 lx/LSB.
The Click board™ is supported by the mikroSDK library, which contains functions for simplified development. The mikroSDK functions are well-documented, but there is still a need, the datasheet of the LTR-329ALS-01 offers listing of all the registers and their specific functions.
The Click board™ is designed to work with 3.3V only. When using it with MCUs that use 5V levels for their communication, a proper level translation circuit should be used.
Specifications
Type |
Optical |
Applications |
It can be used for a rapid development of various cost-effective applications that rely on light intensity sensing, including optical switches, screen dimming applications for mobile and handheld devices, light metering applications (lux meters), and similar. |
On-board modules |
LTR-329ALS-01, a high accuracy ambient light sensor (ALS) with I2C interface, from LiteOn. |
Key Features |
High resolution and range of light intensity that can be measured, spectral response similar to human eye, low power consumption, compact design ideal for building of IoT applications, immune to flickering and fluorescent light sources, independent of the light source type, and more. |
Interface |
I2C |
Input Voltage |
3.3V |
Click board size |
M (42.9 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on Ambient 8 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes |
Pin |
|
Pin |
Notes |
---|
|
NC |
1 |
AN |
PWM |
16 |
NC |
|
|
NC |
2 |
RST |
INT |
15 |
NC |
|
|
NC |
3 |
CS |
RX |
14 |
NC |
|
|
NC |
4 |
SCK |
TX |
13 |
NC |
|
|
NC |
5 |
MISO |
SCL |
12 |
SCL |
I2C Clock |
|
NC |
6 |
MOSI |
SDA |
11 |
SDA |
I2C Data |
Power Supply |
3V3 |
7 |
3.3V |
5V |
10 |
NC |
|
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label |
Name |
Default |
Description |
---|
LD1 |
PWR |
- |
Power LED indicator |
Software support
We provide a library for the Ambient 8 click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library contains function for reading data from device registers Library contains function for writing data to device registers Libraty contains function for setting constants ( gain and integration time ) for Lux calculations Library contains function for device initialization Library contains function for reading ALS data ( channel 0 and channel 1 ) Library contains function for calculating Lux level based on ALS data from channels 0 and 1, window factor and IR factor.
Key functions:
void ambient8_setConstants( void )
- sets constants (gain and integration time) for lux level calculation.
void ambient8_init( void )
- initializes the device, sets gain to 8X, sets integration time to 400ms.
uint8_t ambient8_getLuxLevel( float * luxLevel_, float windowFactor_, float IRfactor_ )
- reads and data and performs lux level calculation.
Examples description
The application is composed of the three sections :
- System Initialization - Initializes LOG and I2C.
- Application Initialization - Initializes device and I2C driver.
- Application Task - Performs Lux calculation based on window and IR factor and log results.
void applicationTask( )
{
statusFlag = ambient8_getLuxLevel( &luxLevel, windowFactor, IRfactor );
if (statusFlag == 0)
{
mikrobus_logWrite( "lux Level : ", _LOG_TEXT );
FloatToStr( luxLevel, text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " lx", _LOG_LINE );
mikrobus_logWrite( " ", _LOG_LINE );
}
}
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This click board is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.