AN3248
Analog voltage monitoring
Doc ID 17758 Rev 1
5/19
1
Analog voltage monitoring
The STM32L15xxx embeds a 12-bit analog-to-digital converter (ADC) which is very fast with
a sampling rate of 1 Msample/s. However, with a 1.45 mA typical consumption, it can
jeopardize battery life time if left powered-on continuously. It is therefore recommended to
use analog comparators in application cases when analog input voltage (sensor output)
needs to be measured as soon as a pre-defined threshold is exceeded. In STM32L15xxx
devices, analog comparators are useful for monitoring the analog input voltage and
powering on the ADC when it is required. While monitoring the analog voltage, the device
can enter Stop mode at the same time that both comparators are still powered on.
Consequently, better consumption is achieved and power is saved.
Note:
Analog comparators are powered by the internal reference voltage, V
REFINT
, which is still
powered on in Stop mode, and can be disabled by configuration. Once V
REFINT
is disabled,
the comparators can no longer be used.
In an analog voltage monitoring application, where the sensor output voltage is lower than
the threshold, the MCU remains in Stop mode thereby saving power. As soon as the sensor
output exceeds the threshold, the MCU is woken up, the ADC is powered on, and the analog
input voltage is measured. When the sensor output is under the threshold, the MCU re-
enters Stop mode.
Average power consumption is dramatically reduced when compared with an application
that continuously measures the analog voltage whatever the input value.
Figure 1
shows how to connect a sensor output (temperature sensor, pressure sensor,
pyroelectric infrared detector, photodiode sensor) to an STM32L15xxx device in an analog
voltage monitoring application using comparator 2 (COMP2). COMP2 monitors the analog
voltage in Stop mode while the ADC measures it in Run mode.
Figure 1.
Sensor output connection to COMP2
1.
Legend for
Figure 1
ADC_CHx: AC channel x
COMP2_INP: comparator 2 non-inverting input
2.
Only if required.
!NALOGVOLTAGE
3ENSOR
!MPLIFIER
&ILTER
!$##(X
#/-0).0
34-,XXX
AI