SKU_SEN0636_Gravity_UV_Index_240370_Sensor Wiki

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:
  1. Role in Nature:
  1. Dangers of UV Light:

Ultraviolet (UV) Index Ranges and Health Recommendations

  1. 0-2: Low Risk
  1. 3-5: Moderate Risk
  1. 6-7: High Risk
  1. 8-10: Very High Risk
  1. 11+: Extreme Risk

Features

Application

Specifications

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

#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

#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

Makecode Usage Tutorial

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.