Bird
Raised Fist0
Signal Processingdata~5 mins

ADC and DAC in signal chain in Signal Processing

Choose your learning style10 modes available
Introduction

ADC (Analog to Digital Converter) changes real-world signals into numbers. DAC (Digital to Analog Converter) changes numbers back into real-world signals.

When you want to record sound from a microphone into a computer.
When you want to play music from a computer through speakers.
When you need to process sensor data digitally.
When you want to control analog devices using digital signals.
When converting radio signals for digital processing.
Syntax
Signal Processing
digital_signal = ADC(analog_signal)
analog_signal = DAC(digital_signal)

ADC converts continuous signals into discrete digital values.

DAC converts digital values back into continuous signals.

Examples
This example simulates an 8-bit ADC converting a sine wave into digital values from 0 to 255.
Signal Processing
# Simulate ADC by sampling an analog sine wave
import numpy as np

fs = 1000  # Sampling frequency in Hz
f = 5      # Signal frequency in Hz
t = np.linspace(0, 1, fs, endpoint=False)
analog_signal = np.sin(2 * np.pi * f * t)
digital_signal = np.round((analog_signal + 1) * 127)  # 8-bit ADC simulation
This example simulates a DAC converting digital values back to the original analog range.
Signal Processing
# Simulate DAC by converting digital values back to analog
reconstructed_signal = (digital_signal / 127) - 1
Sample Program

This program creates a sine wave as an analog signal, simulates an 8-bit ADC converting it to digital values, then simulates a DAC converting it back to analog. It plots the original and reconstructed signals to show the effect.

Signal Processing
import numpy as np
import matplotlib.pyplot as plt

# Parameters
fs = 1000  # Sampling frequency (Hz)
f = 5      # Signal frequency (Hz)

# Time vector for 1 second
 t = np.linspace(0, 1, fs, endpoint=False)

# Analog signal: sine wave
analog_signal = np.sin(2 * np.pi * f * t)

# ADC simulation: 8-bit quantization
# Map from [-1,1] to [0,255]
digital_signal = np.round((analog_signal + 1) * 127).astype(int)

# DAC simulation: map back from [0,255] to [-1,1]
reconstructed_signal = (digital_signal / 127) - 1

# Plot signals
plt.figure(figsize=(10, 6))
plt.plot(t[:100], analog_signal[:100], label='Analog Signal (Original)')
plt.step(t[:100], reconstructed_signal[:100], label='Reconstructed Signal (DAC)', where='mid')
plt.title('ADC and DAC Signal Chain Simulation')
plt.xlabel('Time (seconds)')
plt.ylabel('Amplitude')
plt.legend()
plt.grid(True)
plt.show()
OutputSuccess
Important Notes

ADC and DAC introduce small errors called quantization noise.

Higher bit depth in ADC/DAC means better signal quality.

Sampling frequency must be at least twice the highest signal frequency (Nyquist rate) to avoid errors.

Summary

ADC changes real signals into numbers for digital processing.

DAC changes numbers back into real signals for output.

They are key parts of any system that mixes analog and digital signals.

Practice

(1/5)
1. What is the main role of an ADC (Analog-to-Digital Converter) in a signal chain?
easy
A. Store digital data in memory
B. Convert digital data into analog signals
C. Amplify the analog signal before processing
D. Convert real-world analog signals into digital data

Solution

  1. Step 1: Understand ADC function

    An ADC takes continuous analog signals from the real world and changes them into digital numbers that computers can use.
  2. Step 2: Compare options to ADC role

    Only Convert real-world analog signals into digital data describes converting analog signals to digital data, which matches the ADC's main role.
  3. Final Answer:

    Convert real-world analog signals into digital data -> Option D
  4. Quick Check:

    ADC = Analog to Digital conversion [OK]
Hint: ADC always converts analog signals to digital data [OK]
Common Mistakes:
  • Confusing ADC with DAC
  • Thinking ADC amplifies signals
  • Assuming ADC stores data
2. Which of the following is the correct symbol for a DAC (Digital-to-Analog Converter) in a signal chain diagram?
easy
A. A triangle pointing right with 'DAC' label
B. A triangle pointing left with 'DAC' label
C. A triangle pointing right with 'ADC' label
D. A square with 'DAC' label

