0% found this document useful (0 votes)
12 views13 pages

FCS Open Ended Lab MK

Uploaded by

aaliyanpilot9876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views13 pages

FCS Open Ended Lab MK

Uploaded by

aaliyanpilot9876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

FCS Open Ended Lab

To simulate and design hardware of a feedback control


system using Buck converter as plant

Instructor: Sr. Asif Ali Zahoor

Feedback Control Systems (EE-375)


Department of Electrical Engineering
N.E.D University of Engineering and Technology, Karachi

Report Submitted by:


Muhammad Maraj Khan (EE-21020)
Muhammad Umer (EE-21032)
Hamza Syed (EE-21029)
Fareeha Nadeem Nezami (EE-21040)
Aqsa Aijaz (EE-21004)

1|Page
OBJECTIVE:
To develop, simulate, and implement a reliable feedback control system for a Buck
converter, ensuring precise regulation of the output voltage, minimal steady-state error,
and a fast dynamic response under fluctuating input and load conditions. The project
focuses on optimizing the efficiency, stability, and performance of the system through
advanced modeling, controller design, and hardware implementation, bridging the gap
between simulation and practical validation.

COMPONENTS REQUIRED:
1. Arduino Uno
2. IRF540N N-Channel MOSFET
3. 0.5 mH Inductor
4. 4.7 μF Capacitor
5. Diode
6. Potentiometer
7. 1 kΩ, 10 W Resistor
8. 2 9V Battery

INTRODUCTION:
A buck converter, also known as a step-down converter, is a type of DC-to-DC
power converter designed to reduce voltage while increasing current from the input
(supply) to the output (load). Typically, this switched-mode power supply (SMPS)
utilizes at least two semiconductor components, such as a transistor and a diode.
Modern designs often replace the diode with a second transistor for synchronous
rectification. Energy storage components like inductors, capacitors, or both play a
critical role in the operation of the converter. Additionally, capacitor-based filters,
often used alongside inductors, are placed on the input (supply-side filter) and
output (load-side filter) to minimize voltage ripple.

2|Page
CIRCUIT DIAGRAM:

WORKING:

When the circuit is powered on, the MOSFET operates by switching on and off at a
frequency of 3.9 kHz. During the "on" phase, the inductor stores energy, and during
the "off" phase, this stored energy is delivered to the load. Due to the high-frequency
switching, the output voltage becomes a pulsed signal, which is averaged over
time. The output voltage depends on the position of the potentiometer's wiper
terminal relative to the 5V reference. As the voltage between the wiper terminal and
ground increases, the corresponding mapped PWM value on Arduino's pin 10 also
increases.
Since the MOSFET is a voltage-dependent device, the PWM signal directly controls
the voltage across the load. The Arduino generates clock pulses for the MOSFET's
gate at an approximate frequency of 65 kHz, enabling rapid switching. This results in
a stable average output voltage. The MOSFET primarily performs two key functions:

1. Facilitating high-speed switching of the output voltage.


2. Delivering high current with minimal heat dissipation.

When the potentiometer's wiper terminal position is adjusted, the voltage between
it and ground changes, altering the analog value read by Arduino's pin A1. This
updated analog value is then mapped to a range of 0 to 255 and sent to Arduino's
3|Page
pin 5 to regulate the PWM signal.

PROCDEURE:

Step-by-Step Buck Converter Circuit Assembly with Arduino

1. Inductor Connection

• Connect one terminal of the inductor to the positive terminal of the input power
supply.
• Attach the other terminal of the inductor to the cathode of the diode and one
end of the capacitor.

2. Capacitor and Resistor Connection

• Place a capacitor in parallel with a 1 Ω load resistor.


• Connect this parallel combination across the output terminals of the Buck
converter.

3. Power Supply and Diode Connection

• Connect the positive terminal of the DC power supply (battery) to the cathode
of the diode and the inductor terminal connected to the source.
• Attach the negative terminal of the power supply to the source pin of the
MOSFET.

