Our UV sensing solution empowers you to capture, measure, and analyze UV rays with unrivaled precision, opening doors to applications in health, safety, and scientific discovery
A
A
Hardware Overview
How does it work?
UV4 Click is based on 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.
Features overview
Development board
Nucleo-64 with STM32F446RE MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin
headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is
provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.
Microcontroller Overview
MCU Card / MCU

Architecture
ARM Cortex-M4
MCU Memory (KB)
512
Silicon Vendor
STMicroelectronics
Pin count
64
RAM (Bytes)
131072
You complete me!
Accessories
Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
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
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for UV4 Click driver.
Key functions:
uv4_write_reg
- This function write one byte of data to given addressuv4_read_reg
- This function reads determined number of bytes from given addressuv4_write_param_data
- This function writes one byte of data in parameter table
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 UV4 Click example
*
* # Description
* This application reads configured measurements from selected channels, and
* then logs them.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes 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 witch measures Small IR light, and channel 4 as 16-bit witch
* measures UV light.
*
* ## Application Task
* Reads all configured measurements from selected channels
* and logs results on USB UART. Repeats operation every 500ms.
*
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "uv4.h"
// ------------------------------------------------------------------ VARIABLES
static uv4_t uv4;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
uv4_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.
uv4_cfg_setup( &cfg );
UV4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
uv4_init( &uv4, &cfg );
uv4_default_cfg( &uv4 );
}
void application_task ( void )
{
uint8_t cnt;
uint8_t pom = 1;
uint32_t data_r[ 6 ];
uv4_read_measurements( &uv4, &data_r[ 0 ] );
for ( cnt = 0; cnt < 6; cnt++ )
{
if ( uv4.config_byte & pom )
{
switch ( uv4.optical_data[ cnt ] )
{
case UV4_OPT_FUNC_SMALL_IR:
{
log_printf( &logger, "Small IR: " );
break;
}
case UV4_OPT_FUNC_MEDIUM_IR:
{
log_printf( &logger, "Medium IR: " );
break;
}
case UV4_OPT_FUNC_LARGE_IR:
{
log_printf( &logger, "Large IR: " );
break;
}
case UV4_OPT_FUNC_WHITE:
{
log_printf( &logger, "White : " );
break;
}
case UV4_OPT_FUNC_LARGE_WHITE:
{
log_printf( &logger, "Large White: " );
break;
}
case UV4_OPT_FUNC_UV:
{
log_printf( &logger, "UV: " );
break;
}
case UV4_OPT_FUNC_UV_DEEP:
{
log_printf( &logger, "UV-Deep: " );
break;
}
default:
{
break;
}
}
log_printf( &logger, "%d\r\n", data_r[ cnt ] );
}
pom <<= 1;
}
Delay_ms ( 500 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END