Prices incl. GST
Out of Stock.
- Product Code: MIKROE-2378
- MPN: MIKROE-2378
UV 2 click is a mikroBUS™ add-on board with a VEML6075 UVA and UVB light sensor. VEML6075 is a CMOS chip that incorporates a photodiode, amplifiers, and analog/digital circuits.
With UV 2 click, Solar ultraviolet light intensity is converted to 16-bit digital values. UVA and UVB are in separate channels. To keep a stable output in changing temperature conditions, the chip has temperature compensation capabilities. This ensures reliable performance under long term UV exposure.
The sensor has a specified UVA sensitivity of 365 nm and UVB sensitivity of 315 nm
The board communicates with the target MCU through the mikroBUS™ I2C interface. Designed to use a 3.3 power supply only.
Specification
Type | Optical |
Applications | Systems that warn of excessive UV exposure, or industrial applications where UV is used for sterilization |
On-board modules | VEML6075 UVA and UVB light sensor |
Key Features | UVA sensitivity: 365 nm; UVB sensitivity 315 nm |
Key Benefits | Temperature compensation for long-term reliability |
Interface | I2C |
Input Voltage | 3.3V |
Compatibility | mikroBUS |
Click board size | S (28.6 x 25.4 mm) |
Features and usage notes
The sensor has a specified UVA sensitivity of 365 nm and UVB sensitivity of 315 nm). Measurement results are stored in four separate registers. The last result read will remain in the register until a new measurement is loaded. In addition to UVA and UVB it has UVD (a dummy channel for dark current cancellation), UVcomp1, and UVcomp2. All registers are accessible via I2C communication.
The board communicates with the target MCU through the mikroBUS™ I2C interface. Both standard (100 kHz) and fast (400 kHz) I2C is supported. Designed to use a 3.3 power supply only.
The chip vendor provides a separate Application Note sheet with detailed specifications on how to derive UV radiation values from the sensor readings. For reference, here we provide an explanation of UVA and UVB, taken from the Application Note sheet:
The UVB rays - wavelengths ranging from 280 nm to 320 nm - are extremely energetic and harmful for the skin to the extent that they are responsible for 65 % of skin tumors. Thankfully, only 0.1 % of the solar energy that arrives on the earth’s surface is in the shape of UVB radiation.
The UVA rays - wavelengths ranging from 320 nm to 400 nm - are less powerful than the previous ones, but highly penetrating. They are capable of reaching the skin, becoming responsible for photoaging and promoting the onset of different forms of skin cancer. 4.9 % of the solar energy is made up of UVA rays.
Programming
Code starts up the UV 2 click, reads the UV index and prints it out on the TFT board.
1 #include2 #include "resources.h" 3 4 uint8_t uv2_get_8bit(uint8_t reg) 5 { 6 uint8_t tempreg = reg; 7 uint8_t temp = 0; 8 I2C1_Start(); 9 I2C1_Write(0x10, &tempreg,1,END_MODE_RESTART); 10 I2C1_Read(0x10,&temp,1, END_MODE_STOP); 11 } 12 13 uint16_t uv2_get_16bit (uint8_t reg) 14 { 15 uint8_t temp[2] = {0}; 16 uint16_t retval = 0; 17 uint8_t tempreg = reg; 18 19 I2C1_Start(); 20 I2C1_Write(0x10, &tempreg,1,END_MODE_RESTART); 21 I2C1_Read(0x10,temp,2, END_MODE_STOP); 22 23 retval = (uint16_t) temp[0]; 24 retval |= ((uint16_t) temp[1]) << 8; 25 26 return retval; 27 } 28 29 float get_uv_index() 30 { 31 float UVA = 0.0; 32 float UVB = 0.0; 33 float UVcomp1 = 0.0; 34 float UVcomp2 = 0.0; 35 float UVD = 0.0; 36 float UVAcomp = 0.0; 37 float UVBcomp = 0.0; 38 float UVI = 0.0; 39 float UVAresp = 0.0011; 40 float UVBresp = 0.00125; 41 42 float a = 3.33; 43 float b = 2.5; 44 float c = 3.66; 45 float d = 2.75; 46 47 UVA = (float) uv2_get_16bit(0x07); 48 UVD = (float) uv2_get_16bit(0x08); 49 UVB = (float) uv2_get_16bit(0x09); 50 UVcomp1 = (float) uv2_get_16bit(0x0A); 51 UVcomp2 = (float) uv2_get_16bit(0x0B); 52 53 UVAcomp = ( UVA - UVD ) - a * ( UVcomp1 - UVD ) - b * ( UVcomp2 - UVD ); 54 UVBcomp = ( UVB - UVD ) - c * ( UVcomp1 - UVD ) - d * ( UVcomp2 - UVD ); 55 56 UVI = ( (UVBcomp * UVBresp) + (UVAcomp * UVAresp) ) / 2; 57 58 return UVI; 59 } 60 61 void InitMCU() 62 { 63 I2C1_Init_Advanced(100000, &_GPIO_MODULE_I2C1_PB67); 64 Delay_ms(100); 65 } 66 67 void DrawFrame() { 68 TFT_Init_ILI9341_8bit(320, 240); 69 TFT_Fill_Screen(CL_WHITE); 70 TFT_Set_Pen(CL_BLACK, 1); 71 TFT_Line(20, 220, 300, 220); 72 TFT_LIne(20, 46, 300, 46); 73 TFT_Set_Font(&HandelGothic_BT21x22_Regular, CL_RED, FO_HORIZONTAL); 74 TFT_Write_Text("UV2 Click Board Demo", 25, 14); 75 TFT_Set_Font(&Verdana12x13_Regular, CL_BLACK, FO_HORIZONTAL); 76 TFT_Write_Text("EasyMx PRO v7 for STM32", 19, 223); 77 TFT_Set_Font(&Verdana12x13_Regular, CL_RED, FO_HORIZONTAL); 78 TFT_Write_Text("www.mikroe.com", 200, 223); 79 TFT_Set_Font(&TFT_defaultFont, CL_BLACK, FO_HORIZONTAL); 80 } 81 82 void main() 83 { 84 float uvindex = 0.0; 85 char read[3]; 86 uint16_t read16 = 0; 87 int setup[3]; 88 char txt[20]; 89 90 DrawFrame(); 91 92 setup[0] = 0x00; 93 setup[1] = 0x00; 94 setup[2] = 0x00; 95 96 InitMCU(); // Initialize MCU 97 98 I2C1_Start(); 99 I2C_Write(0x10, setup, 2, END_MODE_STOP); 100 101 while(1) 102 { 103 uvindex = get_uv_index(); 104 floattostr(uvindex, txt); 105 106 TFT_Set_Font(&TFT_defaultFont, CL_BLACK, FO_HORIZONTAL); 107 TFT_Write_Text(txt, 30, 100); 108 109 delay_ms(500); 110 TFT_Set_Font(&TFT_defaultFont, CL_WHITE, FO_HORIZONTAL); 111 TFT_Write_Text(txt, 30, 100); 112 } 113 114 }
Code examples that demonstrate the usage of UV 2 click with MikroElektronika hardware, written for mikroC for ARM, AVR, dsPIC, FT90x, PIC and PIC32 are available on Libstock