Arduino-based switching power supply (SMPS)

I’m still trying to teach myself (or rather, learn with others’ help) many electronics fundamentals, and I’m always finding new ways to make that happen, even if what I’m building could be done a thousand times easier with different components.

That said, what I kinda wanted to do next was use an Arduino’s PWM output and analog input to manage a switching power supply, perhaps something with variable voltage output and stats on the LCD screen. Does that sound reasonable?

Anyone feel charitable enough to get me started on the right track? I have a handful of N-channel 100v/40A MOSFETs (ST P35NF10) and a “transformer” (normally used for audio) in my Radio Shack project kit. The MOSFET seems to work pretty well to act as a primitive “amplifier” for my PWM audio program using digital output, active with a high signal. Sure would be a pretty cool to build my own power supply…

I know it’d be kinda (okay, really) dangerous to start off trying to build a “mains” power supply, so I’m thinking a safer DC-DC converter first. Since a mains SMPS is really just a DC-DC converter on a much larger scale, I imagine what I learn here could scale up later if need be… I’ll just power it off a 19v laptop power brick for starters.

It'll be possible to do but the question is why? There are many inexpensive driver IC's out there that handle the PWM and control of a DC/DC converter. Implementing the same functionality in a microcontroller is just an inefficient way of going about it, because the control loop will be much slower than those driver IC's.

Of course it's a good academic exercise though.

Definitely start with DC first.

If you wanted to try a 0..10V supply, you could do this:

Have a variable resistor one end to GND the other to +5V and slider to A0 to set the voltage. Drive your MOSFET from a pwn output to switch the 19V. Big capacitors on the output from the MOSFET Have a potential divider, 10K and 1K resistors in series to divide the measured output voltage by 10 and feed it into A1.

The control algorithm should be:

get the desired voltage from A0 (times by two and cast to a float) get the actual voltage from A1 (cast to float and scale) analog reading of 1024 = 50V so multiply raw reading by 50/1024 error = actual - desired if error positive - decrement the value of the pwm output if error negative - increment the value of the pwm output

Have fun!

I so just bought your book. ;D (no, really. Just what I need, it seems!)

That's exactly what I was looking for, too. Didn't think it would be that simple! I'm sure I can adapt LCD display algorithms from there as well. I'll get to work on that tomorrow for sure! Thanks for the info!

(And yeah, I know it could be done easier and more accurately with a dedicated controller IC, but that's not the point now is it? ;))

Take a look on this

Only problem I see with that is that its premise of operation revolves around shorting the supply to ground in order to boost the inductor’s voltage for an almost immeasurably brief period… how long will that transistor (?) survive? :o

Very, very interesting… I don’t typically see “boost” SMPSs in use though - only one I’ve ever seen that “boosts” was an old cheap-sh*t Chinese laptop car power adapter that used a switching power supply with a transformer (large wire on one side, small on the other, kinda thing), the way I’d figure it’d be done ;D

But I guess I can actually see how it would work… since an inductor resists changes in current, it would be shorted but a small amount of power would flow through the transistor during the tiny period it’s open before it closes again, causing the “inertia” of the power to be dumped into the capacitor instead. Nice trick!

Now that I can wrap my mind around the concept, it’d be fun to build. :smiley: