UV 4 click is a powerful Ultra Violet (UV) sensing device and Ambient Light Sensor (ALS) Click board™, featuring a sensor with a very wide dynamic range of detectable light intensity, across two ADC range settings. The UV diodes are matched to CIE erythema action spectrum, allowing a very accurate calculation of the UV index. The UV Index is standardized by the World Health Organization and it represents the strength of sunburn-producing (UV) radiation.
The UV/ALS sensor used on UV 4 click allows very flexible configuration of the measurement. It can be set and configured via the I2C interface, allowing various integration times, the configuration of the ADC sections, working modes, and other working parameters of the device. Featuring an accurate matched UV measurement elements, high dynamic range, optimized power consumption, an advanced internal engine with logical and comprehensive layout that allows simplified operation, this device is a perfect solution for building ALS or UV measurement applications, sun exposure protection devices, display backlighting control, prototyping of wearables, handsets, and various consumer electronics based on received ambient or UV light.
How does it work?
UV 4 click board is equipped with the Si1133, a UV index and ambient light sensor with I2C Interface, from Silicon Labs. This sensor features an integrated photo-elements array, used to sense the light intensity in a wide spectrum range, including the IR, visible and UV (UV-A and UV-B) wavelengths. Two integrated 23 bit A/D converters can be switched to sample any of the photo-sensing element types, allowing measurement under various light conditions, yielding a very wide dynamic range. The user is able to select between several light sensing configurations, to accommodate for low or high-intensity conditions. The sensing elements also include black photo-sensors used to provide readings of the dark current. The dark current is the current that flows through the photo-sensors in absence of light. For the improved accuracy and sensitivity, one of the ADCs can be configured to measure the dark current, allowing it to be subtracted from the final result of the measurement. The low-intensity measurements can also be obtained by adjusting the integration time. Typically, the integration time is 24.4 µs, but by increasing this time, it is possible to sense the light intensity down to 100mlx.
For the accurate measurement of the visible light and the near-human eye response, the IR spectrum component needs to be removed from the measurement. The Si1133 sensor allows for both the visible and IR light spectrum to be read on separate channels, allowing external signal processing. This is done to allow the flexibility, given the fact that the used overlay might block less or more IR compared to visible light.
The Si1133 IC contains an internal MCU with SRAM. The configuration of the Si1133 sensor is done via the parameters table, which is kept in the SRAM of the integrated MCU. While some I2C registers are accessed directly, the parameters table is accessed indirectly, via the I2C registers. The internal structure of the sensor is based on channels topology. Each channel is actually a set of user-defined tasks. Every channel contains parameters such as the output format (16bit or 24bit), a choice of photo-sensing elements, ADC gain, how often the measurements are made, and so on. There are also some general configuration settings, such as the list of enabled channels, the configuration of the two counters that can be used by the channels, and three threshold levels that can also be used by the channels. The structure of channels allows flexible configuration and operation of the device, one channel can be set to read the visible spectrum of the light, while the other can detect the IR portion, a channel can be set to read the dark current and so on. More information on the Si1133 registers and I2C communication can be found in the datasheet. However, the provided library contains mikroC, mikroBASIC, and mikroPASCAL functions, which can be used to simplify working with the UV 4 click. There is also an example application that demonstrates the use of these functions, which can be used as a reference for custom projects.
The device can work in several operational modes, allowing several power saving options: OFF mode, Initialization mode, Standby mode, Forced Conversion mode, and Autonomous mode. While the device is unpowered, it is basically in the OFF mode. After the power supply voltage reaches the operational level, the Initialization mode begins. It has to be completed prior to attempting I2C communication. Once the initialization is finished, the device works in the Standby mode, most often used mode of operations. Although measurement is not possible while in standby, the I2C communication is available. The Standby mode uses the least power, while still operational. If set to a Forced Conversion mode, one cycle of measurement will be triggered for the enabled channels and the interrupt can be asserted upon finishing the conversion process. The Autonomous mode is used for the continuous conversion of the measurement data, with the parameters set by the user. The output registers are constantly updated, and the interrupt can be set to alert the host MCU. The interrupt can be also triggered in the case when the intensity threshold is reached, saving the host MCU of having to constantly poll the sensor for data. The Autonomous mode uses the most power of all modes since the conversion is run constantly (with the user-defined frequency)
UV 4 click has the Si1133 interrupt pin routed to the standard INT pin of the mikroBUS™. This pin is set to a LOW logic level when asserted. The interrupt is also indicated by the interrupt status register, which can be used to locate the interrupt source. After reading it, the register will clear itself automatically. The interrupt pin is pulled to a HIGH logical level by the onboard resistors.
As explained, UV 4 click uses the I2C communication bus, with its pins routed to the respective mikroBUS™ pins – SCL is the I2C clock, while the SDA is the I2C data pin. These pins are also pulled to the HIGH level, by the onboard resistors. Having these resistors, the device is ready to be operated with no additional passive components, right out from the box.
Specifications
Type
Optical
Applications
It can be used for ALS or UV measurement applications, sun exposure protection devices, display backlighting control, prototyping of wearables, handsets, and various consumer electronics based on received ambient or UV light
On-board modules
Si1133, a UV index and ambient light sensor with I2C Interface, from Silicon Labs
Key Features
Advanced UV, visible light, and IR sensing, high dynamic range, high sensitivity, improved accuracy via the separate light component readings, 23bit dual ADC sections with selectable sources
Interface
I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on UV 4 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
UV 4 click specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
I2C Clock frequency | – | – | 400 | kHz |
Operating temperature | -40 | 25 | 85 | ˚C |
Processing time per measurement | – | 155 | – | μs |
High accuracy UV index sensor | 0 | – | 20 | uV |
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED indicator |
Software support
We provide a library for UV 4 click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers and mikroSDK. The provided click library is mikroSDK standard compliant. The demo application can run on all the main MikroElektronika development boards.
Library Description
Initializes and defines I2C driver and driver functions which offer a choice of writing in registers and reading from the registers. The library also has the ability for light measurements. The library can measure Small, Medium, and Large IR light, White and Large White light and UV and Deep UV light, whose values can be 16-bit or 24-bit. The library also offers a choice between channels that the user wants to measure desired light. For more details check the documentation.
Key functions:
UV4_RETVAL_T uv4_writeReg( const uint8_t reg_address, const uint8_t transfer_data )
- The function writes one-byte data in the register.
UV4_RETVAL_T uv4_readReg( const uint8_t reg_address, uint8_t *dataOut, const uint8_t inc_en, const uint8_t nBytes )
- The function reads a determined number of bytes from the register or repeats reading from one same register.
UV4_RETVAL_T uv4_writeParamData( uint8_t param_address, uint8_t transfer_data )
- The function writes one-byte data in the parameter table.void uv4_readMeasurements( uint32_t *measureOut )
- The function reads measured determined data from selected channel/channels when the measurement is completed on a selected channel.
Examples Description
- System Initialization – Initializes peripherals and pins.
- Application Initialization – Initializes I2C driver, performs reset command, enables
channels 0, 1 and 4 and configures channel 0 as 24-bit witch measures WHITE light,
channel 1 as 24-bit which measures Small IR light, and channel 4 as a 16-bit which
measures UV light. - Application Task – (code snippet) – Reads all configured measurements from selected channels and logs results on USB UART. Repeats operation every 500ms.
void applicationTask() { uv4_readMeasurements( &data_[ 0 ] ); for (i = 0; i < 6; i++) { if (configByte & pom) { if (opticalData[ i ] == _UV4_OPT_FUNC_SMALL_IR) mikrobus_logWrite( "Small IR: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_MEDIUM_IR) mikrobus_logWrite( "Medium IR: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_LARGE_IR) mikrobus_logWrite( "Large IR: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_WHITE) mikrobus_logWrite( "White: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_LARGE_WHITE) mikrobus_logWrite( "Large White: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_UV) mikrobus_logWrite( "UV: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_UV_DEEP) mikrobus_logWrite( "UV-Deep: ", _LOG_TEXT ); LongWordToStr( data_[ i ], text ); mikrobus_logWrite( text, _LOG_LINE ); } pom <<= 1; } mikrobus_logWrite( "", _LOG_LINE ); pom = 1; Delay_ms( 500 ); }
The full application code, and ready to use projects can be found on our Libstock page.
Other mikroE Libraries used in the example:
- Conversions
- I2C
- UART
Additional notes and information
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.