Ambient Light Lux Sensor VEML7700: Unterschied zwischen den Versionen

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
Onyesi-john.abiagam@stud.hshl.de (Diskussion | Beiträge)
Onyesi-john.abiagam@stud.hshl.de (Diskussion | Beiträge)
Zeile 465: Zeile 465:
* Apply the correction formula for high light levels when required to compensate for sensor non-linearity.
* Apply the correction formula for high light levels when required to compensate for sensor non-linearity.


A detailed flowchart of the complete auto-ranging procedure is provided in the Vishay application note.
A detailed flowchart of the complete auto-ranging procedure is provided in the Vishay application note datasheet( see link at the end of  the page).


= Measurement Circuit =
= Measurement Circuit =

Version vom 31. Mai 2026, 12:54 Uhr

Abb. 1: Ambient Light Lux Sensor VEML7700
Autor: Onyesi John Abiagam
Sprache: DE EN

Introduction

The Ambient Light Sensor (VEML7700) is a high-accuracy sensor with 16-bit resolution. It integrates a highly sensitive photodiode, a low-noise amplifier, and a built-in analog-to-digital converter to enable precise light measurements. The sensor communicates via a simple I²C interface and provides ambient light data directly in digital form.

Technical Overview

Key Features

Feature Description
Package Type Surface-mount (SMD), side-view
Dimensions 6.8 mm × 2.35 mm × 3.0 mm
Sensor Type Ambient Light Sensor (ALS)
Resolution 16-bit digital output
Supply Voltage (VDD) 2.5 V to 3.6 V
Communication Interface I²C
Dynamic Range 0 lx to about 140 klx
Sensitivity Up to 0.0042 lx/count
Flicker Rejection 100 Hz and 120 Hz noise suppression
Power Consumption Low shutdown current ( about 0.5 µA typical)
Temperature Stability Built-in temperature compensation
Additional Feature Software-controlled shutdown mode

Components Requirements

Component Description
Arduino Uno Microcontroller board used to interface with the sensor
VEML7700 Sensor Module Ambient light sensor with built-in I²C support and onboard circuitry
Jumper Wires Used to connect the sensor module to the Arduino

Pin Configuration

Pin Number Pin Name Description
1 SCL Serial Clock Line for I²C communication
2 VDD Power supply (2.5 V – 3.6 V)
3 GND Ground
4 SDA Serial Data Line for I²C communication



Measurement Method

Reference Lux Meter Reading vs LX-1108 Measurement

  • Measurements were obtained simultaneously using the laboratory reference lux meter and the LX-1108 lux meter.
  • The laboratory reference lux meter served as the reference instrument, while the LX-1108 was treated as the instrument under investigation.
  • The relationship between the two instruments was examined over the selected light range.
  • Table 1 presents the recorded measurements obtained from both instruments.
  • Figure 1 shows the corresponding LX-1108 measurements plotted against the reference lux meter readings.
  • The observed deviation between the two instruments suggests that the relationship cannot be adequately represented by a single constant correction factor.

Note: The analysis presented in this report is specific to the LX-1108 lux meter used during the experiment and should not be generalized to Ambient Light Sensors (ALS) or other light-sensing devices, as different devices exhibit different measurement characteristics and require independent calibration procedures.

Table 1: Reference Lux Meter and LX-1108 Measurement Data

Table 1: Reference Lux Meter and LX-1108 Measurement Data
Reference Lux Meter (Lab_Ref) [Lux] LX-1108 Reading (LX_Reading) [Lux]
0 0
64 51
1174 924
2349 1889
3226 2573
4091 3247
5049 3870
6307 4880
7070 5570
8231 6510
9105 7150
10340 7990
11213 8780
12361 9670
13259 10030
14058 10450
15334 11200
16257 11700
17322 12500
18078 13400
19737 14600

Figure 1 illustrates the relationship between the laboratory reference lux meter readings and the corresponding LX-1108 measurements.

Figure 1: Reference Lux Meter Reading vs LX-1108 Measurement
  • The LX-1108 readings generally increased with increasing reference illuminance.
  • The relationship between the two instruments was not perfectly proportional across the measurement range.
  • The varying deviation suggests that a nonlinear model is required to accurately characterize the relationship.
  • Consequently, nonlinear regression was employed to establish a calibration model for the LX-1108.

Relative Error Before Calibration

To quantify the deviation between the laboratory reference lux meter and the LX-1108, the relative error was calculated as:

RelativeError=LabRefLXReadingLabRef×100

where LabRef represents the laboratory reference lux meter reading and LXReading represents the corresponding LX-1108 measurement.

