HUM: APDS-9200

You are a beginner with Dasduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by soldered where you will find all you need in order to begin working with your favorite module. Tutorials include: technical characteristics, work principle, instructions on how to connect the module with Dasduino and the basic code. Everything else is left to your imagination.
INTRODUCTION
APDS_9200 is a sensor that allows measuring the ultraviolet (UV) radiation level by measuring UV-A (320 nm – 400 nm) and UV-B (290 nm to 320 nm) rays. In addition to the UV radiation measurements, we also have brightment measurements which are very precise and can therefore be used in cell phones and on external displays for automatic display brightness control. The sensor has a low power consumption and consumes only 100uA when operating or 1uA in idle mode and is therefore suitable for devices that use a battery for power supply.
Sensor characteristics:
- Voltage: 1.7V – 3.6V
- Voltage on the SDA and SCL inputs: 0.8 VDC – 3.6 VDC
- Current during reading: 100uA
- Current during idle mode: 1uA
- Communication type: I2C
HOW DOES THE MODULE WORK?
The sensor consists of numerous photodiodes that measure brightness and UV radiation, and they are arranged so that the measurements are less affected by the light angle. The photodiode current is converted to digital values by an analog-to-digital converter (ADC) and the resolution of the ADC can vary from 13 to 20-bit resolution to convert the analog signal to digital. The time it takes to measure depends on the measurement resolution, and if we set a higher measurement resolution, it will take more time to measure and to find the optimal relation between time and measurement resolution. The UV radiation measurement sensor displays values from 0 to several thousand, but from the diagram given in the datasheet in the program, we also get a UV index display (from 1 to 11). The sensor is connected via I2C communication with the microcontroller and can be used at a maximum 400 Hz communication speed.
The right diagram shows that UV radiation depends on the wavelength of light, and the left diagram shows the measurements of brightness and shows how the sensor measures approximately the same as the human eye sees.
While measuring, the sensor measures UV radiation and brightness separately and the measurements are independent.
The sensor has the ability to set the light-dependent interrupt which is used on the INT pin.
HOW TO CONNECT IT?
This sensor is connected to Dasduino via I2C communication which means that we need the pins SDA(A4) and SCL(A5). Since the sensor works at a 3.3V voltage, and Dasduino works at 5V, for connecting the sensor to Dasduino, we must use the Logic Level Converter Module that lowers these 5V to 3.3V as well as on all pins (VDD, SDA, SCL) and therefore ensures safe operation with the sensor. The scheme shows how to connect Dasduino to the sensor using the Logic Level Converter Module.