VEML6030 lux value not the same for the same resolution

Hello, I’m using the sparkfun ambient light sensor VEML6030. I’m trying to get the lux value from the sensor with the function light.readLight (). This function gets the sensor’s ambient light’s lux value. The lux value is determined based on current gain and integration time settings. The light is provided by a led which blink for a set time. The led is in front of the sensor in the dark. Between the led and the sensor I have a vial with a liquid. I try to realize a colorimeter.

When I set to the sensor a gain=1/8 and an integration time=50ms, I obtain a lux value=13811. When I set to the sensor a gain=1/4 and an integration time=25ms, I obtain another lux value=911608 .

This is my issue, I don’t understand why I have two different values with the same maximum light detection range and the same resolution ( Lux/Bit) ?

Thanks for the help.

You might check out the posts below and see if that helps.

viewtopic.php?f=74&t=51381

Thanks for the answer but I still don’t understand why I have two different lux values with the same maximum light detection range and the same resolution ( Lux/Bit).

I will try to explicate my situation. I have vials with a liquid inside. The vials are numbered. The vial 0 is related with the brightest liquid and the vial 15 is related with the darkest liquid. The vial is posed between the led which emits light and the sensor (VEML6030). More the number of vial is low, more the lux value detected by the sensor is strong. More the number of vial is high, more the lux value detected by the sensor is low.

I made 10 acquisitions of the lux value with the function light.readLigth () of the library Sparkfun_Ambient_Ligth_Sensor_Arduino_Library v1.0.2. With the 10 acquisitions, I obtain the mean value of the lux value, by summing the 10 values and dividing by 10.

I made measurements with the vials which are below. The following measurements are the mean lux values linked with the gain and the integration time for a vial.

Integration time =Integtime

For vial 1 :

Integtime/gain 2 1 1/4 1/8

800

400

200

100 13661.4

50 4686.9 897221.5 11928.6

25 4880 4650.5 825771.68 11962.5

For vial 8 :

Integtime/gain 2 1 1/4 1/8

800

400

200

100 9779.8

50 4079.9 180811.9 8413.1

25 4206.9 4023 190770.09 8630.8

For vial 14 :

Integtime/gain 2 1 1/4 1/8

800

400

200

100 1571.1

50 1780.7 10156.6 1556.4

25 1956.8 1638.2 9860.3 1574.7

We can see that for vial 1, with the gain=1/4 and the integration time=25ms we have 825771.68 lux and with the gain=1/8 and the integration time=50ms we have 11928.6 lux.

After this measurements I have some question.

First of all why the lux value isn’t the same for the same resolution and the same maximum light detection range?

Why the lux values don’t increase or decrease in function of the gain for the same integration time ? (there is no correlation between the gain and the lux values).

Why can I read higher values than the maximum light detection range? (For example for the vial 1 with the gain=1/4 and the integration time=50ms)

Thanks for the help.

Sorry for the tables. The tables are more clear in the documents attached below.

the tables

the tables

Hello, I think I solved one of the problems. There is a bug in the code of github.

Today we have in https://github.com/sparkfun/SparkFun_A … Sensor.cpp the following:

  // Here the gain is checked to get the position of the conversion value
  // within the integration time arrays. These values also represent the bit
  // values for setting the gain. 
  if (_gain == 2.00) 
    _convPos = 0;
  else if (_gain == 1.00)
    _convPos = 1; 
  else if (_gain == .125)
    _convPos = 2; 
  else if (_gain == .25)
    _convPos = 3; 
  else
    return UNKNOWN_ERROR;

I think we have to reverse the gain .125 and the gain .25 like this

// Here the gain is checked to get the position of the conversion value
  // within the integration time arrays. These values also represent the bit
  // values for setting the gain. 
  if (_gain == 2.00) 
    _convPos = 0;
  else if (_gain == 1.00)
    _convPos = 1; 
  else if (_gain == .25)
    _convPos = 2; 
  else if (_gain == .125)
    _convPos = 3; 
  else
    return UNKNOWN_ERROR;

So we have the gain following the table resolution of the hookup guide.

Tell me if I’m correct.

Thanks

The code has been fixed by the author like I said.

There is another release named 1.0.3 without this issue.

After new measurements, an issue remain. For the vial 15, the lux value is equal to 1381.5 to gain=1 and integration time=25, and the lux value is equal to 2521.1 to gain=1/4 and integration time=100.

Why the lux value isn’t the same for the same resolution ?

Thanks.