Figure 2: Relative Error Before Calibration.
  • The LX-1108 showed a deviation relative to the laboratory reference lux meter.
  • The error was not constant and generally increased at higher illuminance levels.
  • The varying error indicates that a single constant scaling factor would not adequately compensate for the observed deviation.
  • Therefore, a nonlinear regression model was developed to characterize the relationship between the laboratory reference lux meter and the LX-1108.

The nonlinear regression procedure and the resulting calibration model are presented in the following section.

Nonlinear Regression

The results presented in Figure 1 and Figure 2 indicate that the LX-1108 exhibits a systematic and non-uniform deviation relative to the laboratory reference lux meter. Furthermore, the relative error varies across the measurement range, suggesting that the relationship between the two instruments cannot be adequately described using a single constant scaling factor.

To mathematically characterize this relationship, a nonlinear regression model was developed using the experimental measurement data. The laboratory reference lux meter readings (LabRef) were treated as the independent variable, while the corresponding LX-1108 measurements (LX_Reading) were treated as the dependent variable.

A power-law regression model was selected and expressed as:

LXReading=a(LabRef)b

where:

  • a is the scaling coefficient,
  • b is the nonlinear exponent,
  • LabRef represents the laboratory reference lux meter reading, and
  • LXReading represents the corresponding LX-1108 measurement.

The model parameters were estimated using MATLAB's nonlinear regression fitting tools to obtain the best representation of the observed relationship between the laboratory reference lux meter and the LX-1108.

Regression Results

The nonlinear regression procedure produced the following parameter estimates:

  • Scaling coefficient: a=1.428934
  • Nonlinearity exponent: b=0.932233

Substituting these values into the regression model yields:

LXReading=1.428934(LabRef)0.932233

Figure 3: Nonlinear regression model fitted to the relationship between the laboratory reference lux meter readings and the corresponding LX-1108 measurements
  • The blue markers represent the experimental measurements obtained from the LX-1108 and the laboratory reference lux meter.
  • The red curve represents the fitted nonlinear regression model.
  • The dashed black line represents the ideal relationship (y=x) between the two instruments.
  • The fitted model captures the deviation of the LX-1108 relative to the laboratory reference lux meter.
  • The resulting regression equation provides the mathematical basis for deriving a calibration function for the LX-1108.

Derivation of the TrueLux Function

Using the nonlinear regression model derived in the previous section, an inverse function was established to estimate the corresponding reference luxmeter value from a measured LX-1108 reading.

The resulting inverse relationship is:

TrueLux=(MeasuredLux1.428934)10.932233

Defining this inverse relationship as:

Lux2Ref(MeasuredLux)

the function can be expressed as:

TrueLux=Lux2Ref(MeasuredLux)

where:

  • MeasuredLux is the measured LX-1108 reading.
  • Lux2Ref() is the calibration function derived from the nonlinear regression model.
  • TrueLux is the estimated reference lux value.


Calibration of LX-1108 Measurements

The nonlinear regression model was used to establish a calibration function capable of estimating the corresponding reference lux value from a measured LX-1108 reading.

The calibration function was subsequently applied to the LX-1108 measurements to obtain corrected Lux values.

Figure 4: Corrected LX-1108 measurements compared with the laboratory reference lux meter readings.
  • The corrected measurements closely follow the ideal relationship (y=x).
  • The systematic deviation observed in the raw LX-1108 measurements has been substantially reduced.
  • The corrected values exhibit improved agreement with the laboratory reference lux meter readings.
  • The results demonstrate the effectiveness of the calibration function in estimating the corresponding reference values.

Relative Error After Calibration

The relative error after calibration was calculated using:

RelativeError=LabRefCorrectedLuxLabRef×100

where:

  • LabRef represents the laboratory reference lux meter reading.
  • CorrectedLux represents the calibrated LX-1108 measurement.
Figure 5: Relative Error After Calibration.
  • The relative error was significantly reduced after calibration.
  • The remaining error is considerably smaller than that observed before calibration.
  • The calibrated LX-1108 measurements show improved relationship with the laboratory reference lux meter.


Important Limitation:

  • The function TrueLux=Lux2Ref(MeasuredLux) was derived exclusively from calibration data obtained using the LX-1108 lux meter and the laboratory reference lux meter.
  • The function is intended only for estimating reference-equivalent values from LX-1108 measurements.
  • The function was not derived using VEML7700 measurement data.
  • Consequently, the function cannot be assumed to provide accurate reference illuminance estimates for the VEML7700 sensor.
  • Since the VEML7700 exhibits different sensing characteristics and measurement behaviour, an independent calibration procedure is required to establish a corresponding calibration function.

VEML7700 Automatic Gain and Integration Time Selection Across Varying Light Levels