4. MOSFET and Diode Connection

• Connect the anode (positive terminal) of the diode to the drain terminal of the
MOSFET.

5. PWM Signal from Arduino to MOSFET Gate

• Use Arduino's PWM signal from pin 10 to control the gate of the MOSFET for
efficient switching.

6. Arduino Ground Connection

4|Page
• Ensure the GND pin of the Arduino is connected to the negative terminal of the
power supply. This common ground is essential for proper circuit operation.

7. Potentiometer for Input Voltage Adjustment

• Connect one end of the potentiometer to the Arduino’s 5V pin and the other
end to the GND pin.
• Attach the middle (wiper) terminal of the potentiometer to Arduino’s analog
pin A0 to control the input signal.

8. Output Voltage Feedback to Arduino

• Connect the output voltage (measured across the capacitor or the load
resistor) to Arduino’s analog pin A2 for real-time feedback and monitoring.

Problem Identification:

Understanding the Problem:

The initial transient response is a natural reaction of the system to a sudden


perturbation (e.g., releasing the reset button). It can obscure the steady-state
behavior you aim to analyze. Here's how to minimize its impact and improve your
data analysis workflow.

Improving Data Collection:

1. Delay the Start of Data Recording


• Approach: Include a delay in your Arduino code to pause data collection for a
set period after the reset button is released.
• Implementation: Use the delay() function in Arduino or implement a timer to
wait until the system stabilizes.
• Benefit: This avoids capturing unwanted transients in the recorded dataset.
2. Trigger Data Acquisition
• Approach: Use a condition-based trigger to start recording data only when a
predefined system state is reached (e.g., a specific voltage level).
• Implementation: Monitor the voltage or current and start recording when it
crosses a set threshold.
• Benefit: Ensures that only relevant steady-state data is captured.

5|Page
3. Apply Data Filtering
• Approach: Use digital filters to remove noise and smooth the signal.
• Filters to Use:
o Low-pass filter: Removes high-frequency noise.
o High-pass filter: Eliminates low-frequency drifts.
o Band-pass filter: Focuses on a specific frequency range.
• Implementation: Use built-in Arduino libraries or process the data offline in
MATLAB.

Data Analysis in MATLAB:

Once the data is clean and stabilized, MATLAB can be used for in-depth analysis.
1. Data Preprocessing
• Remove Transients:
o Visualize the data and identify the transient region.
o Use MATLAB indexing to exclude these points from further analysis.
• Interpolate Missing Data:
o Use functions like interp1 to fill gaps.
o Example: data_interpolated = interp1(time, voltage, new_time, 'spline');
• Normalize Data:
o Scale the data to a common range for easier comparison.
o Example: normalized_data = (data - min(data)) / (max(data) -
min(data));
2. Data Visualization
• Time-Domain Plots:
o Plot voltage vs. time using plot(time, voltage);.
• Frequency-Domain Analysis:
o Use the fft function to examine frequency components.
o Example: Y = fft(data); plot(frequency, abs(Y));
• Statistical Analysis:
o Compute statistics like mean and standard deviation.
o Example: mean_value = mean(data); std_dev = std(data);
3. Model Fitting
• Fit Models to Data:
o Use MATLAB’s Curve Fitting Toolbox or functions like fit to model the
transient behavior (e.g., exponential decay).
o Example: [fit_result, gof] = fit(time, voltage, 'exp1');

6|Page
• Extract Parameters:
o Obtain parameters like time constants or frequency components
directly from the model.
4. Feature Extraction
• Identify Key Metrics:
o Extract features such as peak values, rise time, fall time, and dominant
frequencies.
• MATLAB Tools:
o Use findpeaks to detect peak values.
o Calculate rise and fall times using slope analysis or threshold methods.

7|Page
We have incorporated code-based simulations to extract time-domain response
characteristics, enabling a comprehensive time-domain analysis of the system.
Additionally, manual calculations were performed to determine the system's
transfer function, assuming an 80% duty cycle.

Manual Calculations:

