Introduction

This is a sensor capable of directly outputting the Ultraviolet (UV) index. It can detect UV intensity within the wavelength range of 240-370nm, covering UVA, UVB, and UVC wavelength ranges. Its primary wavelength is concentrated in the UVB segment, making it commonly used for skin health assessment and UV index monitoring.

Through the underlying MCU calculations, the UV Index 240370 Sensor can directly output a UV index rating from 0-11, requiring no conversions to obtain an accurate UV index. It also provides a harm risk warning ranging from 1-5, facilitating effective protective measures.

This sensor supports both I2C and UART data output modes, making it compatible with the vast majority of master control data readings.

Ultraviolet (UV) Light: A Scientific Overview

What is Ultraviolet Light?

Ultraviolet (UV) light is a form of invisible electromagnetic radiation, with a wavelength shorter than visible light but longer than X-rays. Its wavelength typically ranges from 10 nanometers (nm) to 400 nm. UV light can be divided into three main types according to its wavelength: UVA, UVB, and UVC.

  1. Biological Impact:
  • UVA (320-400nm): The most common type, UVA has the strongest penetration and can infiltrate the dermis layer of the skin. Prolonged exposure may lead to skin aging, wrinkles, and skin cancer.

  • UVB (280-320nm): With weaker penetration, UVB primarily affects the epidermis layer of the skin. It is the primary cause of sunburn, an important source for the synthesis of Vitamin D, but can also lead to skin cancer.

  • UVC (100-280nm): Possessing the strongest germicidal effects, UVC is typically absorbed by the Earth's atmosphere and does not reach the surface. However, artificial UVC light sources, such as disinfection lamps, are widely used in industrial and medical applications.

  1. Role in Nature:
  • Synthesis of Vitamin D: UV light aids in the skin's synthesis of Vitamin D, which is crucial for bone health.

  • Ecosystem: UV light affects photosynthesis and the growth cycle of plants, playing a crucial role in ecological balance.

  1. Dangers of UV Light:
  • Skin Damage: UV light can damage the DNA of skin cells, increasing the risk of skin cancer.

  • Eye Damage: Prolonged exposure to UV light can lead to cataracts, keratitis, and other eye diseases.

  • Immune System Suppression: Excessive UV light can potentially affect the normal function of the immune system.

Ultraviolet (UV) Index Ranges and Health Recommendations

  1. 0-2: Low Risk
  • Health Impact: For most people, the impact of UV radiation on health is minimal.

  • Advice: Even in such low-risk situations, basic protective measures like wearing sunglasses can be taken.

  1. 3-5: Moderate Risk
  • Health Impact: The impact of UV radiation on health begins to become significant, particularly under prolonged exposure.

  • Advice: When engaging in outdoor activities, it is advisable to take protective measures such as using sunscreen, wearing sun-protective clothing, and sunglasses.

  1. 6-7: High Risk
  • Health Impact: The impact of UV radiation on health is considerable, potentially causing sunburn and eye damage.

  • Advice: Avoid prolonged exposure to the sun during peak hours (10:00 AM to 4:00 PM). Wear protective clothing, use high SPF sunscreen, and wear sunglasses.

  1. 8-10: Very High Risk
  • Health Impact: The impact of UV radiation on health is extremely significant, with a high risk of sunburn.

  • Advice: Try to avoid prolonged activity under the sun. Take comprehensive protective measures, including wearing sun-protective clothing, applying high SPF sunscreen, wearing a hat and sunglasses, especially during intense sunlight periods.

  1. 11+: Extreme Risk
  • Health Impact: The UV radiation is extremely intense, capable of causing severe sunburn in a short time.

  • Advice: Try to avoid activities under the sun, especially during peak hours. Take all possible protective measures and stay in the shade as much as possible.

Features

  • UV wavelength range of 240-370nm

  • High-performance UV sensor chip, offering reliable quality

  • Directly outputs UV index and harm level, requiring no conversion

  • Supports a voltage and level range of 3.3V-5V

  • Supports both I2C and UART communication methods

Application

  • Environmental Monitoring: Utilized for detecting and monitoring UV radiation levels, assisting in assessing UV pollution in the environment.

  • Health Protection: Can monitor UV intensity, alerting users to protect their skin from excessive UV exposure.

  • Photovoltaic Systems: Used to optimize the performance of solar panels by measuring UV radiation to assess solar resources.

  • Agriculture: Employed for monitoring the light environment of plants, aiding in optimizing plant growth conditions and preventing UV damage to plants.

  • Laboratory Research: In scientific research, it is used to measure and analyze the impact of UV radiation on different materials or organisms.

Specifications

  • Operating Voltage: 3.3-5V DC
  • Communication Methods: I2C, UART
  • I2C Address: 0x23
  • UV Wavelength Range: 240-370nm
  • Operating Temperature: -30~80°C
  • Dimensions: 30mm×22mm

Functional Diagram

Num Label Description
1 D/R I2C data line SDA or UART RXD
2 C/T I2C clock line SCL or UART TXD
3 GND Power negative
4 VCC Power positive (3.3~5V)
5 Communication Mode Switch Select I2C/UART communication mode

Diagram

Arduino Tutorial

Hardware and Software Preparation

Reading Data Using I2C

Wiring Diagram

Sample Code

  • Connect the module to the UNO controller according to the wiring diagram above. Of course, you can also use an expansion board for a more convenient and quicker prototype construction.
  • Switch the sensor's selection switch to the I2C side.
  • Download and install the UVIndex240370Sensor and RTU libraries.
  • Open the Arduino IDE, upload the following code to the UNO controller.
  • Open the serial monitor of the Arduino IDE, adjust the baud rate to 115200, and observe the serial print results.
