ADC front end: reference and anti-alias filter
Sampling at 1 kHz can only represent signals below 500 Hz; anything faster (here 3 kHz interference) folds down and looks like a false slow signal. An RC low-pass in front of the ADC removes it first. A TL431 2.495 V reference on a second pin lets the sketch correct the ESP32’s inaccurate ADC.

Open this lesson in the labFree, in your browser, no account needed.
How it works
Corner f_c = 1 ÷ (2π·R·C) = 159 Hz. At 3 kHz the filter passes 1 ÷ √(1 + (f ÷ f_c)²) = 0.053 of the interference.
The TL431 regulates its cathode to 2.495 V; the ESP32’s ADC reads it a few percent off, and the sketch divides that error out.
Try it on the bench
- Set the interference to 100 Hz: it passes almost untouched, as a real signal should.
Parts on the bench
- Bench power supply
- ESP32 DevKit
- USB charger / port
- Function generator
- 2 × Resistor
- Ceramic capacitor
- TL431 reference
In the course
Electronics Engineering, module “Op-amps and feedback”.