𝑃𝑒𝑎𝑘 𝑉𝑎𝑙𝑢𝑒 = 2.69

𝑆𝑡𝑒𝑎𝑑𝑦 𝑆𝑡𝑎𝑡𝑒 𝑉𝑎𝑙𝑢𝑒 = 2.62

𝑦𝑝𝑒𝑎𝑘−𝑦𝑠𝑠
𝑀𝑝 =
𝑦𝑠𝑠

𝑴𝒑 = 𝟎. 𝟎𝟐𝟔

𝑀
ln( 𝑝 )
𝜁=− 100
√𝜋2 + 𝑙𝑛2( 𝑀𝑝 )
100

𝜻 = 𝟎. 𝟕𝟓𝟓

𝜋
𝒕𝒑 = = 𝟎. 𝟎𝟏𝟏 𝒔𝒆𝒄
𝑤𝑑

𝜋 𝒓𝒂𝒅
𝒘𝒅 = = 𝟐𝟖𝟓. 𝟓𝟗
𝑡𝑝 𝒔𝒆𝒄

𝑤𝑑 = 𝑤𝑛√1 − 𝜁2

𝑤𝑑 𝒓𝒂𝒅
𝒘𝒏 = = 𝟒𝟑𝟓. 𝟓𝟒
√1 − 𝜁2 𝒔𝒆c

8|Page
𝐺 (𝑆) = 𝑤𝑛2
𝑆2 + 2𝜁𝑤 𝑆 + 𝑤 2
𝑛 𝑛

189701.6769
𝐺(𝑆) =
𝑆2 + 657.6654𝑆 + 189701.6769

𝟏
𝑮(𝑺) =
𝟓. 𝟐𝟕 ∗ 𝟏𝟎−𝟔𝑺𝟐 + 𝟑. 𝟒𝟔𝟔 ∗ 𝟏𝟎−𝟑 + 𝟏

Calculations for Transfer Function (from data of Simulink):


𝑃𝑒𝑎𝑘 𝑉𝑎𝑙𝑢𝑒 = 4.4

𝑆𝑡𝑒𝑎𝑑𝑦 𝑆𝑡𝑎𝑡𝑒 𝑉𝑎𝑙𝑢𝑒 = 3.048

𝑦𝑝𝑒𝑎𝑘−𝑦𝑠𝑠
𝑀𝑝 =
𝑦𝑠𝑠

𝑴𝒑 = 𝟎. 𝟒𝟒𝟑

𝑀
ln( 𝑝 )
𝜁=− 100
√𝜋2 + 𝑙𝑛2( 𝑀𝑝 )
100

9|Page
𝜻 = 𝟎. 𝟐𝟓𝟎𝟖

𝜋
𝒕𝒑 = = 𝟗. 𝟕𝟎𝟑 ∗ 𝟏𝟎−𝟒𝒔𝒆𝒄
𝑤𝑑

𝜋
𝒘𝒅 = = 𝟑𝟐𝟑𝟕. 𝟕𝟓 𝒓𝒂𝒅/𝒔𝒆𝒄
𝑡𝑝

𝑤𝑑 = 𝑤𝑛√1 − 𝜁2

𝑤𝑑
𝒘𝒏 = = 𝟑𝟑𝟒𝟒. 𝟔𝟒 𝒓𝒂𝒅/𝒔𝒆𝒄
√1 − 𝜁2

𝐺(𝑆) = 𝑤𝑛2
𝑆2 + 2𝜁𝑤 𝑆 + 𝑤 2
𝑛 𝑛

11186674.02
𝐺(𝑆) =
𝑆2 + 1677.67𝑆 + 11186674.02

𝟏
𝑮(𝑺) =
𝟖. 𝟗𝟑𝟗 ∗ 𝟏𝟎−𝟖𝑺𝟐 + 𝟏. 𝟒𝟗𝟗𝟕 ∗ 𝟏𝟎−𝟒𝑺 + 𝟏