#include "DFRobot_UVIndex240370Sensor.h"
#include <Wire.h>

DFRobot_UVIndex240370Sensor UVIndex240370Sensor(&Wire);

void setup()
{
  Serial.begin(115200);
  
  while(UVIndex240370Sensor.begin() != true){
    Serial.println(" Sensor initialize failed!!");
    delay(1000);
  }
  Serial.println(" Sensor  initialize success!!");
}

void loop()
{
  uint16_t voltage = UVIndex240370Sensor.readUvOriginalData();
  uint16_t index  = UVIndex240370Sensor.readUvIndexData();
  uint16_t level = UVIndex240370Sensor.readRiskLevelData();
  Serial.print("voltage:"); Serial.print(voltage); Serial.println(" mV");
  Serial.print("index:"); Serial.println(index);
  if(level==0)
    Serial.println("Low Risk");
  else if(level==1)
    Serial.println("Moderate Risk");
  else if(level==2)
    Serial.println("High Risk");
  else if(level==3)
    Serial.println("Very High Risk");
  else if(level==4)
    Serial.println("Extreme Risk");
  delay(100);
}

Results

This experiment needs to be tested under sunlight. The serial monitor will print information similar to the following:

voltage:82 mV
index:1
Low Risk

Wherein, "voltage:82 mV" represents the raw value of ultraviolet light, "index:1" indicates the UV index, and "Low Risk" signifies that the current UV level poses a low risk.

Reading Data Using UART

Wiring Diagram

Sample Code

  • Connect the module to the UNO controller according to the wiring diagram above. Of course, you can also use an expansion board for a more convenient and quicker prototype construction.
  • Switch the sensor's selection switch to the UART side.
  • Download and install the UVIndex240370Sensor and RTU libraries.
  • Open the Arduino IDE, upload the following code to the UNO controller.
  • Open the serial monitor of the Arduino IDE, adjust the baud rate to 115200, and observe the serial print results.
#include "DFRobot_UVIndex240370Sensor.h"
#include <SoftwareSerial.h>

SoftwareSerial mySerial(4, 5);
DFRobot_UVIndex240370Sensor UVIndex240370Sensor(&mySerial);

void setup()
{
  mySerial.begin(9600);
  Serial.begin(115200);
  
  while(UVIndex240370Sensor.begin() != true){
    Serial.println(" Sensor initialize failed!!");
    delay(1000);
  }
  Serial.println(" Sensor  initialize success!!");
}

void loop()
{
  uint16_t voltage = UVIndex240370Sensor.readUvOriginalData();
  uint16_t index  = UVIndex240370Sensor.readUvIndexData();
  uint16_t level = UVIndex240370Sensor.readRiskLevelData();
  Serial.print("voltage:"); Serial.print(voltage); Serial.println(" mV");
  Serial.print("index:"); Serial.println(index);
  if(level==0)
    Serial.println("Low Risk");
  else if(level==1)
    Serial.println("Moderate Risk");
  else if(level==2)
    Serial.println("High Risk");
  else if(level==3)
    Serial.println("Very High Risk");
  else if(level==4)
    Serial.println("Extreme Risk");
  delay(100);
}

Results

This experiment needs to be tested under sunlight. The serial monitor will print information similar to the following:

voltage:82 mV
index:1
Low Risk

Wherein, "voltage:82 mV" represents the raw value of ultraviolet light, "index:1" indicates the UV index, and "Low Risk" signifies that the current UV level poses a low risk.

API

 /**
   * @fn begin
   * @brief Init UVIndex240370Sensor device
   * @return Return value init status
   * @retval ture  Succeed
   * @retval false Failed
   */
  int8_t begin(void);

  /**
   * @fn readUvOriginalData
   * @brief Read the UV voltage value
   * @return voltage value (mV)
   */
  uint16_t readUvOriginalData(void);

  /**
   * @fn readUvIndexData
   * @brief Read the UV Index
   * @return UV Index
   */
  uint16_t readUvIndexData(void);

  /**
   * @fn readRiskLevelData
   * @brief Read the risk level
   * @return 0-4 (Low Risk,Moderate Risk,High Risk,Very High Risk,Extreme Risk)
   */
  uint16_t readRiskLevelData(void);

Mind+(Based on Scratch3.0) Graphical Programming

  • Download the Mind+ programming software. Click to download Mind+

  • Detailed installation tutorial: Mind+ Basic Wiki Tutorial - Software Download and Installation

  • Open Mind+ software, select the upload mode, choose "Arduino Uno" in "Master Board" under "Extensions", then click on the user library.

  • Copy the following link: https://gitee.com/dfrobotcd/ext-uvindex240370sensor, paste it into the user library search bar, then search and add the UV module.

  • Start programming, the program is as shown in the following figure:

Makecode Usage Tutorial

  • Open the MakeCode programming platform by typing the following URL into the browser: https://makecode.microbit.org/

  • Create a new project and name it.

  • Load the UV sensor's program library: Click "Settings", "Extensions" in order, then paste the following link into the search box: https://github.com/cdjq/pxt-DFRobot_UVIndex240370Sensor

  • Start programming, the program is as shown in the following figure:

  • Click download, after the program is uploaded, open "Show data device" to see the data output.

More Material Download

Frequently Asked Questions (FAQ)

No customer has any questions about this product yet, feel free to contact us via qq or forum!

For more questions and interesting applications, you can visit the forum for reference or posting.