# DC-DC Converter - help needed

#### stefikovac

Joined Dec 31, 2020
4
Hello Everyone,
I am building a buck-boost converter for my exam. I use a 9V battery to provide the input voltage and an arduino to provide the PWM signal for the mosfet (IRLZ44N). It operates at 60 kHz. When I change the duty cycle with the potentiometer it works fine in buck mode but as soon as it reaches a higher voltage range (when it is in boost mode) it just suddenly goes back to zero volt. The same happened with and without load resistor. Why is that? I might have just overlooked something obvious, I don't know. Any help would be appreciated. Components used: 1N5819 schottky diode, IRLZ44N mosfet, 220uF/35V electrolytic capacitor, 33uH/3A inductor, 100kohm potentiometer.

#### djsfantasi

Joined Apr 11, 2010
7,689
Hello Everyone,
I am building a buck-boost converter for my exam. I use a 9V battery to provide the input voltage and an arduino to provide the PWM signal for the mosfet (IRLZ44N). It operates at 60 kHz. When I change the duty cycle with the potentiometer it works fine in buck mode but as soon as it reaches a higher voltage range (when it is in boost mode) it just suddenly goes back to zero volt. The same happened with and without load resistor. Why is that? I might have just overlooked something obvious, I don't know. Any help would be appreciated. Components used: 1N5819 schottky diode, IRLZ44N mosfet, 220uF/35V electrolytic capacitor, 33uH/3A inductor, 100kohm potentiometer.
Perhaps you should share your schematic? Otherwise, how could you expect someone to help. All of our crystal balls are in the shop...

And your code. Click on the ellipsis (...) icon and select “Code”. Paste your code between the “][“ characters.

#### stefikovac

Joined Dec 31, 2020
4
Code:
const int pwm = 5;
const int potinput = A0;
const int feedbackinput = A1;
int potinputval;
int feedbackinputval;
int pwmval;

void setup() {
TCCR0B = TCCR0B & B11111000 | B00000001; // for PWM frequency of 62500.00 Hz
pinMode(pwm, OUTPUT);
pinMode(potinput, INPUT);
pinMode(feedbackinput, INPUT);
digitalWrite(pwm, LOW);
pwmval = 0;
}

void loop() {
while (feedbackinputval < potinputval){
if (pwmval > 203){
analogWrite(pwm, pwmval);
}
else {
analogWrite(pwm, pwmval);
pwmval = pwmval + 1;
}}
while (feedbackinputval > potinputval){
if (pwmval == 0){
analogWrite(pwm, pwmval);
}
else{
analogWrite(pwm, pwmval);
pwmval = pwmval - 1;
}}
}

#### stefikovac

Joined Dec 31, 2020
4

#### stefikovac

Joined Dec 31, 2020
4
There is an op amp (MCP602) to give feedback to the arduino.

#### djsfantasi

Joined Apr 11, 2010
7,689
Thanks for supplying that. It’s New Year’s Eve and I’m not going to read the code. Same for the schematic. Hopefully, someone can help with the schematic. My strength is the code.

#### LesJones

Joined Jan 8, 2017
3,172
Draw what you THINK the waveform will look like at the top end (The end connected to the mosfet source.) of the inductor showing the value of the most positive voltage you hope to see. I will assume the gate drive to the mosfet is a square wave with a low value of zero volts and a positive value of + 5 volts. Just draw what you expect with about 50% duty cycle. Also what do you think the voltage will be at that point when the duty cycle is 100% . (I.E The moset gate is at + 5 volts.) I think doing that will make you see some problems with your design. As this will be classed a homework we only try to guide you. We do not do the work for you.

Les.

Last edited:

#### Ian0

Joined Aug 7, 2020
2,192
You think that feedback scheme might be stable? What does your Bode plot look like? Where is your anti-aliasing filter? What is your sample rate?