esp-idf/examples/system/ulp_adc
Wangjialin 2fceec4d85 feature(I2S-ADC): add ADC mode for I2S.
1. Support built-in ADC for I2S.
2. Modify code of ADC, made no change to the original APIs.
3. Add APIs in I2S:
esp_err_t i2s_set_adc_mode(adc_unit_t adc_unit, adc1_channel_t adc_channel);
4. Add I2S ADC/DAC example code.
5. add old-fashion definition to make it more compatible
6. replase spi_flash_ APIs with esp_partition_ APIs
7. add example of generating audio table from wav
8. change example sound
2017-09-14 13:24:08 +08:00
..
main feature(I2S-ADC): add ADC mode for I2S. 2017-09-14 13:24:08 +08:00
Makefile examples: add ULP ADC example 2017-05-16 13:15:02 +08:00
README.md examples: add ULP ADC example 2017-05-16 13:15:02 +08:00
sdkconfig.defaults sdkconfig: set CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 by default 2017-05-25 10:51:39 +08:00

ULP ADC Example

This example demonstrates how to use the ULP coprocessor to poll ADC in deep sleep.

ULP 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.

By default, thresholds are set to 1.35V and 1.75V, approximately.

Average current drawn by the ESP32 in this example with the default configuration (10Hz measurement period, 4x averaging) is 80 uA.

Example output

Below is the output from this example. GPIO15 is pulled down to ground to supress output from ROM bootloader.

Not ULP wakeup
Entering deep sleep

Deep sleep wakeup
ULP did 1531 measurements
Thresholds:  low=1500  high=2000
Value=973 was below threshold
Entering deep sleep

Deep sleep wakeup
ULP did 2 measurements
Thresholds:  low=1500  high=2000
Value=0 was below threshold
Entering deep sleep

Deep sleep wakeup
ULP did 2 measurements
Thresholds:  low=1500  high=2000
Value=0 was below threshold
Entering deep sleep