Adafruit VEML7700 sensor does not want to give a higher lux than 471.85

I am using an arduino leonardo board and i have connected the sensor to my board as follows:

I have done everything from this tuturial: Arduino | Adafruit VEML7700 Ambient Light Sensor | Adafruit Learning System

So my code is:

#include "Adafruit_VEML7700.h"

Adafruit_VEML7700 veml = Adafruit_VEML7700();

void setup() {
  while (!Serial) { delay(10); }
  Serial.println("Adafruit VEML7700 Test");

  if (!veml.begin()) {
    Serial.println("Sensor not found");
    while (1);
  Serial.println("Sensor found");


  Serial.print(F("Gain: "));
  switch (veml.getGain()) {
    case VEML7700_GAIN_1: Serial.println("1"); break;
    case VEML7700_GAIN_2: Serial.println("2"); break;
    case VEML7700_GAIN_1_4: Serial.println("1/4"); break;
    case VEML7700_GAIN_1_8: Serial.println("1/8"); break;

  Serial.print(F("Integration Time (ms): "));
  switch (veml.getIntegrationTime()) {
    case VEML7700_IT_25MS: Serial.println("25"); break;
    case VEML7700_IT_50MS: Serial.println("50"); break;
    case VEML7700_IT_100MS: Serial.println("100"); break;
    case VEML7700_IT_200MS: Serial.println("200"); break;
    case VEML7700_IT_400MS: Serial.println("400"); break;
    case VEML7700_IT_800MS: Serial.println("800"); break;



void loop() {
  Serial.print("Lux: "); Serial.println(veml.readLux());
  Serial.print("White: "); Serial.println(veml.readWhite());
  Serial.print("Raw ALS: "); Serial.println(veml.readALS());

  uint16_t irq = veml.interruptStatus();
  if (irq & VEML7700_INTERRUPT_LOW) {
    Serial.println("** Low threshold"); 
  if (irq & VEML7700_INTERRUPT_HIGH) {
    Serial.println("** High threshold"); 

Now I come to the point that my lux value does not exceed 471.85 LUX.

My result in my Serial is as follows:

I am completely new to arduino and sensors so I have no idea if I missed something or not.

Interesting that their tutorial shows 471.85 too. Can you get a lower value?

ye only not higher

I think I would assume that that's what you get when the sensor is saturated, particularly as they're seeing the exact same thing. Does it matter?

What do you mean? I need to get higher Lux values for the project I'm working on. Their product description states that the maximum value is 120 klux.

Manufacturer's page with datasheet:

Which VEML7700 module do you have ? Can you give a link to where you bought it ?
Only the Adafruit module is compatible with a 5V Arduino board. The Leonardo is a 5V board.

Did you put it in the sun and it got too hot ?

The sensor itself can measure from 7mLux to 120kLux.
The 120kLux is sunlight and no sensor can measure direct sunlight. But if the datasheet says that 120kKux is the maximum, then it should be able to measure up to 120kLux.

I'm afraid we can not help if no one of us has that module to verify it :confused:
According to the Adafruit forum and an issue on Github, there is something weird with the sensor and the library. Even the Adafruit tutorial is stuck at 471.85, that is a bad sign. I think that the software should have a autoranging feature implemented to measure the full range.

Keep in mind that the sensor could be broken. You might spent a lot of time trying to solve it.
You could try another library, but perhaps you should buy another sensor (not a VEML7700) and leave this behind you.

Does this sketch gives a different result ?
On the upper-right of the Arduino IDE is a drop-down-button where you can add a file. There you can add "VEMLConfig.h" and copy that contents of that second file in.

The Adafruit TSL2591 module can measure up to 88kLux. Perhaps it has the same problem, if the library has no autoranging.

What is your project ? If you want something outdoors in direct sunlight, then you need something else.

Thank you I get pretty accurate results from this. I am currently working on a project where I want to use this sensor to measure the number of lux in a room in order to adjust the lights in that room.

So my next step is to use bluetooth to send this data to another arduino.

for others who have the same problem I used the "Adafruit VEML7700 Lux sensor - I2C light sensor"

Please explain. With what do you get good results ? That sketch in this forum ?

In that sketch, you can change it for the brightest light in the *.h file:

This is now it is now:

// --- Uncomment one from this group: 
//#define ALS_IT 0b1100 //   25 ms
#define ALS_IT 0b1000 //   50 ms
//#define ALS_IT 0b0000 //  100 ms
//#define ALS_IT 0b0001 //  200 ms
//#define ALS_IT 0b0010 //  400 ms
//#define ALS_IT 0b0011 //  800 ms

You can select the 25 ms for the brightest light. Comment the 50 ms and uncommend the 25 ms line.

Perhaps you can go back to the Adafruit sketch and change the numbers to 25 ms and 1/8.

This is how it is now:


This is for the brightest light:


Without autoranging, the sensor has to be set for a certain amount of light. That is no fun, that is only a small range and the sensor can do so much more.

That link to amazon is indeed the real Adafruit module, it is compatible with your Leonardo board :smiley:

When i use this sketch my results are good. I used a TROTEC luxmeter to test my results.

It probably has to do with the settings you are talking about. Because if I change the settings I also get better results with the library from adafruit.


Here you set the gain to a reasonable value (x1), but the exposure time to maximum, making it very sensitive,
as the exposure time affects the gain directly too.


  veml.setGain(VEML7700_GAIN_1_8) ; // set gain = 1/8
  veml.setIntegrationTime(VEML7700_IT_25MS); // set 25ms exposure time

then you'll get it able to handle the brightest light it can measure.

1 Like