VEML7700 lux sensor under sunlight

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

VEML7700 lux sensor under sunlight

Post by earthres »

VEML7700data.jpg
VEML7700data.jpg (42.06 KiB) Viewed 181 times
What's available for measuring light in outdoor conditions under sunlight? As far as I know, the VEML7700 is the only Adafruit sensor usable outdoors where lux values under full sunlight can exceed 100,000 lux. Adafruit provides a software library where you can set the integration time and gain settings for the VEML7700. There's only one set of values -- gain 1/8, integration time 25 ms -- that are appropriate for such an application. With these values, you're supposed to be able to record lux up to a little over 120,000 lux. See
https://www.vishay.com/docs/84323/desig ... 00.pdfsuch

HOWEVER, if you actually record data under bright skies, the lux values will "max out" at a little over 20,000 lux. Why? Because under brighter conditions, the VEML7700 response is VERY nonlinear. Figure 9 in the document cited above shows the nonlinearity and Figure 10 gives a polynomial correction for correcting the lux values.

This image shows some data using the Adafruit library and lux values with the polynomial correction. Also shown are some values from a handheld lux meter. Considering the very significant differences in the physical layout of these two devices, the agreement is pretty good with the corrected values. The lux values up around 100,000 lux are reasonable for a clear sky at about 40 deg N, close to the summer solstice. A similar correction would apply to the WHITE data, too, but it's not clear to me that the same polynomial correction would apply.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: VEML7700 lux sensor under sunlight

Post by adafruit_support_carter »

Make sure you are using the latest version of the library which incorporates the non-linear correction:
https://github.com/adafruit/Adafruit_VEML7700
and see here for general guidance on how to adjust:
https://learn.adafruit.com/adafruit-vem ... ght-levels

If you are using CircuitPython, this has not been implemented yet there:
https://github.com/adafruit/Adafruit_Ci ... /issues/20

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: VEML7700 lux sensor under sunlight

Post by earthres »

hmm... I looked at the github code for the .h and .cpp VEML7700 sensor. There is some code to pick an appropriate gain and integration time for various lighting conditions. For outdoor measurements under bright sunlight, the ONLY appropriate values are gain=1/8 and integration time = 25 ms. These are the only values that support lux values above 100,000 lux, as is necessary for these outdoor conditions.

I used a new version of the VEML7700 software library and the figure I sent shows the result with and without a polynomial correction after using 25 ms, 1/8. Unless I'm missing something, there's no code in the software library that applies the polynomial correction found in Figure 10 of the Vishay Application Note to correct for the nonlinearity shown in Figure 9. Without that correction, the lux values "max out" at just above 20,000 lux. If I'm wrong about that, please let me know.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: VEML7700 lux sensor under sunlight

Post by adafruit_support_carter »

Unless you are using the automatic method, setting the correct gain and integration time is up to you. Similarly for deciding to use the non-linear correction. The non-linear correction code is here:
https://github.com/adafruit/Adafruit_VE ... #L360-L362

Use the luxMethod parameter when calling readLux() to decide how lux is computed. The default is no correction. To compute with the non-linear correction, use:

Code: Select all

veml.readLux(VEML_LUX_CORRECTED);
If having the read be non-blocking is critical, then you can use the NOWAIT options. Making sure the proper amount of time has passed for a correct reading is then up to you.

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: VEML7700 lux sensor under sunlight

Post by earthres »

OK. I missed that before! Sorry, and thanks for following up! Still, for anyone using the VEML7700 for measuring sunlight outdoors, I would simplify. Specify gain 1/8 integration time 25 ms because that's the only setting that will work for bright sunlight. Use the "uncorrected" lux value that you get from those settings and then just apply the correction polynomial to that lux value. You don't have to specify any other parameters.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”