This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OPT3004: How to get interrupt from ALS only once after crossing the threshold value.

Part Number: OPT3004

Hi Support Team,

I am using OPT3004 with STM32. The STM has a configured i2c and an interrupt.

I have set the upper threshold as 150(lux) and lower threshold as 25(lux) .Now when ever the light intensity goes above the upper threshold the ALS gives continuous interrupt until light intensity is below 150. But I need only one interrupt when the light intensity is above the limit. Is there a way to configure the device for getting a single interrupt?  

The same is seen with the lower interrupt.  

Please let me know of any possible configuration for this.

Regards,

Arin.

  • Hi Arin,

    If you are able to trigger only on the rising or falling edge then you can do this. However, you cannot directly on the device only ask for an interrupt the first time a fault occurs and not subsequent times.

    Best,

    Alex

  • Hi Alex,

    Thank you for the quick response.

    I have configured STM32 for interrupt only in falling edge.

    The use case is that the STM32 will be in sleep mode(Low power mode) and will wake up only when there is an interrupt from ALS. Upon waking the STM32 will do some task and again go to sleep mode.

    So if ALS is giving interrupt  continuously when ever the light intensity is above the upper threshold limit and below the lower threshold limit, then STM32 will wake up continuously. 

    I have tried to different ALS configurations but nothing worked. Once above the upper threshold (or below lower threshold limit ) the ALS gives interrupt continuously until light intensity is below the upper threshold limit.(or above the lower threshold limit)  

    Is there any way by which this can be done?

    Regards,

    Arin

  • Hi Arin,

    Are you using latched interrupt mode? Then you still not get another interrupts until you read the config register to read the INT. Another option is to use the threshold mode rather than latching to have INT go high when over threshold and low when below. Then you trigger on rising and falling edge to get interrupt only when the state changes.

    Best,

    Alex