Go Down

Topic: buck converter not working (Read 453 times) previous topic - next topic

puneet1984

Feb 22, 2019, 06:46 am Last Edit: Feb 22, 2019, 06:47 am by puneet1984
hello

New to arduino and from a not technical background.

Assembled a buck converter as per the wiring diagram but due to some reason not able to get output above 1-2 volts.

IRFZ44N mosfet
12V lead acid battery as power supply for buck converter
5V supply for arduino, ground of lead-acid connected to the arduino.

would be extremely thankful if someone can guide me in the right direction.

Code: [Select]

/for testing purpose with manual PWM cycle


#define pwmpin 9
#define vdpin A1
#define potpin A0

int Vdread = 0; //voltage divider raw reading
int Potread = 0; //potentiometer raw reading
float Volt = 0.00;

void setup() {
  // put your setup code here, to run once:

  TCCR1B = TCCR1B & 0b11111000 | 0x01;  //increase PWM freq to 31KHz , timer 1 pin D9

  pinMode(vdpin, INPUT); // voltage divider read
  pinMode(pwmpin, OUTPUT); // PWM mosfet gate
  pinMode(potpin, INPUT);  //pot read

  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:

  Vdread = analogRead(vdpin); //raw reading of voltage divider
  Potread = analogRead(potpin) / 4;
  //  Volt =  (5.00 / 1024.00) * Vdread * 10.9;

  // averaging 10 readings of voltage divider
  int i = 0;
  float sum = 0;
  while (i < 11) {
    sum +=  (5.00 / 1024.00) * Vdread * 10.9;
    i++;
    delay(10);
  }
  Volt = sum / 10;

  // maping PWM duty cycle with potentiometer value
  int pwmcycle;
 // Potread = 128;
  pwmcycle = map(Potread, 0, 255, 0, 100);
  analogWrite (pwmpin , Potread);
  Serial.println("output Volts " + String(Volt));
  Serial.println("PWMreading =" + String(pwmcycle) + "%");
  Serial.println("pot reading " + String(Potread));

  //resetting variables
  i = 0;
  sum = 0;
  delay(500); // Delay a little bit to improve simulation performance (0.5 sec)
}

ReverseEMF

#1
Feb 22, 2019, 07:27 am Last Edit: Feb 22, 2019, 07:42 am by ReverseEMF
Here are those image attachments -- so I, and others, don't have to download them:






And, I have to say -- pretty darn difficult to tell what is going on from these photos.  A schematic would help, immensely. 

But, some notes:

  • Is that red wire just laying in the mounting hole of that transistor?  That could be a contributer.  I suggest you actully plug it into the breadboard [the middle pin is the Drain].  Google "Contact Resistance".
  • And your inductor is that big ol' nasty chunk of iron.  Almost certainly WAY TOO MUCH inductor -- especially at 32kHz!  More like 60Hz--but, then, what would be the point?! You can't just throw any ol' inductor on there, and expect it to work. 
  • Diode needs to be some sort of Fast Recovery diode, like a schottky diode [can't tell what it is from the photos]
  • Can't see what value those resistors are.  And, what is that white rectangular thing, with the vampire fangs?  A power resistor?  Some sort of Capacitor?
  • Long wires plugged into a protoboard is also problematic.  Better to use wires that are as short as possible, and do a "proof of concept" at low current levels, and keep the inductor, the switching diode, filter capacitor and MOSFET, as close together as possible, there are potentially high currents involved and long wires will not only introduce game changing voltage drops, but also inductance, and even noise.  And, consider hard wiring this, instead of using a protoboard, because, again, contact resistance.
  • That 1/2 second delay seems all wrong.  Unless there's a very large capacitor and a very small load [i see the word "Simulation", so I suppose this is feasible in that context], otherwise, you want this loop to go fast, so it keeps up with what's happening across the filter capacitor, and keeps the voltage at the target, with as little ripple as possible.


A Switch Mode Buck Converter is a VERY ambitious project for someone just starting out in electronics.  I would have to write several more paragraphs to even begin to cover all the issues involved here.  Like, proper component selection [huge topic], proper circuit layout [preferably on a PCB], inductors [another huge topic], etc.

BTW: have a look at the following two links.  They will help you, help us, to help you:

http://forum.arduino.cc/index.php?topic=149015.0
https://forum.arduino.cc/index.php?topic=364156.msg3749026#msg3749026


"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

puneet1984




Thanks reverseEMF, That was fast.

to answer your questions,

1) i tried placing it in the breadboard as well but there was no change so placed in the hole for no reason and took pic at that time. (my bad)

2) I tried 3-4 inductors and then decided to wind my own on a powder ferrite bobbin and core. (around 300 turns of AWG 26 wire)