The VEML7700 measurements were obtained using the Adafruit VEML7700 library. The library provides an auto-ranging feature that automatically adjusts the sensor gain and integration time according to the measured light level. This allows the sensor to operate over a wide range of lighting conditions without requiring manual configuration of these parameters.

To observe the behavior of the auto-ranging feature, measurements were taken in the Light Laboratory using a LabRef luxmeter as the reference instrument. For each light level, the corresponding VEML7700 reading and the automatically selected gain and integration time settings were recorded. The results are summarized in Table 2.

Table 2.This Shows the Automatic Selection and Adjustment of Gain and Integration Time Across Different Reference light Levels Measured Using the LabRef Luxmeter and VEML7700 Sensor
Reference Luxmeter Reading Raw ALS Count Lux Auto Gain and Integration Time Selection
0 0 0 Gain = 2, IT = 800 ms
588 1079 517.87 Gain = 1/8, IT = 100 ms
1283 2231 1107 Gain = 1/8, IT = 100 ms
1993 3522 1804.77 Gain = 1/8, IT = 100 ms
2727 4723 2483.48 Gain = 1/8, IT = 100 ms
3447 5854 3143.58 Gain = 1/8, IT = 100 ms
4158 6937 3793.18 Gain = 1/8, IT = 100 ms
4862 7974 4426.77 Gain = 1/8, IT = 100 ms
5561 8967 5046.89 Gain = 1/8, IT = 100 ms
6255 9914 5650.44 Gain = 1/8, IT = 100 ms
6943 5414 6239.62 Gain = 1/8, IT = 50 ms
7627 5855 6816.50 Gain = 1/8, IT = 50 ms
8305 6283 7388.46 Gain = 1/8, IT = 50 ms
8977 6691 7996.35 Gain = 1/8, IT = 50 ms
9646 7085 8495.75 Gain = 1/8, IT = 50 ms
10310 7466 9039.77 Gain = 1/8, IT = 50 ms
10968 7833 9581.76 Gain = 1/8, IT = 50 ms
11622 8188 10116.07 Gain = 1/8, IT = 50 ms
12270 8526 10694.13 Gain = 1/8, IT = 50 ms
12914 8860 11181.97 Gain = 1/8, IT = 50 ms
13554 9182 11708.92 Gain = 1/8, IT = 50 ms
14189 9495 12241.26 Gain = 1/8, IT = 50 ms
14820 9796 12774.04 Gain = 1/8, IT = 50 ms
15445 5045 13307.01 Gain = 1/8, IT = 25 ms
16065 5187 13847.48 Gain = 1/8, IT = 25 ms
16680 5324 14383.75 Gain = 1/8, IT = 25 ms
17290 5459 14931.21 Gain = 1/8, IT = 25 ms
17898 5593 15494.61 Gain = 1/8, IT = 25 ms
18500 5720 16039.33 Gain = 1/8, IT = 25 ms
19061 5835 16566.99 Gain = 1/8, IT = 25 ms
19490 5922 16975.82 Gain = 1/8, IT = 25 ms
19655 5956 17136.62 Gain = 1/8, IT = 25 ms
19682 5961 17160.41 Gain = 1/8, IT = 25 ms

VEML7700 Automatic Gain and Integration Time Adjustment Procedure (Vishay Datasheet)

According to Vishay, the VEML7700 auto-ranging algorithm automatically adjusts the gain and integration time to keep the ALS count within a suitable measurement range. The process can be summarized as follows:

  • Start with the lowest gain setting (gain × 1/8) and an integration time of 100 ms.
  • Measure the ALS count.
  • If the ALS count is less than or equal to 100 counts, increase the gain from × 1/8 to × 1/4.
  • If the ALS count is still less than or equal to 100 counts, increase the gain to × 1.
  • If the ALS count is still less than or equal to 100 counts, increase the gain to × 2.
  • If the ALS count remains less than or equal to 100 counts at the highest gain setting, increase the integration time from 100 ms to 200 ms, and continue increasing it up to a maximum of 800 ms if required.
  • For high light levels, reduce the sensor sensitivity by decreasing the gain or integration time to prevent ALS count saturation.
  • Once the ALS count falls within the recommended operating range, calculate the lux value using the corresponding resolution factor.
  • Apply the correction formula for high light levels when required to compensate for sensor non-linearity.

A detailed flowchart of the complete auto-ranging procedure is provided in the Vishay application note datasheet( see link at the end of the page).

Measurement Circuit

VEML7700 circuit diagram


Software

Arduino IDE

Simulink

Video

Datasheets


→ back to main article: Sensor Kit
→ back to main article: HSHL Mechatronics Kit


→ back to main article: HSHL Mechatronics Kit | Arduino Sensor Collection


→ zurück zum Hauptartikel: HSHL-Mechatronik-Baukasten | Arduino Sensorsammlung