Switch mode power supply problems

Hey! I have problems building my own boost converter. It gives around 300V with duty cycle of 50, and if i lower the duty cycle to <10, i can get 5v, thats what i want. The problem is current: I can’t get enough current from it. I have code that adjusts the duty cycle if voltage difference is detected. Duty cycle rises up to 60(i don’t let it go higher, because overheat), and it gives me around 2V. What i should do? Does parts need upgrade or does that occur from wrong value of inductor? I don’t have scope, so i can’t really look the behavior of this circuit. I think it might oscillate at wrong frequency or something like that. Arduino code is kinda simple: (yeah, that is only the loop because there is nothing to see in the settings void (except DDRD = 1<<PD2;)

PORTD = 1<<PD2;
PORTD = 0<<PD2;

Argh… Why does this forum have the 5 min wait time? My circuit’s picture wasn’t able to upload check it there:

It might help if we can see a schematic… :wink:

Hey! I have problems building my own boost converter.

Not surprising… It’s not an easy thing to build unless you use the right switching-regulator chip and follow the manufacturer’s recommended circuit… And, it can still be tricky.

It gives around 300V with duty cycle of 50, and if i lower the duty cycle to <10, i can get 5v, thats what i want.

You don’t directly “set” the duty cycle. The duty cycle is controlled by the voltage-feedback, and that’s how the voltage is regulated. If you have an oscilloscope you can check the frequency and duty cycle to see if they are in the correct-expected range, and if not you can tweak your hardware.

It gives around 300V

And, that’s why it’s dangerous to design your own switching power supply. It’s slightly dangerous to your health and very dangerous to your 5V circuitry.

You might want some sort of fail-safe, such as a zener diode and a fuse. If something goes wrong, it’s usually better if the power supply burns-up rather than the electronics or the humans…

Arduino code is kinda simple: (yeah, that is only the loop because there is nothing to see in the settings void (except DDRD = 1<<PD2;)

I’m not sure what you’re trying to do with the Arduino. If you want the Arduino to control a variable-voltage, it has to be part of the feedback-loop. If you want a constant 5V, you don’t need a microcontroller or software. If you want to do that, build a fixed supply first and after it works reliably, then add the digital control.

Hey! That was just now running “debugging” code, because my other, more complex code slows it down. I can get stable 5v with it, because it changes the cycle based on the output voltage. But it isn’t fully real time code. I’ll put the code here, and if you have any time, please give feedback and if you know some improvements, please tell:

Serial is just for debugging, and it slows this down more.
And i mean with stable 5v that it is not going over the 5v.

And btw the schematics can be found from the link at the bottom of first post, but i put it here again:

float denominator, oldtime;
int resistor1 = 22000;
int resistor2 = 1000;
int duty, lowd, highd;
int treshold = 0;

void setup() {
  denominator = (float)resistor2 / (resistor1 + resistor2);
  DDRD = 1<<PD2;

void loop() {
PORTD = 1<<PD2;
PORTD = 0<<PD2;

float voltage;
voltage = analogRead(0);
  voltage = (voltage / 1024) * 5.0;
  voltage = voltage / denominator;
  if(voltage < treshold) {
  if(voltage > treshold) {
  if(duty > 90) {
    duty = 90;
  if(duty < 1) {
    duty = 1;
  highd = duty;
  lowd = 100-duty;

if(millis() - oldtime > 200) {
  treshold = map(analogRead(1), 0, 1023, 5, 50);
  Serial.print("Volts: ");
  oldtime = millis();
  Serial.print("Duty: ");
  Serial.print("Treshold: ");

Don't make us go to another web site for your image. Attach it here with your post.


I can't put it there. The forum just says some error and put me 5min wait time, so i can't try again.

Your web site tries to force us to join AAC.

You can attach a file here, you may have to reduce the resolution. Use jpg or png.


It was already 1000x740, now reducing it to 800x600 :stuck_out_tongue:

“here was a problem during the uploading of smps.jpg.
Your post has been made, however the above attachment was not attached. Please use the Back button to edit your post and submit any required changes.”

Fixed it with changing my editing program from gimp to photoshop...


Normal diode? You need a fast switching schottky diode.

BJT? You need a low Rds(on) MOSFET, not a BJT. Power BJTs are obsolete and highly inefficient in such a role.

3300uH?! I'm no expert on DC-DC converter design, but that looks huge. Last night I assembled a bunch of boost converters with 4.7uH inductors, and most of the switching regulator IC's I have spec a 1~22uH inductor.

Are you building it on breadboard or prototyping board by any chance? You do realize that with buck/boost converters and SMPS, you have to keep certain paths short. Breadboard is totally unsuitable; a book on SMPS design that I was looking at recently described breadboards as "kryptonite" to switching supplies.

Also, typically "SMPS" refers to ones that use a transformer or "coupled inductors" and normally run off rectified mains AC, while normal buck/boost converters are referred to as DC-DC converters.

Why are you building your own switching regulator with your own control scheme when: a) You don't seem to have much familiarity with design of DC-DC converters nor relevant components. b) Parts are available that are dedicated to controlling DC-DC converters (ex, LM2956 XL6009, etc) which handle the control and switching for you, and you just put appropriate feedback resistors and external components in (ones that do the control, but use external transistor are also available) c) Assembled buck and boost converters are readily available at all points along the quality/cost spectrum (digikey at the expensive end, pololu in the middle, and ebay for the cheap ones); Even the $1 converters from ebay have basic functionality.

I made it: 1) Because i need to know how it works, how it behaves and i'm going to learn about it 2) Chinese converters are awful, i need powerful and trustful (i know diy is not always the best solution but beats cheap badly made Chinese things)

And i have schottky, but it seems to be worse than that damper diode. I will try with MOSFET, but i have one question about them: What if gate treshold voltage is greater than the maximum voltage on the datasheet? Will IRF3205 work with 5v control voltage?

Inductor might be too big, i have no idea about that, because i can't really know how this circuit even works, because i have no oscilloscope. This is pretty low frequency, so i need big inductor (i think). I don't know a lot of inductors as you might already note.

Breadboard is because i'm just testing and figuring out how this works, what is the best solution to make it work and so on.

But thanks for your advice, now i know a lot more :)

If you don't have a scope, and say you "don't know how the circuit works", you need to do more learning about DC-DC converters, and maybe basic electronics as well (not sure what you know)

No, you must use a MOSFET where the rated gate voltage (ie, a gate voltage for which a current and on state resistance is specified - not gate threshold voltage, which is much lower). The IRF3205 is not suitable for 5v control - you must get one with a "logic level gate" (you can filter digikey mosfets based on logic level gate - there are many options).

Is it a fast switching schottky? Be sure to get one that is speced as fast switching (typically these will specifically mention suitability for use in DC-DC switching power supplies in the datasheet)

Layout matters in switching regulators. Wires/traces carrying high current need to be kept short. Look at the designs of the chinese ones, how they have the traces around the inductor, diode, and switch as short as possible.

I made it: 1) Because i need to know how it works, how it behaves and i'm going to learn about it 2) Chinese converters are awful, i need powerful and trustful (i know diy is not always the best solution but beats cheap badly made Chinese things)

1) Well, there's going to be a lot of learning in your future then. You might want to do more of that before you continue building. There are many good books on DC-DC converter design, as this is a challenging discipline that is very important in industry. There are also tools available to simulate DC-DC converters, which may be useful. You also probably need to learn how to use PCB design software, since DC-DC converters are layout sensitive. 2) Then use the pololu ones, or the fancy ones from digikey? Quite frankly, the chinese crap ones work surprisingly well considering that they cost less than a cup of coffee shipped - I use them all over the place, and the only time I've had problems with them is when I shorted out converters without short circuit protection.

You might want to have a look at this website http://playground.arduino.cc/Main/RegulatedPositiveVoltageBooster

The OPs circuit???
Where is the rest of the circuit?
Where does the the DC input come from?
Is it isolated from the mains supply.
Why are you working with 300V or more DC to get 5V.



What is your electronics, programming, arduino, hardware experience?

Tom… :slight_smile:

It's isolated, i'm using my lab power to power up both(arduino and the rest circuit), so it should be little more secure. And the current is limited if something is shorted, 100mA doesn't make any kind of damage to the circuit, and i changed the code to read the voltage and adjust the duty based on it, so it doesn't just jump to 300V :P But it think i should do something else ;)

Hi, I think you should be looking up basic smps circuits, for 5V output they don''t switch the 300Vdc directly like that to the 5V output. They use a high frequency transformer assembly. |500x244


Your layout, although isolated, is lethal, 300Vdc is not to be fiddled with by 15yo boys. I hope you are not alone when you are experimenting with this.

Even 100mA current limit is not good. 10mA through the heart can cause defibrillation.

Your system has the potential, pun not intended, to blow up anything connected to the 5V output by the application of the 300Vdc.

Tom.... :)

The OPs circuit has only a low DC voltage for its input, 12V or less.
C1 is only a 16V 2200 uf capacitor.
The reason the output is so high is because the circuit has no load so the output cap will just charge up
to whatever the transient voltage across the inductor is when the transistor switches off.
There is no feedback loop so the circuit wont regulate and the inductor value is far too high and most likley
is saturating when a load is connected, so thats why the transistor is heating up.
Boost converters are tricky things to design yourself unless you really understand how all the component values
are calculated.

Its far easier to use a pre built converter.
If you really want to build a switchmode converter, start with a buck converter as they are more forgiving if you get the values wrong.


mauried: The OPs circuit has only a low DC voltage for its input, 12V or less. C1 is only a 16V 2200 uf capacitor.

Where is that on his circuit diagram? Where has he stated that? C1 470nF 400V I'm sorry but written descriptive circuits can be so misleading, when someone starts describing their circuit connections with words, I switch off. Hence I have this cut and paste.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

If the OP cannot draw a circuit diagram, then how accurate must a verbal/text description one be. Tom.... :o

In post no 12 , you have reposted the diagram which shows C1 as 2200uf , 16 V. The diagram is confusing as C1 is under C2. C2 is the 400v , 470 nf cap. The input to the cct is on the LH side, as thats the only way it can work. The original OPs post makes no sense as to get 5V out from a boost converter, the input has to be lower. A boost converter cant reduce voltage.

This is a perfect example of someone who's in way out of his depth.

@Quality, to be perfectly honest, you don't know anywhere near enough to be playing with this kind of circuit. As mauried says, the schematic you showed is for a 'boost' converter, which steps voltage up, not down. You actually want a buck converter to do what you want, and even then you need to know much more and have access to an oscilloscope to design this type of circuit, as others have mentioned. You need to know how to calculate the inductor value to suit your circuit, too. Simply throwing in a 3300uH coil and hoping for the best isn't the way to go about it. (It's waaay over-sized.)

If you want to learn about switch-mode PSU design, the place to start is in the theory and calculations, not by throwing a circuit together.

Furthermore, you have no chance of designing a better circuit than those that the Chinese are selling. As DrAzzy says, those cheap Chinese DC-DC converters work surprisingly well, and in my experience they're very reliable. You won't design anything that even comes close to their performance, and especially not with your limited knowledge of electronics.

Also, you won't be able to build a good circuit anywhere near as cheaply as you can buy one. Give up the notion of doing better than experienced, trained designers. It's not going to happen. If you need a DC-DC converter, buy one.

If you do want to experiment with switch mode converters, this little chip MC34063 , http://www.onsemi.com/pub_link/Collateral/MC34063A-D.PDF
which is very commonly used can do Buck, boost and inverting, and there is a good design tool on the Net here, MC34063A design tool
which gives you all the relevant values for the components.
Ive built many power supplies using this little chip and they all work first time.
The only thing that can cause grief is getting an inductor with the wrong ferrite for the frequency, or getting
an inductor with too low a saturation current.
A good source of these chips if you cant find anyone who sells them, is to buy a 12V to 5V cigarette lighter usb converter for cars.
Can be found on Ebay for less than $2 and you also then get the correct grade ferrite inductor.