Thanks to the used proprietary technologies that allow high precision, reliability, and low power consumption, Ambient 6 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 6 click is the VEML7700, a high accuracy ambient light sensor (ALS) with I2C interface, from Vishay Semiconductors. This sensor utilizes several proprietary technologies to ensure accurate measurements of the light intensity, with the spectral response very close to a human eye. By utilizing a sensitive photo-diode, low noise amplifier, and a 16-bit A/D converter (ADC), this sensor can provide the data directly, with no need for complex calculations. The dynamic range for the ambient light sensor is very large, starting down from 0 lx up to about 167 klx, with the maximum resolution of only 0.005 lx/count. A high dynamic range along with a linear response to different light sources, allows this sensor to be placed behind a dark glass or panels made of other semi-transparent materials.
The VEML7700 sensor uses only six 16-bit registers, which makes it very simple to configure and use. Even though, it comes with the mikroSDK compatible library, which simplifies the development even more. However, more detailed explanation of each command can be found in the datasheet of the VEML7700, if required.
By using these six registers, the user can configure the Click board™ and the equipped VEML7700 sensor, fine-tuning it according to the requirements of the application. All the working parameters including the sensitivity, integration time, interrupt detection, persistence protection for the interrupt triggering, low and high threshold window for the interrupt, can all be set using these registers. Finally, the Ambient Light Sensing (ALS) result can be found here in 16-bit register 0x04. The data can be read or written in LSB/MSB format, using the 8-bit I2C interface.
A selectable sensitivity allows a very wide dynamic range for the ALS measurement. There are two ALS_SM bits, allowing the sensitivity to be set to 1/4, 1/8, 2, and 1 x ALS nominal sensitivity. This offers four different luminosity ranges to be covered for each selected integration time (ALS_IT). For example: the fastest integration time (25ms) results in the lowest resolution, and combined with the sensitivity of 1/8 x ALS, it allows the highest luminosity value to be measured.
The event detection engine allows optimized firmware to be developed. Although there is no dedicated interrupt pin on the VEML7700 IC, the software can still poll the status by reading two event flag bits. When any of the programmed light thresholds is exceeded for a programmed number of times (persistence protection), an interrupt event will be generated, asserting this pin to a LOW logic level. The interrupt pin is routed to the mikroBUS™ INT pin.
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 VEML7700 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 |
VEML7700, a high accuracy ambient light sensor (ALS) with I2C interface, from Vishay Semiconductors. |
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 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 6 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 |
3.3V |
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 6 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 initializes and defines I2C bus driver and driver functions which offer a choice to write data in registers and to read data from registers. Library also offers a choice to reads ambient data and ambient light in LUX. The user also has the function for configuration chip.
Key functions:
uint16_t ambient6_getAmbientData()
- Functions for read 16bit Ambient Data (ALS).
float ambient6_getAmbientLight()
- Functions for get Ambient Light Data.
void ambient6_configuration(uint16_t configData)
- Functions for configuration device for measurement.
Examples description
The application is composed of the three sections :
- System Initialization - Initializes I2C module.
- Application Initialization - Initialization driver init and default configuration device for measurement.
- Application Task - (code snippet) - Read Ambient Light in lux[lx] and this data logs to USBUART every 1sec.
void applicationTask()
{
char demoText[ 50 ];
float AmbientLight;
AmbientLight = ambient6_getAmbientLight();
FloatToStr(AmbientLight,demoText);
demoText[ 7 ] = 0;
mikrobus_logWrite(" Ambient Light : ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" lx", _LOG_LINE);
Delay_1sec();
}
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.