3) this diode is 1N4007 but have  tired using MBR 360 also and same results

4) 100K and 10K resistor voltage divider connected to pin A1.

5) the white thing is a 5ohm 10W power resistor for simulating load

6) had attached a cap also (65v 1000uF) at output but removed it to check if it makes any difference.

7) this is the standard size dupont wires i am getting in my local store. I wish to make it on PCB but first want to make sure it works.

will try to use a small inductor and make the circuit more compact and will update the results then.
Also i tried using a BC547 transistor as mosfet driver and i could get around 8-9 volts with 100% duty cycle but then again its not efficient.

BTW - i am trying to build a MPPT solar charge controller using all this.
Presently i am using LM2596 as the buck converter with voltage set at 14V on 100W solar panel but that's not efficient i feel. your views are most welcome. (100W solar panel)


ReverseEMF

#3
Feb 22, 2019, 08:13 am Last Edit: Feb 22, 2019, 08:31 am by ReverseEMF
It's getting past my bedtime, but a couple more notes:
  • I'm amazed this is even working at all! ;)  You're driving an N-Channel MOSFET on the "High Side", that is switching 12V, using 5V on the Gate.  You're getting lucky with Gate Threshold on that one.  To do this properly, you need to drive the Gate at a full 12V, and for that, you need another transistor.  Perhaps someone else will chime in with that -- or, tomorrow I'll do an update.
  • Also, to really get good action from the inductor, you need good, fast switching -- driving a MOSFET directly from an Arduino pin usually won't cut it [again, in the context of efficiency].  Especially since the IRFZ44N really isn't a "Logic Level" MOSFET.  To get good switching, you have to not only drive the transistor, you have to drive the capacitance on the gate.  For that, you need some decent current drive -- something an Arduino pin just can't supply.  Also, the voltage on the Gate needs to be high enough to open the channel enough, for the proper amount of current to flow.  This transistor Thresholds at 2 to 4V, which means, that's when it starts to turn on.  To properly drive the inductor, you need it to turn all the way on.  That happens at around 15V.  But, 12V is sufficient.
  • You have a Ground Symbol on the Anode of your Diode, AND a line labeled "Gnd Pin".  Same thing?
  • 1N4007 not fast enough for this kind of thing.  If you want efficiency, use a Schottky Diode.
  • I'm assuming you left out the connection back to A1 [in between the two series resistors?]
  • Inductor selection is critical.  Not just any inductor will work [especially if efficiency is your goal].
  • Layout is also critical -- though at 32kHz, you can get away with more.
  • Haven't had time to study your code.


Good night.
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

Grumpy_Mike

It is impossible to make a buck converter on a breadboard even if the circuit is correct. I have managed professional specialist power supply engineered and never had one that took less than three attempts at making a buck converter PCB layout work. The layout is super critical.

In fact all the components are super critical you can't just put any old components in. The inductor you use is absolutely massive, far too massive to work.

As you are not technical do yourself a favour and buy one. Even the cheap eBay ones are crap and don't work correctly at currents larger than about 500mA despite what they say in the description.

I just bought this one yesterday
https://uk.farnell.com/murata-power-solutions/okr-t-3-w12-c/converter-dc-to-dc-4-5v-to-14v/dp/1736768?CMP=i-ddd7-00001003

jackthom41

I think everything is already discussed here, I just want to post a quick note. I have worked on buck converter and IRFZ44N didn't work well with my specification. I have switched to IRF3205, as its a fast switching MOSFET.
Technopreneur

MarkT

The lower the switching frequency the less critical the layout, but then the capacitors and inductors have to
be bigger / higher value.  The inductor needs to be right, you won't have luck if you don't understand something
about ferrite cores and choosing them.  Laminated iron-cored inductor is completely wrong.

Power conversion is hard, this is going to be an area of frustration and failure if you are a beginner I suspect.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

ReverseEMF

#7
Feb 22, 2019, 04:12 pm Last Edit: Feb 22, 2019, 04:14 pm by ReverseEMF
OK, BIG caveat: As far as my engineering skills go, I should stick with blinking LEDs and programming MCUs.

BUT, if you're like me, and have the tenacity, and drive, and foolishness to fail over-and-over for hours, and even days/weeks/months...  Then have a look at this:



I admit, I've never tried a Buck Converter [but, I do have a few Boost feathers in my cap -- but only for current regulating LEDs, which are easier than most].  SO, there is probably a lot wrong with that diagram [things missing, like snubbers, and such, no EMI filtering, and all those other things I don't know about ;)], but, perhaps its a place to start.
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

MarkT

7) this is the standard size dupont wires i am getting in my local store. I wish to make it on PCB but first want to make sure it works.

