While the VEML7700 is capable of being used over a wide range of ambient lighting conditions, from dark room to direct sunlight, getting good readings will typically require making some adjustments.

There are two main adjustments:

  • gain - how much the signal is amplified
  • integration time - how long the signal is built up

This Application Note from Vishay, the manufacturer of the VEML7700, contains good information:

This table summarizes the maximum illumination (in terms of lux) that can be measured for given combinations of gain (GAIN) and integration time (IT).

If the maximum illumination is known, then the gain and integration times can be manually set accordingly. In general, the raw ALS value (different than lux values in table) should be between 100 and 10000. Read the Application Note for details.

NOTE: The library defaults are GAIN=1/8 and IT=100ms.

Non-Linear Correction

For lower light levels, the VEML7700 behaves linearly, so lux can be computed simply from the raw ALS reading. For higher levels, the behavior becomes increasingly non-linear. For those conditions, the Application Note provides a non-linear correction that can be applied to the computed lux value.

The Application Note seems to indicate that If the raw ALS value is over 100 with a gain of 1/8 and integration time of 100ms, then the correction should be applied.

Although it's a little confusing as to what integration times this applies to.

Automatic Adjustment

The Application Note linked above provides a flow chart (Fig. 24) that outlines a method to automatically adjust gain and integration time based on the raw sensor readings. Additionally, the non-linear correction is applied as needed.

Currently, only the Arduino library provides an implementation of this. See the example here:

However, one could implement the same thing in their own code. The libraries provide the necessary methods for setting gain and integration time and reading the raw ALS values.

This guide was first published on Apr 02, 2019. It was last updated on Mar 28, 2024.

This page (Adjusting for Different Light Levels) was last updated on Mar 08, 2024.

Text editor powered by tinymce.