This example is interactive. Click the play button on any cell to execute it, or run all cells in sequence.

Delta-Sigma ADC

Simulation of a first-order delta-sigma analog-to-digital converter.

You can also find this example as a single file in the GitHub repository.

block diagram of delta sigma adc

Delta-Sigma ADC Principle

A delta-sigma ADC works by:

  1. Oversampling the input signal at a high frequency
  2. Using a 1-bit quantizer (comparator)
  3. Negative feedback through a DAC to shape quantization noise
  4. Digital filtering (FIR) to downsample and reconstruct the signal

The key advantage is that quantization noise is pushed to high frequencies (noise shaping), where it can be filtered out.

The system uses DAC, Comparator, SampleHold, and FIR blocks to implement a complete delta-sigma ADC with digital filtering.

Python
Loading...

System Parameters

We set the key parameters:

  • Clock frequency: 100 Hz (oversampling rate)
  • Reference voltage: 1.0 V
  • FIR filter: 20 taps, cutoff at Fs/50

The input signal is a 1 Hz sine wave, so the oversampling ratio is 100.

Python
Loading...

Block Diagram

We create the blocks for the delta-sigma modulator:

  • src: Input signal (sine wave)
  • sub: Subtractor (input - feedback)
  • itg: Integrator (loop filter)
  • sah: Sample & Hold
  • qtz: Comparator (1-bit quantizer)
  • dac: 1-bit DAC for feedback
  • lpf: FIR lowpass filter for reconstruction
Python
Loading...

Connections

The connections form the delta-sigma loop with digital filtering.

Python
Loading...

Simulation

We use an adaptive solver (RKBS32) with a maximum timestep to handle the discrete-time sampling events properly.

Python
Loading...
12:43:34 - INFO - LOGGING (log: True)
12:43:34 - INFO - BLOCKS (total: 9, dynamic: 1, static: 8, eventful: 4)
12:43:34 - INFO - GRAPH (nodes: 9, edges: 13, alg. depth: 2, loop depth: 0, runtime: 0.083ms)
12:43:34 - INFO - STARTING -> TRANSIENT (Duration: 2.00s)
12:43:34 - INFO - --------------------   1% | 0.0s<0.8s | 2470.4 it/s
12:43:34 - INFO - ####----------------  20% | 0.2s<0.5s | 3059.3 it/s
12:43:34 - INFO - ########------------  40% | 0.4s<0.4s | 2911.9 it/s
12:43:34 - INFO - ############--------  60% | 0.5s<0.3s | 3091.8 it/s
12:43:34 - INFO - ################----  80% | 0.7s<0.2s | 2663.2 it/s
12:43:35 - INFO - #################### 100% | 0.9s<--:-- | 3105.1 it/s
12:43:35 - INFO - FINISHED -> TRANSIENT (total steps: 2402, successful: 2401, runtime: 893.57 ms)

Results

The plots show:

  1. src (blue): Original analog input signal
  2. qtz (orange): 1-bit quantizer output (high-frequency switching)
  3. dac (green): 1-bit DAC feedback signal
  4. lpf (red): Reconstructed signal after FIR filtering

Notice how the 1-bit stream encodes the analog signal, and the FIR filter successfully reconstructs it.

Python
Loading...
Output
Output