README.md
1| Supported Targets | ESP32 |
2| ----------------- | ----- |
3
4# ULP ADC Example
5
6This example demonstrates how to use the ULP coprocessor to poll ADC in deep sleep.
7
8ULP program periodically measures the input voltage on GPIO34. The voltage is compared to two thresholds. If the voltage is less than the low threshold, or higher than the high threshold, ULP wakes up the system.
9
10By default, thresholds are set to 1.35V and 1.75V, approximately.
11
12GPIO15 is connected to ground to supress output from ROM bootloader.
13
14Average current drawn by the ESP32 in this example (with the default 4x averaging) depending on the measurement frequency is as follows:
15
16Measurement frequency, Hz | Average current, uA
17--------------------------|---------------------
18 10 | 8.5
19 50 | 20
20 100 | 37
21
22In this example, the `CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP` Kconfig option is used, which allows you to reduce the boot time of the bootloader during waking up from deep sleep. The bootloader stores in rtc memory the address of a running partition and uses it when it wakes up. This example allows you to skip all image checks and speed up the boot.
23
24## Example output
25
26Below is the output from this example.
27
28```
29Not ULP wakeup
30Entering deep sleep
31
32Deep sleep wakeup
33ULP did 1531 measurements
34Thresholds: low=1500 high=2000
35Value=973 was below threshold
36Entering deep sleep
37
38Deep sleep wakeup
39ULP did 2 measurements
40Thresholds: low=1500 high=2000
41Value=0 was below threshold
42Entering deep sleep
43
44Deep sleep wakeup
45ULP did 2 measurements
46Thresholds: low=1500 high=2000
47Value=0 was below threshold
48Entering deep sleep
49```
50