TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139566 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57256 times)
  4. USB Device Library (47615 times)
  5. Network WiFi Library (43219 times)
  6. FT800 Library (42566 times)
  7. GSM click (29930 times)
  8. mikroSDK (28292 times)
  9. PID Library (26933 times)
  10. microSD click (26309 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 5 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: Optical

Downloaded: 104 times

Not followed.

License: MIT license  

UV 5 Click is a compact add-on board that can measure UV radiation. This board features the AS7331, a spectral UVA/B/C sensor from ams. The sensor can measure UVA, UVB, and UVC, which are the main types of UV rays from the UV radiation of the sunlight. It uses ADC with a high dynamic range (16… 24-bit) for measurements from low to high radiation conditions and has a high sensitivity, which makes it usable for fluorescence light conditions.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "UV 5 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "UV 5 Click" changes.

Do you want to report abuse regarding "UV 5 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


UV 5 Click

UV 5 Click is a compact add-on board that can measure UV radiation. This board features the AS7331, a spectral UVA/B/C sensor from ams. The sensor can measure UVA, UVB, and UVC, which are the main types of UV rays from the UV radiation of the sunlight. It uses ADC with a high dynamic range (16… 24-bit) for measurements from low to high radiation conditions and has a high sensitivity, which makes it usable for fluorescence light conditions.

uv5_click.png

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Sep 2023.
  • Type : I2C type

Software Support

We provide a library for the UV 5 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for UV 5 Click driver.

Standard key functions :

  • uv5_cfg_setup Config Object Initialization function.

    void uv5_cfg_setup ( uv5_cfg_t *cfg );
  • uv5_init Initialization function.

    err_t uv5_init ( uv5_t *ctx, uv5_cfg_t *cfg );
  • uv5_default_cfg Click Default Configuration function.

    err_t uv5_default_cfg ( uv5_t *ctx );

Example key functions :

  • uv5_get_rdy_pin UV 5 get READY pin state function.

    uint8_t uv5_get_rdy_pin ( uv5_t *ctx );
  • uv5_sw_reset UV 5 software reset function.

    err_t uv5_sw_reset ( uv5_t *ctx );
  • uv5_channel_uva_read UV 5 read raw UVA data function.

    err_t uv5_channel_uva_read ( uv5_t *ctx, uint16_t *uva_data );

Example Description

This example demonstrates the use of UV 5 Click board by measuring the light irradiance of the UVA, UVB and UVC.

The demo application is composed of two sections :

Application Init

Initializes the driver, and performs the Click default configuration.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    uv5_cfg_t uv5_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    uv5_cfg_setup( &uv5_cfg );
    UV5_MAP_MIKROBUS( uv5_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == uv5_init( &uv5, &uv5_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( UV5_ERROR == uv5_default_cfg ( &uv5 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Measuring light irradiance level by reading data from the UV 5 Click board approximately every 4 seconds and displaying it using UART Serial terminal.

void application_task ( void ) 
{
    float temp_data; 
    uint16_t uv_raw_data; 
    float uv_data; 

    if ( uv5_get_rdy_pin( &uv5 ) == 1 )
    {
        uv5_temperature_read( &uv5, &temp_data );
        log_printf( &logger, " Temp: %.2f degC\r\n", temp_data );

        uv5_channel_uva_read( &uv5, &uv_raw_data );
        uv_data = ( float ) ( ( FSRE_UVA / OUTCONV ) * uv_raw_data );
        log_printf( &logger, " UVA: %.2f uW/cm2 \r\n", uv_data );

        uv5_channel_uvb_read( &uv5, &uv_raw_data );
        uv_data = ( float ) ( ( FSRE_UVB / OUTCONV ) * uv_raw_data );
        log_printf( &logger, " UVB: %.2f uW/cm2 \r\n", uv_data );

        uv5_channel_uvc_read( &uv5, &uv_raw_data );
        uv_data = ( float ) ( ( FSRE_UVC / OUTCONV ) * uv_raw_data );
        log_printf( &logger, " UVC: %.2f uW/cm2 \r\n", uv_data );
        log_printf( &logger, " =================== \r\n" );
    }
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.UV5

Additional notes and informations

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. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

RTC 18 Click

0

RTC 18 Click is a compact add-on board that accurately keeps the time of a day. This board features the RV-3032-C7, an I2C-configurable real-time clock module that incorporates an integrated CMOS circuit and an XTAL from Micro Crystal AG. The RV-3032-C7 is a temperature compensated RTC with premium accuracy (0.22 sec/day) and extremely low power consumption, allowing it to be used with a single button cell battery for an extended period. It can measure temperature with a typical accuracy of ±1°C and a resolution of 0.0625°C/step with a programmable alarm on top and bottom temperature limits. It features standard RTC functions with automatic leap year correction, and standard interrupt for Periodic Countdown Timer and Periodic Time Update (seconds, minutes), date/hour/minute alarm, and an external event.

[Learn More]

Buck 16 Click

0

Buck 16 Click is a compact add-on board that contains a DC-DC power converter that steps down the voltage from its input to its output. This board features the TPS62912, a high-efficiency, low noise, and low ripple current-mode synchronous buck converter from Texas Instruments.

[Learn More]

Pressure 19 Click

0

Pressure 19 Click is a compact add-on board that contains a board-mount pressure sensor. This board features the MLX90817, a factory-calibrated absolute pressure sensor delivering ratiometric analog output from Melexis Technologies. The MLX90817 comes with a configurable host interface that supports I2C serial communication and configurable signal processing (the user is allowed to process the output signal in analog or digital form). It measures pressure from 0.2 up to 3bar with a pressure accuracy of ±33mbar. Its DSP-based architecture using a 16bit microcontroller provides outstanding performance in terms of initial accuracy and assures operation in a temperature range of -40°C to +120°C, ensuring stable operation under extreme conditions.

[Learn More]