Solution

  1. Step 1: Recall DAC symbol conventions

    In signal diagrams, DAC is usually shown as a triangle pointing right with the label 'DAC'.
  2. Step 2: Match options to DAC symbol

    A triangle pointing right with 'DAC' label matches this description exactly, while others either have wrong direction or label.
  3. Final Answer:

    A triangle pointing right with 'DAC' label -> Option A
  4. Quick Check:

    DAC symbol = triangle right + 'DAC' label [OK]
Hint: DAC symbol is a right-pointing triangle labeled 'DAC' [OK]
Common Mistakes:
  • Confusing ADC and DAC symbols
  • Choosing left-pointing triangle for DAC
  • Selecting a square shape
3. Consider this Python code simulating a simple ADC conversion of an analog signal sampled at 3 points:
analog_signal = [0.1, 0.5, 0.9]
bit_depth = 2
max_level = 2**bit_depth - 1
adc_output = [int(x * max_level) for x in analog_signal]
print(adc_output)
What is the output printed?
medium
A. [0, 1, 2]
B. [0, 2, 3]
C. [0, 2, 4]
D. [1, 2, 3]

Solution

  1. Step 1: Calculate max_level from bit_depth

    bit_depth is 2, so max_level = 2^2 - 1 = 3.
  2. Step 2: Multiply each analog value by max_level and convert to int

    0.1*3=0.3 -> int=0, 0.5*3=1.5 -> int=1, 0.9*3=2.7 -> int=2.
  3. Final Answer:

    [0, 1, 2] -> Option A
  4. Quick Check:

    2-bit ADC max level 3, scaled values int = [0,1,2] [OK]
Hint: Multiply analog value by max level, then floor to int [OK]
Common Mistakes:
  • Confusing max_level calculation
  • Rounding instead of flooring
  • Misreading bit depth
4. The following code attempts to simulate a DAC converting digital values back to analog signals:
digital_values = [0, 1, 2, 3]
bit_depth = 2
max_level = 2**bit_depth - 1
analog_output = [x / max_level for x in digital_values]
print(analog_output)
However, the output is incorrect for a 3-bit DAC. What is the error?
medium
A. digital_values list is missing values
B. Division should be multiplied by max_level
C. bit_depth should be 3, not 2
D. max_level calculation is wrong

Solution

  1. Step 1: Identify bit_depth mismatch

    The code uses bit_depth=2 but digital_values go up to 3, which fits 2 bits. For 3-bit DAC, bit_depth should be 3.
  2. Step 2: Understand impact on max_level and output

    With bit_depth=3, max_level=7, so dividing digital values by 7 scales correctly. Using 3 causes wrong scaling.
  3. Final Answer:

    bit_depth should be 3, not 2 -> Option C
  4. Quick Check:

    bit_depth must match DAC bits [OK]
Hint: Match bit_depth to DAC bits for correct scaling [OK]
Common Mistakes:
  • Changing division to multiplication
  • Ignoring bit_depth mismatch
  • Assuming digital_values are wrong
5. You have a sensor outputting analog signals between 0 and 5 volts. You want to digitize this signal using a 4-bit ADC and then reconstruct it with a DAC. What is the smallest voltage step (resolution) that the ADC can detect?
medium
A. 5 volts divided by (2^4 - 1) = 0.357 volts
B. 5 volts divided by 2^4 = 0.3125 volts
C. 5 volts divided by (2^4 + 1) = 0.3125 volts
D. 5 volts divided by 2^4 - 1 = 0.3125 volts

Solution

  1. Step 1: Recall the standard resolution formula for an ADC

    The voltage resolution (LSB size) is the full-scale voltage divided by 2^n: V_fs / 2^n, where n is the number of bits.
  2. Step 2: Apply the formula

    Here, V_fs = 5 V, n = 4, so resolution = 5 / 2^4 = 5 / 16 = 0.3125 volts.
  3. Step 3: Match to options

    5 volts divided by 2^4 = 0.3125 volts exactly matches this formula and value. 5 volts divided by (2^4 - 1) = 0.357 volts incorrectly uses (2^4 - 1) and has a miscalculation (5/15 ≈ 0.333, not 0.357).
  4. Final Answer:

    5 volts divided by 2^4 = 0.3125 volts -> Option B
  5. Quick Check:

    Resolution = V_fs / 2^n [OK]
Hint: Resolution = voltage range / 2^bits [OK]
Common Mistakes:
  • Dividing by (2^bits - 1) instead of 2^bits
  • Miscalculating numerical values like 5/15 ≈ 0.333 as 0.357
  • Ambiguous formula parsing in options
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard