Difference between revisions of "UV Sensor (C)"

From Waveshare Wiki
Jump to: navigation, search
Line 26: Line 26:
 
== Resources ==
 
== Resources ==
 
*[https://www.waveshare.com/w/upload/b/bd/UV_Sensor_%28C%29.pdf Schematic]
 
*[https://www.waveshare.com/w/upload/b/bd/UV_Sensor_%28C%29.pdf Schematic]
*[https://www.waveshare.net/w/upload/a/ab/UV_Sensor_C_Code.zip Code]
+
*[https://www.waveshare.com/w/upload/1/13/UV_Sensor_C_Code.zip Code]
 
*[https://www.waveshare.com/w/upload/3/38/LTR-390UV_Final_DS_V1_2.pdf Datasheets]
 
*[https://www.waveshare.com/w/upload/3/38/LTR-390UV_Final_DS_V1_2.pdf Datasheets]
 
</div>
 
</div>

Revision as of 08:26, 14 March 2022

UV Sensor (C)
UV-Sensor-C

Ultraviolet Sensor
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

V Sensor (C) is an I2C digital UV sensor expansion board equipped with LTR390-UV-01, which can be used to measure UV and human visible light, and can output light intensity data. UV Sensor (C) has the characteristics of sensitive sensing, fast response and small size. Its core sensor LTR390-UV-01 is integrated on a 27 × 20mm expansion board, which can be easily integrated into the device.

Product Features

  • Using LTR390-UV-01, can measure ultraviolet and visible light of human eye
  • Built-in ADC, can directly output light intensity through I2C interface, not easy to be disturbed by noise
  • With interrupt output and programmable upper and lower thresholds
  • On-board level conversion circuit, compatible with 3.3V/5V working level
  • Provide complete supporting information manual (Raspberry/Arduino/STM32 sample program and user manual, etc.)


Specifications

  • Operating voltage: 3.3V/5V
  • Sensor: LTR390-UV-01
  • Response wavelength : 280 - 430nm
  • Communication interface: I2C (fixed address: 0x53)
  • Product size: 27 × 20mm
  • Fixed aperture: 2.0mm

Applications

  • Ultraviolet tester
  • Outdoor ultraviolet detector
  • Germicidal lamp

Interface Description

  • Pin function
Pin Number Identification Pin Description
1 VCC 3.3V/5V power supply positive
2 GND Power Ground
3 SDA I2C data line
4 SCL I2C clock line
4 INT Interrupt output

This routine uses a Raspberry Pi 4 Model B, which provides RPI (Python) library routines

Hardware connection

UV-Sensor-C-WIKI1.png

Using Raspberry Pi

Open I2C interface

  • Execute in terminal:
sudo raspi-config
#Select Interfacing Options -> I2C ->yes to start the i2C kernel driver

TSL25911 Light Sensor-5.png

  • then restart the raspberry pi
sudo reboot

Installing Libraries

  • Install BCM2835, open the Raspberry Pi terminal, and run the following command
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz
cd bcm2835-1.60/
sudo ./configure
sudo make
sudo make check
sudo make install
  • install wiringpi
sudo apt-get install wiringpi
#For Raspberry Pi 4B may need to be upgraded:
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v

Download and run the test routine

wget https://www.waveshare.net/w/upload/a/ab/UV_Sensor_C_Code.zip
unzip -o UV_Sensor_C_Code.zip  -d ./UV_Sensor_C_Code
sudo chmod 777 -R UV_Sensor_C_Code

python program

Execute in the UV_Sensor_C_Code directory:

cd UV_Sensor_C_Code/RPI
sudo python LTR390.py
  • Note: The sensor has 2 working modes, measuring light intensity and UV light respectively.
  • Note: The upper and lower thresholds of the interrupt are set by the program. If it is higher than or lower, it will trigger, and the INT pin will output a high pulse.

This routine has been verified on NUCLEO-F103RB (chip model STM32RBT6). If you need to transplant, please pay attention to the relevant configuration and connection method

Hardware connection

Connection with XNUCLEO-F103RB:

UV Sensor (C) XNUCLEO-F103RB
VCC 3.3V/5V
GND GND
SDA SDA/D14/PB9
SCL SCL/D15/PB8

Experimental phenomenon

The default serial port 2 prints data, and using UV lamp or UV pen to illuminate the sensor will print the UV value
UV-Sensor-C-WIKI5.png

This example is tested on Arduino UNO. If other types of Arduino are used, please pay attention to whether the relevant pins are connected correctly

Hardware connection

UV-Sensor-C-WIKI2.png

Install and compile software (windows tutorial)

arduino IDE installation tutorial

Verifiers

Download the program on the product encyclopedia interface, and then unzip it.
This routine is written based on the arduino library version, so the program needs to be copied to the arduino library directory. Copy the folder Waveshare_UV_C in the Arduino directory in the next week's file to the libraries in the Arduino installation directory (C:\Users\XXX\Documents\Arduino\libraries or C:\Program Files (x86)\Arduino\libraries)

Open Arduino IDE: Click File (flie)->Example (example) to load the library, check if there is the Waveshare_UV_C option, if so, the library is imported successfully

Open the ino project file in the example, select the corresponding model of the development board, select the corresponding COM port, compile the program, download it to the UNO, open the serial monitor, and use the UV pen or UV lamp to print the UV value

FAQ

 Answer:
Please check whether the hardware connection is OK, especially the line sequence of SDA and SCL should not be reversed, and reconnect the sensor after power off and re-run the program
{{{3}}}
{{{4}}}

{{{5}}}


Support

Support

If you require technical support, please go to the Support page and open a ticket.