VEML6030 Interrupt problem

Hy!
I tryed to test the VEML6030 ambient light sensor interrupt function.
I used this libary: LINK

The sensor is ok, the demo program is working good.

I set the persistence, high and low value and turn the interrupt function on.
The interrupt pin is going to LOW when the light value is outside the specificed dimension, but after this not go to HIGH.

I used this code:

void setup(){  
ALS.begin();  //Begin the UV module
  ALS.SetPersistence(1);
  ALS.SetWindow(2000,10);
  ALS.IntOn();
  //ALS.PowerOn();

}

void loop() {
  ALS.AutoRange();
  delay(1000);
  LUX_VALUE = ALS.GetLux(); 
}

Can someone help me what i do wrong?
Thanks!
Benji

As you didn't specify your Arduino model we assume the standard UNO. This board operates at 5V, connecting the VEML6030 to the I2C pins of the UNO may damage the sensor as the datasheet specifies a max. voltage of 3.6V on these pins.

The interrupt pin is going to LOW when the light value is outside the specificed dimension, but after this not go to HIGH.

The datasheet just tells that the interrupt bit is set and the INT pin is pulled LOW in such an event. It doesn't state clearly how to reset it. I would start by simply reading the the bits, maybe this resets them already (GetIntStatus()). If that doesn't not succeed, try to write a 0 into register #6.

pylon:
As you didn't specify your Arduino model we assume the standard UNO. This board operates at 5V, connecting the VEML6030 to the I2C pins of the UNO may damage the sensor as the datasheet specifies a max. voltage of 3.6V on these pins.

The datasheet just tells that the interrupt bit is set and the INT pin is pulled LOW in such an event. It doesn't state clearly how to reset it. I would start by simply reading the the bits, maybe this resets them already (GetIntStatus()). If that doesn't not succeed, try to write a 0 into register #6.

Hy!
Of course not directly connected to arduino board(Uno), I used level converter.
Thanks the answer, I try this solution.

I checked the solution but it didn't work.
I this datasheet LINK read the INT event register is read only.
I tryd IntOff(), IntOn() command but it didn't work

Any other suggestion?

Read the sensor data, i.e. the light level. That usually does the job.

Or maybe it waits for the light level to get back in range, and the interrupt remains set as long as the light level is out of range?

wvmarle:
Read the sensor data, i.e. the light level. That usually does the job.

Or maybe it waits for the light level to get back in range, and the interrupt remains set as long as the light level is out of range?

Properly I want to thest the IC interrupt function. I want to go the arduino in the sleep mode and when the interrupt occours its wake up.

I contacted the Vishay but dont work:

Hello Benjamin,

The correct sequence to enable the interrupt function is firstly , that you should be setting your ALS_INT_EN and threshold window settings whilst ALS_SD =1 , such that the component is not actively measuring when you apply these settings.

In order to test functionality , there is no need to adjust the ALS_PERS settings, so leaving it at 00b à 1 persistence level ok , as you stated.

The threshold levels need to of course fit to your current lighting situation. For this you should make general measurement and see where the count level is. Depending on of you want to detect a high or a low threshold crossing , you need to set the unused threshold to either 0x0000 for low, if not using the low threshold , or 0xFFFF for high , if not using the high threshold. Then you set the threshold that you want to use to a level that is either slightly below or above your current lighting situation, depending on which threshold it is that you are using, after which you can set the ALS_SD = 0 , so that the measurements start . Now changing the lighting situation in the direction of the threshold set , will lead to an interrupt event.

You will be able to see this happen both by monitoring the interrupt that should be pulled high with a pull up resistor (e.g. 10k) and go to low when an interrupt occurs , and by reading the interrupt result register 0x06, to check if the respective bits have been set to high.

After this I tryed with this code:

void setup() {
  
  pinMode(INT, INPUT);

  Serial.begin(500000);  //Begin Serial
  ALS.begin();  //Begin the UV module
  LUX_VALUE = GetLightValue();
  delay(200);
  ALS.Shutdown();
  ALS.IntOn();
  ALS.SetWindow((LUX_VALUE + 500),(LUX_VALUE / 10));
  delay(1000);
  ALS.PowerOn();

  delay(1000);
  
  INT_FLAG = ALS.GetIntStatus();  //Clear the INT register
  
  attachInterrupt(digitalPinToInterrupt(INT), LightInterrupt, LOW);

}

void loop() {

  
}

void LightInterrupt(){
  
  
//  INT_FLAG = ALS.GetIntStatus();

}

The interrupt function work good, the INT pin falling in LOW, but I cant reset it!

Why don't you print out the actual measured light level say 2-3 times a second? Then you know what you're working with.

What do you do to the light levels while testing this, exactly?

You really have to give a much more detailed account of what you're doing if you want informed comments.

wvmarle:
Why don't you print out the actual measured light level say 2-3 times a second? Then you know what you're working with.

What do you do to the light levels while testing this, exactly?

You really have to give a much more detailed account of what you're doing if you want informed comments.

This project is part of an off grid Sun tracking system. It must be work from battery.

Just read #6 register to clear INT.

// clear INT pin
fault |= i2c_Read(VEML6030__ADDR, VEML6030__REG_ALS_INT, 2, (uint8_t *)&LSB_MSB_value.byte);

It works for me. The datasheet doesn't tell how to clear interrupt, but it is similar to other light sensors.