You need wires designed for some current, I wouldn't trust signal wires like that.  0.6 to 0.7mm copper
solid core wire will work in female headers and breadboards and will take reasonable amounts of current
(more than a breadboard can handle).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

ReverseEMF

#9
Feb 22, 2019, 07:01 pm Last Edit: Feb 22, 2019, 07:11 pm by ReverseEMF
You need wires designed for some current, I wouldn't trust signal wires like that.  0.6 to 0.7mm copper
solid core wire will work in female headers and breadboards and will take reasonable amounts of current
(more than a breadboard can handle).
And, here's a couple of sources for that [22 Guage is probably the best bet]:
~ https://www.allelectronics.com/category/825480/wire/cable/solid-hook-up-wire-25-roll/1.html
~ https://amzn.to/2E7TqBJ

And Wire Strippers:
~ https://amzn.to/2ErcMmD
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

PerryBebbington

Puneet1984

I have to say I am impressed by your efforts and willingness to try and try again and to learn from what you are doing. I've no advice that hasn't already been given other than keep going!

++Karma.

puneet1984

Thanks a lot for the help.

I am surgeon by profession from India and arduino is my newly found interest. So I usually can find 3-4 hours in a week for the arduino projects.

You need wires designed for some current, I wouldn't trust signal wires like that.  0.6 to 0.7mm copper
solid core wire will work in female headers and breadboards and will take reasonable amounts of current
(more than a breadboard can handle).

The lower the switching frequency the less critical the layout, but then the capacitors and inductors have to
be bigger / higher value.  The inductor needs to be right, you won't have luck if you don't understand something
about ferrite cores and choosing them.  Laminated iron-cored inductor is completely wrong.

Power conversion is hard, this is going to be an area of frustration and failure if you are a beginner I suspect.
I agree with you Mark and i am just trying to make it work before mounting it on a PCB with with good connections and sufficiently large tracks.

Secondly, i am using 31KHz frequency for the PWM, do you think i should reduce it to get this homemade buck converter workable. I am not using laminated iron cored inductors. I am using a bobbin and powder ferrite core. If you can guide me regarding approx value of the inductor I should use so that i can buy it.

Puneet1984
I have to say I am impressed by your efforts and willingness to try and try again and to learn from what you are doing. I've no advice that hasn't already been given other than keep going!
++Karma.
Thanks a lot Perry. hope I succeed at the end.


Also, I have tried putting a BC547 NPN transistor with the series resistor to drive the mosfet and i got upto 8 Volt bucking. please let me know your views.




Secondly, is there any way i can change the duty cycle on the LM2596-ADJ SMPS buck converter via arduino autonomously. I have few LM2596 lying around and i can make a buck converter out of those but those have a manual pot for change of the output current, so is there any way to change the pot value digitally.

wvmarle

I agree with you Mark and i am just trying to make it work before mounting it on a PCB with with good connections and sufficiently large tracks.
It's not "sufficiently large tracks". Placement of components in respect to one another matters. Shape and location of the track matters. Exact part matters (getting the correct inductor mostly). A suitable diode: not a slow 1N400x (it has a 1 ms reverse recovery, your frequency of 31 kHz means a 0.3 ms period, half of which the diode should be conducting, half of which it should be blocking, so it's at least two orders of magnitude too slow). Probably even the puny 1N4148 will do a lot better (1 ns reverse recovery; three orders of magnitude faster and in the ballpark for the Schottky diodes you should use) but it can't carry much current and still has that large voltage drop.

Why even start with a kind of circuit that is a serious challenge for experienced electrical engineers? There are so many other projects that you can try, and which will give you useful results. This one almost certainly will not, and only causes frustration if only because you basically have no clue what you're doing.

a manual pot for change of the output current, so is there any way to change the pot value digitally.
Connect a servo to it, turn the pot with the servo.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

puneet1984

Quote
Schottky diodes you should use
Yes, as suggested i have switched to MBR360 schottky Diode.

Quote
Why even start with a kind of circuit that is a serious challenge for experienced electrical engineers? There are so many other projects that you can try, and which will give you useful results. This one almost certainly will not, and only causes frustration if only because you basically have no clue what you're doing.
Yes i understand that this buck converter construction is way ahead in my learning curve and i am sure that i will fail to make one at this moment and i should look for other interesting projects to work on.

I initially started working on arduino as i wanted to make a MPPT solar charge controller for my DIY project, but now I feel that i need to stick to LM2596 for the buck conversion with fixed output and thus no MPPT just a PWM charge controller.

Quote
Connect a servo to it, turn the pot with the servo.
Servo will not give so fine calibration which may be required.

Go Up