𝑉𝑜(𝑆) 𝑉𝑠
𝑇(𝑆) = = 𝐿
𝑑(𝑆) 𝐿𝐶𝑆2 + ( 𝑅) 𝑆 + 1

Since,

𝑅 = 1Ω
𝐿 = 0.1𝑚𝐻
𝐶 = 1000µ𝐹
𝑑 = 0.5 − 0.8
𝑉𝑠 = 5𝑉

10 | P a g e
𝑇(𝑆) = 5
0.1𝑚
(0.1𝑚)(940µ)𝑆2 +( 1 )𝑆+1

𝟓
𝑻(𝑺) =
𝟗. 𝟒 ∗ 𝟏𝟎−𝟖𝑺𝟐 + 𝟎. 𝟏 ∗ 𝟏𝟎−𝟑𝑺 + 𝟏

11 | P a g e
Code:
void setup() {
Serial.begin(115200);
pinMode(10, OUTPUT); // PWM out
pinMode(A0, INPUT); // Analog in for set value (100k Pot)
pinMode(A1, INPUT); // Analog in for Vo
pinMode(A2, INPUT); // Analog in for reference

setpwmfreq(4); // 3921 Hz
adcsamplingrate(1); // 15 usec
analogWrite(10, 127); // 50% duty cycle, 100% = 255
}
void loop() {
int adcvalue = analogRead(A0);
float set_voltage = adcvalue * (5.0 / 1023.0); // Read set point from
Pot

adcvalue = analogRead(A1) - analogRead(A2);


float output_voltage = adcvalue * (5.0 / 1023.0); // Read output
voltage

// Adjust PWM based on set_voltage (example logic)


int pwm_value = map(set_voltage, 0, 5, 0, 255);
analogWrite(10, pwm_value);
// Display values
Serial.print("Set Voltage: ");
Serial.println(set_voltage);
Serial.print("Output Voltage: ");
Serial.println(output_voltage);
delay(100); // Optional delay
}
// Functions unchanged
void adcsamplingrate(int sampletime) {
byte PS_16 = (1 << ADPS2);
byte PS_32 = (1 << ADPS2) | (1 << ADPS0);
byte PS_64 = (1 << ADPS2) | (1 << ADPS1);
byte PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

ADCSRA &= ~PS_128;

if (sampletime == 4) {
ADCSRA |= PS_128;
} else if (sampletime == 3) {
ADCSRA |= PS_64;
} else if (sampletime == 2) {
ADCSRA |= PS_32;
} else if (sampletime == 1) {
ADCSRA |= PS_16;
} else {

12 | P a g e
ADCSRA |= PS_128;
}
}

void setpwmfreq(int freq) {


if (freq == 1) {
TCCR1B = TCCR1B & B11111000 | B00000101;
} else if (freq == 2) {
TCCR1B = TCCR1B & B11111000 | B00000100;
} else if (freq == 3) {
TCCR1B = TCCR1B & B11111000 | B00000011;
} else if (freq == 4) {
TCCR1B = TCCR1B & B11111000 | B00000010;
} else if (freq == 5) {
TCCR1B = TCCR1B & B11111000 | B00000001;
} else {
TCCR1B = TCCR1B & B11111000 | B00000011;
}
}

CONCLUSION:
The project began with assembling the Buck converter circuit on a Vero board,
configured to operate at a 50% duty cycle. Experimental data obtained from
the Arduino-based setup was analyzed to determine the system's transfer
function. This transfer function was validated through MATLAB simulations.
A corresponding Simulink model of the Buck converter, also set to a 50% duty
cycle, was developed. The simulated response displayed an underdamped
behavior. Key parameters, such as peak overshoot and settling time, were
extracted from the Simulink model to derive the system's transfer function.
Discrepancies between the experimental and simulated transfer functions
were observed, primarily due to component tolerances and power losses
inherent in the physical setup. Despite these variations, both the experimental
implementation and simulation results were cross-verified mathematically,
ensuring reliability in the finding

13 | P a g e

You might also like