AN3248
The top part of
selected threshold (COMP2 inverting input) defines the limit of dark/light. The bottom part of
Figure 13
on light intensity. Using EXTI line 22 (which is internally connected to CMP2OUT), the
microcontroller can detect the CMP2OUT level switch (from a high level to a low level or vice
versa).
Figure 13. Comparator output behavior versus light intensity
The LDR resistor can be used in other microcontroller based applications rather than
darkness control (for example: DC relay control and AutoFocus).
For other uses of analog comparators using LDR resistors, refer to the STM32L152-EVAL
demonstration firmware. In this demonstration, the LCD glass contrast is adjusted according
to the luminosity detected using the LDR resistor.
Brightness control using a light dependent resistor (LDR)
Figure 13
shows the evolution of V
shows that COMP2 output (CMP2OUT) level depends on V
Doc ID 17758 Rev 1
as a function of light variation. The
IN
IN
and consequently
17/19
Need help?
Do you have a question about the AN3248 and is the answer not in the manual?
Questions and answers