TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 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 (139060 times)
  2. FAT32 Library (71592 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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: 4945 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

M-Bus Slave click

5

M-Bus Slave Click is a Click boardâ„¢ equipped with the TSS721A, a single chip transceiver developed for Meter-Bus applications according to EN1434-3 standard, developed by Texas Instruments. The connection to the bus is polarity independent and serves as a slave node in the system.

[Learn More]

SE051 Plug n Trust Click

0

SE051 Plug&Trust Click is a compact add-on board representing a ready-to-use IoT security solution. This board features the SE051C2, an updatable extension of the EdgeLock™ SE050 from NXP Semiconductor, which delivers proven security certified to CC EAL 6+, with AVA_VAN.5up to the OS level. Designed for the latest IoT security requirements, it allows securely storing and provisioning credentials performing cryptographic operations, giving edge-to-cloud security capability right out of the box. It also provides upgrade functionality of the IoT applet while preserving on-device credentials, alongside reconfiguration possibility.

[Learn More]

Thermo 9 Click

5

Thermo 9 Click is a Click board equipped with the TSYS01, a digital temperature sensor from TE Connectivity. Given its main features, the Thermo 9 Click, can be used for industrial control, replacement of thermistors and NTCs, heating/cooling systems, and HVAC.

[Learn More]