Sensors and I/O

ADC analog sample

Battery voltage and analog sensors. Attenuation and calibration matter.

Sensors and I/O Analog / battery ESP32 family

Official path: examples/peripherals/adc

01 Overview

Read an ADC channel. Oneshot vs continuous depends on IDF version.

  • Use when: divider for battery, analog inputs.
  • Skip when: metrology accuracy (external ADC).

02 Hardware

  • Resistor divider for battery; respect GPIO max voltage.
  • Analog vs digital ground layout shows up as jitter.
  • Avoid strapping pins as the only sample path.

03 Software flow

1. Channel and attenuation.

2. Calibration when the chip supports it.

3. Average samples; convert to volts and filter.

04 Core points

  • The on-chip ADC is not a meter.
  • Custom work: divider, curve, low-battery shutdown.

中文

传感器与外设

ADC 模拟采集

电池电压、模拟传感器。注意衰减和校准。

传感器与外设 模拟量 / 电池 ESP32 family

官方路径: examples/peripherals/adc

01 项目概述

读 ADC 通道。官方 oneshot/continuous 因版本而异。

  • 适用: 分压测电池、模拟量。
  • 不适用: 高精度计量(要外置 ADC)。

02 项目硬件描述

  • 分压电阻测电池,注意 GPIO 最大电压。
  • 模拟地和数字地布局影响跳动。
  • 不要用 strapping 脚当唯一采样口。

03 项目软件流程描述

1. 选通道和衰减。

2. 校准(若芯片支持)。

3. 多次平均。产品要换算成伏特并滤波。

04 项目核心点

  • ESP32 内置 ADC 不是电表。
  • 可定制: 分压、校准曲线、低电关机。