Introduction
This new ambient light sensor is packaged in a transparent semisphere case that offers better light gathering power. The sensor supports 0-200klx detection range and I2C communication. The on-chip photodiode’s spectral response is optimized to mimic the human eye’s perception of ambient light and incorporates IR and UV blocking capability. The adaptive gain block automatically selects the correct lux range to optimize the counts/lux. It is ideal for applications such as smartphones, vehicle smart light, intelligent incubator, etc.
Luminance data reference
- Evening: 0.001-0.02lx;
- Moonlit night: 0.02-0.3lx;
- Cloudy indoor: 5-50lx;
- Cloudy outdoor: 50-500lx;
- Sunny indoor: 100-1000lx;
- Under summer noon light: about 10*6 lx;
- Illumination when reading books: 50-60lx;
- Home video standard illumination: 1400lx
NOTE:
- This sensor can obtain the intensity of ambient light.
- The detected data will be transmitted by IIC. Its IIC address cannot be revised.
- Write the necessary configuration into the config register(address: 0x04) to set differernt parameter accuracies.
- The light intensity data can be read from the data register(address: 0x00~0x03).
- This sensor is sealed by software IIC, and can not be used with other equipment or sensors using hardware IIC.
Specification
- Supply Voltage: 2.7-6V
- Operating Current: 0.7mA
- Detection Range: 0-200klx
- Accuracy: 0.054lx
- Communication: IIC
- Operating Temperature Range: -40°C~+85°C
- Dimension: inner diameter 22mm, outer diameter 26mm, shell diameter 28.5mm, semisphere height 18mm
Board Overview
Num | Label | Description |
---|---|---|
1 | VCC | + |
2 | SCL | IIC Clock Input Pin |
3 | SDA | IIC Data Input Pin |
4 | GND | - |
5 | EN | Sensor Chip-select Enable/Disable port, H to enable, L to disable sensor |
Tutorial
Requirements
- Hardware
- DFRduino UNO R3 (or similar) x 1
- Ambient Light Sensor(0-200klx) x1
- Software
- Arduino IDE
- Download and install the Ambient Light Sensor Library. (About how to install the library?)
Connection Diagram
Sample Code
/*!
* @file getLightIntensity.ino
* @brief Set sensor mode and read light values
* @n Experimental phenomenon: the light value is read once a second after the sensor device starts successfully
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @author [Fary](fary_young@outlook.com)
* @version V1.0
* @date 2020-12-03
* @https://github.com/DFRobot/DFRobot_B_LUX_V30B
*/
#include <DFRobot_B_LUX_V30B.h>
DFRobot_B_LUX_V30B myLux(13);//The sensor chip is set to 13 pins, SCL and SDA adopt default configuration
/*
* MANUAL
* eAutomatic:The default automatic configuration, after using this mode does not have to configure the following mode, IC automatic configuration.
* eManual :Manual configuration. This pattern is configured and used in combination with subsequent patterns
* CDR
* eCDR_0:Don't divide the CDR
* eCDR_1: Eight divided the CDR
* TIM
* eTime800ms:The collection time is 800ms
* eTime400ms:The collection time is 400ms
* eTime200ms:The collection time is 200ms
* eTime100mse:The collection time is 100ms
* Time50ms:The collection time is 50ms
* eTime25ms:The collection time is 25ms
* eTime12_5ms:The collection time is 12.5ms
* eTime6_25ms:The collection time is 6.25ms
* Manual mode combination
* (The collected value cannot exceed the maximum range of each mode. If the read data exceeds the range, the data is not correct)
* eManual+eCDR_0+eTime800ms mode=64 The maximum value collected is: 2938 (Lux)
* eManual+eCDR_0+eTime400ms mode=65 The maximum value collected is: 5875(lux)
* eManual+eCDR_0+eTime200ms mode=66 The maximum value collected is: 11750(lux)
* eManual+eCDR_0+eTime100ms mode=67 The maximum value collected is: 23501(lux)
* eManual+eCDR_0+eTime50ms mode=68 The maximum value collected is: 47002(lux)
* eManual+eCDR_0+eTime25ms mode=69 The maximum value collected is: 94003(lux)
* eManual+eCDR_0+eTime12.50ms mode=70 The maximum value collected is: 200000(lux)
* eManual+eCDR_0+eTime6.25ms mode=71 The maximum value collected is: 200000(lux)
*
* eManual+eCDR_1+eTime800ms mode=72 The maximum value collected is: 23501(lux)
* eManual+eCDR_1+eTime400ms mode=73 The maximum value collected is: 47002(lux)
* eManual+eCDR_1+eTime200ms mode=74 The maximum value collected is: 94003(lux)
* eManual+eCDR_1+eTime100ms mode=75 The maximum value collected is: 200000(lux)
* eManual+eCDR_1+eTime50ms mode=76 The maximum value collected is: 200000(lux)
* eManual+eCDR_1+eTime25ms mode=77 The maximum value collected is: 200000(lux)
* eManual+eCDR_1+eTime12.50ms mode=78 The maximum value collected is: 200000(lux)
* eManual+eCDR_1+eTime6.25ms mode=79 The maximum value collected is: 200000(lux)
*/
void setup() {
Serial.begin(9600);
myLux.begin();
/*
* The setMode and readMode functions can be omitted. When not configured, the default configuration is the one used last time.
* When using the setMode function, its return value should be judged. If the return value is 1, the setting is successful.
* while(!myLux.setMode(myLux.eManual,myLux.eCDR_0,myLux.eTime800ms));
* Serial.print("mode: ");
* Serial.println(myLux.readMode());
*/
}
void loop() {
Serial.print("value: ");
Serial.print(myLux.lightStrengthLux());
Serial.println(" (lux).");
delay(1000);
}
Expected Results
Check the detected light value on the serial monitor.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.