Author Topic: DIY uC-based variable programmable switching power supply design  (Read 13172 times)

0 Members and 1 Guest are viewing this topic.

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
DIY uC-based variable programmable switching power supply design
« on: September 12, 2014, 01:44:06 am »
Hello everybody!

I would like to have your opinion on an idea that came to my mind. I've been unable to find something similar on the internet so please excuse me if it's the worst thing someone could ever think of.

I want to build a programmable, variable, switching power supply, that uses a micro controller device (I personally prefer PICs) to regulate the output voltage. Some control I/O buttons should be available as well as an LCD display. Obviously, if the PIC device has some USB/serial/I2C ports available, it might be used in conjunction with other devices or for PIC <-> PC communication.
I have made a design layout of a buck/boost configuration, please have a look at the attachment. The idea is very basic for now, and I'd like to know if it can be done and/or why it will/won't work. Also, if the design is any good, do you think it could be used for an inverting configuration as well?
« Last Edit: September 12, 2014, 01:46:38 am by T3STY »
 

Offline DanielS

  • Frequent Contributor
  • **
  • Posts: 798
Re: DIY uC-based variable programmable switching power supply design
« Reply #1 on: September 12, 2014, 02:24:59 am »
I hope you are not expecting remotely good efficiency out of that design: what you have here is basically a shunt regulator with a 2nd order low-pass LC filter. The diode is unnecessary since current will always have a path through R3... R3's current will be either going to the load through the inductor or be shared between the transistor short to ground and the inductor.
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: DIY uC-based variable programmable switching power supply design
« Reply #2 on: September 12, 2014, 09:40:44 am »
Alternatively, you could get a working buck/boost converter on ebay for a couple dollars. Then to control it from your microcontroller you modify it slightly. Basically you do resistive summing at the FB pin of the converter in the same way you would for normal op amp circuits.

That way you keep the loop nice and tight as per the ready-made-pcb, and you adjust the setpoint by varying the voltage on that resistor you just added to the FB node.

In it's simplest form all you need is 2 resistors, 1 cap and a PWM output of your microcontroller. Well, and that buck/boost converter from ebay.

The slightly better version would use an op amp in addition to the above.
« Last Edit: September 12, 2014, 09:42:48 am by mrflibble »
 

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
Re: DIY uC-based variable programmable switching power supply design
« Reply #3 on: September 12, 2014, 10:21:57 pm »
So the idea is a total mess. OK, I'll check for other solutions.
Thank you for your help ;)
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: DIY uC-based variable programmable switching power supply design
« Reply #4 on: September 13, 2014, 01:41:32 pm »
It's totally doable, but you must revise the switch part of your schematics, that's not a buck-boost (nor a buck, nor a boost).

http://en.wikipedia.org/wiki/Buck%E2%80%93boost_converter
« Last Edit: September 13, 2014, 01:43:21 pm by nuno »
 

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
Re: DIY uC-based variable programmable switching power supply design
« Reply #5 on: September 13, 2014, 09:14:24 pm »
Does any of you use a circuit simulator like Falstad? I have tried different simulations with manual switch and transistor switches, but I can't get to work any of them. Maybe can you help me with a reference (component values included) circuit?
 

Offline Skimask

  • Super Contributor
  • ***
  • Posts: 1433
  • Country: us
Re: DIY uC-based variable programmable switching power supply design
« Reply #6 on: September 13, 2014, 09:54:09 pm »
Does any of you use a circuit simulator like Falstad? I have tried different simulations with manual switch and transistor switches, but I can't get to work any of them. Maybe can you help me with a reference (component values included) circuit?

Or you could just open up one of the example circuits included with the software...
I didn't take it apart.
I turned it on.

The only stupid question is, well, most of them...

Save a fuse...Blow an electrician.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: DIY uC-based variable programmable switching power supply design
« Reply #7 on: September 13, 2014, 11:39:19 pm »
If you put that diode in series with the FET and inductor, it should work as a boost supply, albeit very inefficiently.


