TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (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 (136530 times)
  2. FAT32 Library (69724 times)
  3. Network Ethernet Library (55837 times)
  4. USB Device Library (46168 times)
  5. Network WiFi Library (41797 times)
  6. FT800 Library (40984 times)
  7. GSM click (28920 times)
  8. PID Library (26383 times)
  9. mikroSDK (26276 times)
  10. microSD click (25297 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: 4531 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

UPS 3 click

0

UPS 3 Click is a compact add-on board that represents a bidirectional active charge/balancing solution. This board features the LTC3110, a bidirectional buck-boost DC/DC regulator/charger combination with selectable operation modes for charging and system backup from Analog Devices. It can autonomously transition from Charge to Backup mode or switch modes based on an external command. A proprietary low noise switching algorithm optimizes efficiency with capacitor/battery voltages above, below, or equal to the system output voltage. Additional features include voltage supervisors for direction control and end of a charge and a general-purpose comparator with open-collector output for interfacing with MCU. This Click board™ is suitable for a backup power source for a wide range of battery-operated embedded applications.

[Learn More]

RTC 4 click

5

RTC4 click has an integrated backup energy source that maintains a charge with an onboard coin cell supercapacitor. Being a 1-Wire click board, RTC4 click can operate in a microLAN network (a network of 1-Wire devices that are all associated with a master device).

[Learn More]

I2C to SPI click

5

I2C to SPI Click is an all-in-one solution which allows serving as an interface between a standard I2C-bus of a microcontroller and an SPI bus, which allows the microcontroller to communicate directly with SPI devices through its I2C-bus.

[Learn More]