TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 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 (137035 times)
  2. FAT32 Library (70167 times)
  3. Network Ethernet Library (56037 times)
  4. USB Device Library (46360 times)
  5. Network WiFi Library (41974 times)
  6. FT800 Library (41304 times)
  7. GSM click (29079 times)
  8. mikroSDK (26519 times)
  9. PID Library (26452 times)
  10. microSD click (25449 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: 4612 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

Speed Radar click

0

Speed Radar Click is a compact add-on board that comes with a radar motion detector. This board features the K-LD2, a radar transceiver from RFbeam. It is a 24GHz radar with a detection distance for humans of up to 15m and cars of up to 30m. Its digital structure makes it easy to use in an MCU-based application or as a standalone device where movement detection or even a speed measurement is required.

[Learn More]

Current click

0

Current click is an add-on board used for measurement of electric current. It features INA196 current shunt monitor, MCP3201 12-bit ADC, MAX6106 voltage reference as well as two screw terminals.

[Learn More]

ISO ADC click

0

The ISO ADC Click is add-on board current-shunt measurement device with isolated delta-sigma modulator. This Click board™ is based on AMC1204BDWR provide a single-chip solution for measuring the small signal of a shunt resistor across an isolated barrier from Texas Instruments. ISO ADC Click contains shunt resistor, these types of resistors are typically used to sense currents in motor control inverters, green energy generation systems, and other industrial applications.

[Learn More]