Sent from my Smartphone
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline Alex Eisenhut

  • Super Contributor
  • ***
  • Posts: 3338
  • Country: ca
  • Place text here.
Hoarder of 8-bit Commodore relics and 1960s Tektronix 500-series stuff. Unconventional interior decorator.
 

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
Re: DIY uC-based variable programmable switching power supply design
« Reply #9 on: September 14, 2014, 09:54:58 am »
http://www.ebay.com/itm/DC-DC-60V-20A-1200W-programmable-Constant-Voltage-Current-Power-Supply-Module-/181108964187?pt=LH_DefaultDomain_0&hash=item2a2aef7b5b
...yeah.. but it's 90$ and way more than I could ever need (3-20V, 2A).

I have tried simulating the circuit schematics from wikipedia, I couldn't get any to work as expected. The boost config keeps "boosting", I got spikes of 500+V, while the buck configuration with a load resistor of 1K (parallel to the storage capacitor) just doesn't get higher than 4.7V with whatever component values. I think the simulator simply can't afford such (simple?) simulation.

@Skimask: I had a look in the example files list but I couldn't find one of switching power supplies. Could you tell me which one is it?
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: DIY uC-based variable programmable switching power supply design
« Reply #10 on: September 14, 2014, 11:54:37 am »
This is a similar thing I did, but it's a buck converter.
 

Offline Strada916

  • Frequent Contributor
  • **
  • Posts: 252
  • Country: au
Re: DIY uC-based variable programmable switching power supply design
« Reply #11 on: September 14, 2014, 12:57:40 pm »
Silicon chip did a hybrid 100W PSU. Not micro. Controled though. April this year if memory serves my right.
The Bone, the Off-White, the Ivory or the Beige?
 

Offline Alex Eisenhut

  • Super Contributor
  • ***
  • Posts: 3338
  • Country: ca
  • Place text here.
Re: DIY uC-based variable programmable switching power supply design
« Reply #12 on: September 14, 2014, 01:09:14 pm »
http://www.ebay.com/itm/DC-DC-60V-20A-1200W-programmable-Constant-Voltage-Current-Power-Supply-Module-/181108964187?pt=LH_DefaultDomain_0&hash=item2a2aef7b5b
...yeah.. but it's 90$ and way more than I could ever need (3-20V, 2A).

I have tried simulating the circuit schematics from wikipedia, I couldn't get any to work as expected. The boost config keeps "boosting", I got spikes of 500+V, while the buck configuration with a load resistor of 1K (parallel to the storage capacitor) just doesn't get higher than 4.7V with whatever component values. I think the simulator simply can't afford such (simple?) simulation.

@Skimask: I had a look in the example files list but I couldn't find one of switching power supplies. Could you tell me which one is it?

I see. But perhaps you can find a nice stand-alone power module and simply make the control panel for it.
Hoarder of 8-bit Commodore relics and 1960s Tektronix 500-series stuff. Unconventional interior decorator.
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: DIY uC-based variable programmable switching power supply design
« Reply #13 on: September 14, 2014, 01:32:19 pm »
In general switch mode supplies are not that easy to be made adjustable. Designing compensation circuit and control the software that will work well over the whole range of input and output voltages and currents is not an easy task.
I love the smell of FR4 in the morning!
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: DIY uC-based variable programmable switching power supply design
« Reply #14 on: September 14, 2014, 05:48:18 pm »
True but if you start with the schematic of a proper step down converter circuit (without controller IC though) and add cycle-by-cycle current limiting in hardware using a current transformer, a comparator and flipflop you can mess a lot with software without blowing stuff up.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
Re: DIY uC-based variable programmable switching power supply design
« Reply #15 on: September 14, 2014, 07:14:17 pm »
@nuno: nice schematic! I'll check it out and probably make a similar one for my purpose.

Is there anything particular to consider for 0::+19V@2A buck configuration (20V @4.5A input) ?
Also, I would like to design an inverting configuration as well for -19::0V@2A output (same 20V input) with common ground. Any drawbacks in doing that?
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: DIY uC-based variable programmable switching power supply design
« Reply #16 on: September 15, 2014, 08:19:59 am »
http://www.ebay.com/itm/DC-DC-60V-20A-1200W-programmable-Constant-Voltage-Current-Power-Supply-Module-/181108964187?pt=LH_DefaultDomain_0&hash=item2a2aef7b5b
...yeah.. but it's 90$ and way more than I could ever need (3-20V, 2A).


That $90 seems a bit much. Plus I wonder how many of those 1200 MarketingWatts actually materialize in the form of sustained power.

The ebay module + small modification I mentioned is more along the lines of this:

http://www.ebay.com/itm/LM2596-Power-Supply-Output-1-23V-30V-DC-DC-Buck-Converter-Step-Down-Module-/141361451145

That one is buck, and there are similarly priced boost converters as well. Those are so cheap that I just slap them in a project, tweak the pot to set the correct output voltage for that project and job done.

And to make it uC controlled, see previous post. Solder resistor to the FB node, inject your set point voltage on other end of resistor and you are good to go. And generating that set point can be done by a uC pwm pin + RC filter. So all you need is 1 C + 2 R, a free pwm pin, and that ebay module.

Mind you, that thing is NOT current limited. You only get voltage control. If you want current limit as well, then extra stuff is required. Mostly a sense resistor + LM324 + some more cheapo R's + C's. That's less than $2 total parts, including ebay module.

And that does work continuously at your required 2 Amps. The inductor does get pretty hot at that current, or at least on the modules I have here. But they work fine for longer periods. Some I've used 8 hours on end per day, every day. And others for something like 100 hour stretches and no problems so far. All that to say that they will probably meet your current & voltage requirements.


 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: DIY uC-based variable programmable switching power supply design
« Reply #17 on: September 15, 2014, 09:36:30 am »
The C2000 does Digital Power brilliantly. But you really only need to use an an MCU for switching control when you're doing like a multiple node server power distribution supply where you'll be doing active PFC with full bridge switching and synchronous rectification.

For your use it's overkill and you'll never get the efficiency you can get with an off the shelf SMPS IC from TI or whoever.

If you want to vary the voltage/current, just use a DAC + OP Amp to vary the feedback voltage. Dead simple and reliable.


Sent from my Smartphone
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: DIY uC-based variable programmable switching power supply design
« Reply #18 on: September 15, 2014, 09:39:13 am »
Quote
I want to build a programmable, variable, switching power supply, that uses a micro controller device (I personally prefer PICs) to regulate the output voltage.

For an all digital solution, you need at least 100mips + fast adc. Some high-end dsPICs may work there. You can check of Freescale for their solutions - they are king of the hills here.

A simpler way is an all-analog solution: use a pwm controller / smps chip and apply an analog signal to the feedback nod. The analog signal is generated by the pic, based on the output voltage.

It is a lot easier to get it working.
================================
https://dannyelectronics.wordpress.com/
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: DIY uC-based variable programmable switching power supply design
« Reply #19 on: September 15, 2014, 10:22:31 am »
For an all digital solution, you need at least 100mips + fast adc. Some high-end dsPICs may work there. You can check of Freescale for their solutions - they are king of the hills here.
Indeed. Freescale make some nice chips that are a good fit for this. One of (far too) many things on the todo list.  ;D Mind you, I would only do this as a pure learning experience. Not as a pragmatic route to getting an all digital controllable PSU.

Quote
A simpler way is an all-analog solution: use a pwm controller / smps chip and apply an analog signal to the feedback nod. The analog signal is generated by the pic, based on the output voltage.
Yup, see previous post.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: DIY uC-based variable programmable switching power supply design
« Reply #20 on: September 15, 2014, 01:22:44 pm »
Quote
I want to build a programmable, variable, switching power supply, that uses a micro controller device (I personally prefer PICs) to regulate the output voltage.

