TOP Contributors

  1. MIKROE (2745 codes)
  2. Alcides Ramos (371 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (138914 times)
  2. FAT32 Library (71500 times)
  3. Network Ethernet Library (56914 times)
  4. USB Device Library (47269 times)
  5. Network WiFi Library (42993 times)
  6. FT800 Library (42282 times)
  7. GSM click (29724 times)
  8. mikroSDK (27668 times)
  9. PID Library (26828 times)
  10. microSD click (26087 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

UV 4 click

Rating:

5

Author: MIKROE

Last Updated: 2018-04-18

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optical

Downloaded: 4924 times

Not followed.

License: MIT license  

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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "UV 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "UV 4 click" changes.

Do you want to report abuse regarding "UV 4 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

UV 4 click

UV 4 click

Native view of the UV 4 click board.

View full image
UV 4 click

UV 4 click

Front and back view of the UV 4 click board.

View full image

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 );
}

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.

ALSO FROM THIS AUTHOR

GNSS 16 click

0

GNSS 16 Click is a compact add-on board that delivers meter-level accuracy in urban environments. This Click board™ features the NEO-F10N-00B, a professional-grade L1/L5 dual-band GNSS receiver from u-blox. It features dual-band multipath mitigation technology to ensure robust signal reception and supports multiple GNSS systems, including GPS, Galileo, and BeiDou. Configurable for specific constellations, it optimizes power consumption while maintaining high performance.

[Learn More]

microSD click

0

Need more additional memory? We've got just the thing for you - microSD click. It features a microSD card slot for microSD cards used as a mass storage media for portable devices. microSD click is designed to run on 3.3V power supply. Industry standard SPI interface ensures simple communication at high data rates. Use it for reading or storing data like music, text files, videos and more.

[Learn More]

Ambient 8 click

5

Ambient 8 click is equipped with the ambient light sensor (ALS) IC, providing measurements of the ambient light intensity in a digital format. It utilizes the LTR-329ALS-01, an ALS with the I2C interface.

[Learn More]