Experiment No: 07
Name of the Experiment: Implementation of an Analog to Digital Converter using MATLAB program
7.1 Objectives
• To understand the working principle of Analog to Digital Conversion (ADC).
• To implement and simulate a Delta-Sigma ADC using MATLAB.
• To analyze how an analog voltage is converted into its corresponding digital output.
7.2 Theory:
In simple terms, an ADC is an electronic circuit that transforms analog signals (continuous electrical signals that
can vary in voltage or current over time, like those from sensors measuring temperature, pressure, or sound) into
digital signals (discrete binary numbers that digital devices like computers can understand and process).
The following processes are seen in an ADC:
• Sampling: The ADC takes snapshots (samples) of the analog signal at regular intervals. The rate at which
it does this is called the sampling rate.
• Quantization: Each sample's voltage level is then approximated to the nearest discrete value within a
specific range. This process introduces a small amount of error called quantization error. The number of
discrete levels the ADC can represent is determined by its resolution (usually expressed in bits). A higher
resolution means more levels and thus less quantization error.
• Encoding: Finally, each quantized level is converted into a digital code, typically a binary number.
There are several different types of ADC architectures, each with its own trade-offs in terms of speed, resolution,
power consumption, and cost. Some common types include:
• Successive Approximation Register (SAR) ADC: Offers a good balance of speed and resolution and is
widely used.
• Delta-Sigma (ΔΣ) ADC: Known for high resolution and is often used in audio and precision measurement
applications.
• Flash ADC: Very fast but typically has lower resolution and higher power consumption.
• Dual-Slope ADC: Offers high accuracy but has a slower conversion speed.
Here, we are going to implement Delta-Sigma ADC.
Fig. 7.1: Functional Block Diagram of Sigma-Delta ADC
7.3 MATLAB Program
clc
clear all
close all
Fs = 100; % Sampling frequency (Hz)
T = 1/Fs; % Sampling period (s)
t = 0:T:1; % Time vector (1 second duration)
analog_signal = sin(2*pi*t); %Analog input signal
N = length(t); % Number of samples
digital_signal = zeros(1, N); % Initialize digital output
integrator = 0; % Initialize integrator
%Sigma-Delta Algorithm
for i = 1:N
diff_amplifier = analog_signal(i) - digital_signal(max(i-1, 1));
integrator = integrator + diff_amplifier;
if integrator > 0
digital_signal(i) = 1;
else
digital_signal(i) = 0;
end
end
% Plotting the results
figure;
subplot(2, 1, 1)
plot(t, analog_signal, 'b', 'LineWidth', 1.5)
title('Analog Input Signal')
xlabel('Time (s)')
ylabel('Amplitude')
ylim([-1.2 1.2])
grid on
subplot(2, 1, 2)
stairs(t, digital_signal, 'r', 'LineWidth', 1.5)
title('Digital Output Signal')
xlabel('Time (s)')
ylabel('Digital Value')
ylim([0 1.2])
grid on
xlabel('Time (s)')
ylabel('Digital Value')
ylim([0 1.2])
grid on
7.4 Resultant figures
Fig. 7.2: MATLAB Program Outputs (Analog Input and Digital Output)
7.5 Discussion and Conclusion:
The MATLAB program successfully simulated a first-order Sigma-Delta ADC modulator, demonstrating the
conversion of a sinusoidal analog input into a 1-bit digital output stream, thus validating the principles of
oversampling and pulse-density modulation. The output's pulse density effectively represented the analog input's
amplitude, confirming the algorithm's functionality. However, the implementation was limited to the modulator
stage, omitting the necessary decimation filter for achieving a high-resolution multi-bit digital output. The
experiment provided a valuable demonstration of Sigma-Delta modulation within the MATLAB environment,
highlighting its unique approach to analog-to-digital conversion.
Heaven’s Light Is Our Guide
Rajshahi University of Engineering & Technology
DEPARTMENT OF ELECTRICAL & ELECTRONIC ENGINEERING
[Sessional Report]
Course No.: EEE 4210
Course Title: Embedded System design Sessional
Submitted By Submitted To
Name: Prosenjeet Sutradhar Md Mayenul Islam
Roll No.: 1901021 Assistant Professor
DEPARTMENT OF ELECTRICAL &
4th year even semester ELECTRONIC ENGINEERING
Session: 2019-20 RUET
TABLE OF CONTENTS
Exp. no. Exp. title
01 To get familiar with the EdSim51 software
02 Verification of different addressing modes of 8051 microcontroller using EdSim51 software
03 Study of LED and 7-segment display interfacing of 8051 microcontroller using EdSim51 software
04 Study of PLC ladder logics for various motor control operations using Logosoft Comfort Software
05 Study of PLC ladder logics for analog sensor and counter operations using Logosoft Comfort
Software
06 Experimental study of DC motor direction control with interlocking using PLC-V7/EV kit and
Simatic S7-300 software
07 Implementation of an Analog to Digital Converter using MATLAB program
Title of the Project Smart Gas Leakage Detection System
Group members 1901003, 1901021