For an all digital solution, you need at least 100mips + fast adc. Some high-end dsPICs may work there. You can check of Freescale for their solutions - they are king of the hills here.
Looking at the basic equations of a step-down converter I know the above is nonsense. Output ripple is still dictated by the output capacitors. The only thing the controller has to do is adjust for variations in the input voltage. Current limiting is trickier but not unachievable (been there/done that).
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
Re: DIY uC-based variable programmable switching power supply design
« Reply #21 on: September 15, 2014, 04:28:35 pm »
Wow, soo much feedback from you guys, thank you very much!

About all those uC units you're suggesting (C2000, dsPIC, ect.) they're overkill in my opinion. It's not like I need nanosecond control on the output. Most PIC devices are very low MIPS, but they include hardware features that can deliver high performance (like 32kHz PWM on 8MHz main PIC clock). Don't get me wrong, I'm not saying "PIC for evaarrrr"; I'm just saying a "normal" low-budget uC can handle this well enough.

mrflibble's suggestion looks quite nice. I don't think it would require much work to get it to work with a uC. Do you think I could use two buck modules with one's positive connected to other's negative and get a dual power supply with a common ground (+15::0::-15)?
Mind you, I would only do this as a pure learning experience. Not as a pragmatic route to getting an all digital controllable PSU.
Got that :)

evb149 PSFB solution also looks nice, I don't care it requires 4 switches, but I wonder how big the transformer would become. I needed a switching power supply mainly because I needed to get as small as possible. I may consider using a PSFB solution, but I need the transformer to be low profile (not more than 3 cm height).
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: DIY uC-based variable programmable switching power supply design
« Reply #22 on: September 15, 2014, 04:43:52 pm »
If you aren't looking for efficiency, use a comparator to drive a switch. One input is the output voltage and another is your target voltage.

no mcu required

as to pic based amps, google black roman.
================================
https://dannyelectronics.wordpress.com/
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: DIY uC-based variable programmable switching power supply design
« Reply #23 on: September 15, 2014, 10:33:25 pm »
Do you think I could use two buck modules with one's positive connected to other's negative and get a dual power supply with a common ground (+15::0::-15)?
That's a two part question...

1 - Can you generate a negative voltage supply using one of those cheapo ebay converters?
2 - Can you generate both a positive and a negative voltage using only 1 input supply?

1) yes you can. You will have to make 1 extra mod, because you have to slightly change the way the diode is connected. But it's no biggie.

2) I vaguely recall the answer to be no. Not entirely sure, I'll have to consult my notes (read: find the bloody piece of paper). But if you have two floating input supplies (like oooh lets say, two of those 12 Volt wallwarts that you always have loads of) then you can use that to generate a dual +15 V / -15 V supply.

Anyways, I'll see if I can find those pesky notes tomorrow.
 

Offline T3STYTopic starter

  • Contributor
  • Posts: 11
Re: DIY uC-based variable programmable switching power supply design
« Reply #24 on: September 16, 2014, 02:52:52 am »
For note 2: if I have a big enough input voltage, say 30V, and I use a 1:0.5/0.5 (half split secondary) transformer or a resistor voltage divider, I could just split the input voltage in two and as such create +15::0::-15 before I use those SMPS modules. If I use a transformer there I could also use a 1:2 winding to create 30V (still split as 15+15) or so from a merely 16V input. Did I get this right?

For note 1: I should convert a buck configuration into an inverting configuration. I don't think it's easy doable, and most inverting designs I seen on application notes of LM2576 (and similar) report that I could only go up to 700mA current, by far less than 2A. Also, I would not really get to use 2A, but I'd feel better to know I have the little extra just in case.

EDIT
still about note 2: the thought might be correct but I get a lot of current loss since output power must be equal to input power. Supposing I have 15V input at 4A and I want 30V output (half split, but still 30V total), then the output current is (15V*4A)/30V = 2A.
Since I want to use 19V @3.5A power supplies that come with laptop PCs, it puts me down on using a transformer to double the output voltage... any ideas?
« Last Edit: September 16, 2014, 03:56:27 am by T3STY »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf