Skip to content

233 ADC Input RC Filter ​

233-adc-input-rc-filter.mc is useful when a sensor signal needs a small low-pass filter before an ADC input. It shows the topology, not a universal ADC front-end recommendation.

Topology:

text
SENSOR_RAW -> R_FILTER -> ADC_IN
ADC_IN -> C_FILTER -> GND

SENSOR_RAW is the unfiltered signal from an upstream sensor. R_FILTER is in series with the signal, and C_FILTER shunts the filtered node to ground. ADC_IN is the named node that an ADC input would sample in a larger design. SENSOR_RAW, ADC_IN, and GND are supplied by the larger design; this focused filter example does not define an ADC or an unrelated voltage source.

The chosen values are 1 kΩ and 10 nF. The nominal cutoff frequency is:

text
fc = 1 / (2 * pi * R * C)
   = 1 / (2 * pi * 1000 * 10e-9)
   = about 15.9 kHz

Real ADC inputs can load this filter. Many ADCs also require a maximum source impedance or enough acquisition time for the sampling capacitor to settle. Treat these values as an illustration of the MCode topology, not as a board-wide recommendation.

The syntax follows 01-basic-circuits/012-rc-low-pass-filter.mc and the shared node style from 02-circuits-with-branches/023-input-rc-esd.mc. CAP.MLCC is the ceramic capacitor subtype from the current mcode library.

Parse 233-adc-input-rc-filter.mc:

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 23-sensor-recipes/233-adc-input-rc-filter.mc --lib mcode --pass1 --pass2

Generate HTML for 233-adc-input-rc-filter.mc:

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 23-sensor-recipes/233-adc-input-rc-filter.mc --lib mcode --viz -o 23-sensor-recipes/233-adc-input-rc-filter.html

Source ​

text
// Example: ADC Input RC Filter
// Goal: Add a simple low-pass filter before an ADC input node.
// Library focus: RES, CAP.MLCC.

module main
{
    io ADC_IN
    io GND
    io SENSOR_RAW

    RES R_FILTER(1000R, 50V)
    CAP.MLCC C_FILTER(10nF, 16V)

    SENSOR_RAW -> R_FILTER -> ADC_IN
    ADC_IN -> C_FILTER -> GND
}

MCode Bench is the public face of the MCode stack. Closed capabilities are served through the MCode gateway.