Help with MOSFET buck converter

bucknmos

I've started learning about Buck Converters, and I made a miniature one on an Arduino prototype shield. But when I turn the thing on, the voltage is stuck at 5v (the voltage input). I tried disconnecting the PWM line, no effect; and grounding the gate on the transistor (a 4800 n channel MOSFET I salvaged from a laptop) only causes a tiny drop (0.5v) on the output. Here is my circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

I don't think it's a bad transistor, it took 10 seconds to desolder, and then 15 more to resolder it on a different board. Can anybody show me what I'm doing wrong?

UPDATE: So, I fixed the transistor problem, and made the gate driver an optocoupler. I also added a boost capacitor and flyback diode. Now the problem is that the circuit can't handle any sort of load at all without going unstable. I have updated my schematic.
Strangely, the schematic editor doesn't have any opto-isolators, so sorry if that part is a bit messy. For control, I have an Arduino Nano adjust the PWM to a set voltage (3.3 for testing). The regulator is very accurate, only off by 0.01 volts, until I apply a load. Then the voltage drops anywhere to 1.8v for an LED, to 0.2v for a small fan. The transistor also gets very hot when I connect the fan, which shouldn't be the case because it was designed to handle up to 700v and 1.5A. I really don't know what I'm doing wrong here. Also, the flyback diode only had 3107 for the markings. Another note, the voltage takes a really long time to stabilize, even at 100% duty cycle.

Best Answer

Arduino- controlled buck regulator power stage

Ok, so this is the scheme i propose.

Disclaimer: in real life you will never do anything like that. This is only good for detailed buck controller study. This is not cost effective, not universal, not very power efficient and not simple at all. If you want a real design, you need to refer to buck controller IC of any descent vendor and read the datasheets accurately.

Disclaimer 2: i am not sure for how long and how deep i will be able to explain the theory. You must study that by yourself, it's not that hard.

So in the scheme i propose, you have a switch MOSFET, inductor and output capacitor that will do a good job for 20kHz PWM (i don't think Arduino can do much better), D1 will allow L1 to keep conducting when the switch is off.

R3 and R4 will provide feedback. Configure them so when the output is stable, the voltage is in the middle of your ADC range, probably it will be 1.65V

Now what made you most of your problems. To drive M1 you need voltage higher than Vs. So there is C2 that will be precharged to VCC at the beginning, and once your output is stable, with VOUT. When M1 will be switched on and the voltage on switching node will rise to VIN, C2 will still be charged, and provide VIN + VOUT voltage, allowing to keep M1 open.

U1 and U2 are used to quickly charge and discharge M1 gate. Pay attention, i use AC optocouplers. For DC optocouplers you may need a bit different input. Under no condition open both of them!!! it will just blow them. Consider logic gate to prevent such event.

Components selection: Define what voltage and current you need on output.

Select the L1 to have 200% of IOUT

C1- 200% of VOUT.

D1- 200% of IOUT and 150% of VIN for reverse bias, low leakage, minimum forward voltage.

C2- 200% of VOUT

C3- 150% of VIN

M1- VDS > 150% of VIN, Idrain > 150% of IOUT, VGS < 80% VOUT, VTH < 80% of VCC

Testing: Start with VIN = 12V and PWM of 20kHz, 50% duty cycle. Put 100R power resistor as load. You will have to measure about 6V, if everything is allright.

Closed loop control OK, this is the hardest part. Mostly because it's a whole theory, but if you have time to discover it, i will provide some basic guidelines to create a PID controller with your Arduino.

Set VFB_Reference = 1.65V

Define interrupt that will be called at the beginning of each PWM cycle Sample the VFB exactly 200nsec after the start of interrupt

Set VFB_Error_Last = VFB_Error

Set VFB_Error = VFB_Sample - VFB_Reference

Set VFB_Integral = VFB_Integral + VFB_Error

Set VFB_Derivative = VFB_Error - VFB_Error_Last

Set Voltage_Command = A * VFB_Error + B * VFB_Inegral + C * VFB_Derivative

Convert Voltage_Command to PWM_Command.

Pay attention: I make all calculations in volts. This is the best way for debug. So don't forget conversions from ADC to volts, working in floating point, etc. Also the VFB_Integral variable should be limited - otherwise it may roll.

A, B and C are coefficients that you will have to adjust. May be just anything, depends on both power stage and load, but also on how well you make all the circuit.

Be very careful with sampling VFB. It must be as accurate and silent as possible.

Be ready to surprises like overshoots, etc. To avoid them use soft start: VFB_Reference will start with 0V and rise slowly to 1.65V over long time, like 100msec.

Diagnose overvoltage. If you see VFB 10% higher than 1.65V, declare fault condition and set VFB_Reference to 0.

Good Luck! It's a serious project. I would say, for me after years in industry, it's doable, but not trivial. If you succeed, you will become (and i am serious about it) a real specialist in switching power supplies, and a really good candidate to become a control engineer, which in turn is really cool.