Electronics-Related.com
Forums

MicroController control for switching regulator

Started by RogerN December 25, 2012
On Fri, 28 Dec 2012 13:44:40 -0500, rickman <gnuarm@gmail.com> wrote:

>On 12/27/2012 5:18 PM, krw@attt.bizz wrote: >> On Wed, 26 Dec 2012 23:51:09 -0500, rickman<gnuarm@gmail.com> wrote: >>> >>> Hmmm... I guess it would require another chip or two, but would a >>> switched capacitor be a viable alternative to a bunch of resistors and >>> transistors? I looked at these some ten or more years ago in filter >>> circuits; the capacitor switched between the input and output shuttling >>> current. The faster it was switched the more current it carried and so >>> the lower resistance it appeared to be. This allowed analog filters to >>> be continuously varied. In this case it could allow for *relatively* >>> continuous adjustment of the feedback ratio by adjusting the switching >>> frequency. This likely would be best done in an FPGA that can use a DCO >>> to drive the switch rate. It has similar limitations to digital designs >>> and so needs a switching rate far above the frequency of interest. I >>> guess that would rule it out for this app since the feedback has to be >>> adjusted fairly quickly. >> >> That sounds like it should work but just PWMing a switch and resistor >> in parallel with the bottom resistor will do the same thing. The >> problem with either of these solutions is that you're going to see >> noise in the output because you can't easily filter the feedback node. > >Yes, I see. It would need to be switched pretty fast to mitigate the >noise issue.
Just call it spread spectrum. ;-)
John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

>On Tue, 25 Dec 2012 06:05:02 -0600, "RogerN" <regor@midwest.net> >wrote: > >> >>I'm wanting to use a microcontroller to control the output of a switching >>regulator, maybe something like a LM2576 simple switcher. I see the >>adjustability is on the feedback lead but what's the best way make it >>adjustable from a microcontroller. I'm guessing the feedback may be used in >>switching timing, ie, I guess I can't just use a DAC and get an output of >>1.23V more than the DAC output? I want to monitor voltage and current and >>use a control algorithm in the microcontroller (Arduino at first for >>experimentation) for custom battery charging experimentation. >> >>RogerN >> > >Somebody should do a GUI, vaguely LabView-ish, Windows app to design >digital power supply controllers around a uP or a DSP-based power >supply controller chip. Fill in the boxes and get both documentation >and compiled code. It may as well simulate, while it's at it. It could >output a nice PDF document for the record.
The problem with those kind of tools is that the result doesn't work for me OR doesn't cover what I need. If you need something common an 'off the shelve' switcher chip will do just fine. -- Failure does not prove something is impossible, failure simply indicates you are not using the right tools... nico@nctdevpuntnl (punt=.) --------------------------------------------------------------
On 12/28/2012 8:56 AM, rickman wrote:
snipped per instruction
> > Aren't these types of designs done with a failsafe on the control output > so that if the processor goes south the output shuts down?
In a perfect world, all designs are failsafe and never have bugs. We don't live in a perfect world. Many, MANY engineers have tunnel vision and get blinded by their own cleverness and never consider the ramifications of their decisions outside their tiny sphere of control. Of course, none of those people post here, but they do exist...in droves.
>
> > Another reason to use an FPGA instead of an MCU. In an FPGA everything > can be done in parallel with no worry of having to time "share" the > single resource.
The only thing missing in this thread is the point. Yes, you could probably figger out how to use an old Buick to control your PS loop. If you've got free resources in your microcontroller and you have the imagination to understand possible interactions with the rest of the world, and it works, that's fine. Shoehorning a PS control loop into the wrong device is not always better than sticking in a single-chip power supply controller. Especially for those OTHER inferior designers who don't post here. If I had extra resources in my microcontroller or FPGA, I'd be thinking about how to use it to the benefit of the customer/user. Yes, there are always exceptions.
> > Rick
On 2012-12-28, mike <ham789@netzero.net> wrote:
> On 12/27/2012 6:12 AM, Nico Coesel wrote: >> mike<ham789@netzero.net> wrote: >> >>> On 12/27/2012 1:17 AM, Nico Coesel wrote: >>> >>>> >>>> Yes. PIC and other 8 bit controllers are a stepping stone anyway. At >>>> some point you have to move forward. Besides that the software to >>>> compile for ARM microcontrollers is completely free. >>>> >>> I could use a project. Point me to your favorite free basic-like compiler >>> for the ARM. Something with lots of available functions so I don't have >>> to reinvent >>> the wheel for I/O or display drivers or keyboard muxes data formatting etc. >>> Life is too short to program in C. >>> Period...I don't need or want to hear otherwise. >> >> http://www.eluaproject.net/ >> > Thanks for the link. Interesting read. > I'm sure that it's wonderful for a lot of stuff, but the overlap for me > is zip. > > I only studied it or an hour, but I'm having a hard time believing > I can write a power supply control loop using an interpreted language > running on a virtual machine and have it fit in 8K. ;-) > > I do hobby projects that interface hardware and do real-time-ish stuff > on a PIC. > The data gets sent out the rs232 port to a PalmIIIC that does all the > heavy lifting and user interface in an interpreted language where time > don't matter. Saves a LOT of packaging grief for the touch screen > and display. > > I keep trying to justify buying an Arduino, but giving up on all the > PIC infrastructure I've built over the years for no obvious gain > keeps it on the back burner.
if you're doing PIC stuff in C or assembler don't bother with arduino, just go straight to AVR. the assembler syntax is easy to grasp and you can get a USB programmer delivered for under $5 on ebay or ali-express if you don't have a parallel port handy. -- &#9858;&#9859; 100% natural --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
All good points for a production power supply design. I think the OP wants
to do some experiments with switcher designs. In this case, direct PWM
control from a uC output pin would give more flexibility.

I'd oversize some components so as to tolerate a s/w lockup and 100% ON
condition without releasing the magic smoke. Its just a bench top
experiment, so what's a few extra pennies? 

-- 
Paul Hovnanian     mailto:Paul@Hovnanian.com
------------------------------------------------------------------
The purpose of language is communication. If the idea is clear 
the grammer ain't important.

On 12/29/2012 12:49 AM, Jasen Betts wrote:
> On 2012-12-28, mike<ham789@netzero.net> wrote: >> On 12/27/2012 6:12 AM, Nico Coesel wrote: >>> mike<ham789@netzero.net> wrote: >>> >>>> On 12/27/2012 1:17 AM, Nico Coesel wrote: >>>> >>>>> >>>>> Yes. PIC and other 8 bit controllers are a stepping stone anyway. At >>>>> some point you have to move forward. Besides that the software to >>>>> compile for ARM microcontrollers is completely free. >>>>> >>>> I could use a project. Point me to your favorite free basic-like compiler >>>> for the ARM. Something with lots of available functions so I don't have >>>> to reinvent >>>> the wheel for I/O or display drivers or keyboard muxes data formatting etc. >>>> Life is too short to program in C. >>>> Period...I don't need or want to hear otherwise. >>> >>> http://www.eluaproject.net/ >>> >> Thanks for the link. Interesting read. >> I'm sure that it's wonderful for a lot of stuff, but the overlap for me >> is zip. >> >> I only studied it or an hour, but I'm having a hard time believing >> I can write a power supply control loop using an interpreted language >> running on a virtual machine and have it fit in 8K. ;-) >> >> I do hobby projects that interface hardware and do real-time-ish stuff >> on a PIC. >> The data gets sent out the rs232 port to a PalmIIIC that does all the >> heavy lifting and user interface in an interpreted language where time >> don't matter. Saves a LOT of packaging grief for the touch screen >> and display. >> >> I keep trying to justify buying an Arduino, but giving up on all the >> PIC infrastructure I've built over the years for no obvious gain >> keeps it on the back burner. > > if you're doing PIC stuff in C or assembler don't bother with arduino, > just go straight to AVR. the assembler syntax is easy to grasp and you > can get a USB programmer delivered for under $5 on ebay or ali-express > if you don't have a parallel port handy. >
Over the last 44 years, I've written exactly ONE C program that did anything useful. And that only because I just couldn't get interpreted BASIC to keep up with the data from the spectrum analyzer. C, as defined by K&R is simple enough. Although I balk at a language that makes me do a function call to concatenate two strings...and most anything else I want to do. I get lost in all the defines and includes and pragmas and and and... Life is too short ;-) I'm sure it's all trivial the second time you get it set up. PicBasicPro and inline assembler is the sweet spot for me. I went in search of a way to change my development environment from Windows to linux. Gambas3 looks interesting for PC programs, but the search for a linux microcontroller development paradigm that fit within my attention span came up short. The hype for the microcontroller version of gcc, exceeds reality for simple minds like mine. When you've got a complete design/debug environment set up, it's hard to justify change that you don't really need. It's just an intellectual exercise with short attention span. I'm sure I'll change my tune if I need something I can't do.
On Sat, 29 Dec 2012 10:04:14 -0800, mike <ham789@netzero.net> wrote:

>On 12/29/2012 12:49 AM, Jasen Betts wrote: >> On 2012-12-28, mike<ham789@netzero.net> wrote: >>> On 12/27/2012 6:12 AM, Nico Coesel wrote: >>>> mike<ham789@netzero.net> wrote: >>>> >>>>> On 12/27/2012 1:17 AM, Nico Coesel wrote: >>>>> >>>>>> >>>>>> Yes. PIC and other 8 bit controllers are a stepping stone anyway. At >>>>>> some point you have to move forward. Besides that the software to >>>>>> compile for ARM microcontrollers is completely free. >>>>>> >>>>> I could use a project. Point me to your favorite free basic-like compiler >>>>> for the ARM. Something with lots of available functions so I don't have >>>>> to reinvent >>>>> the wheel for I/O or display drivers or keyboard muxes data formatting etc. >>>>> Life is too short to program in C. >>>>> Period...I don't need or want to hear otherwise. >>>> >>>> http://www.eluaproject.net/ >>>> >>> Thanks for the link. Interesting read. >>> I'm sure that it's wonderful for a lot of stuff, but the overlap for me >>> is zip. >>> >>> I only studied it or an hour, but I'm having a hard time believing >>> I can write a power supply control loop using an interpreted language >>> running on a virtual machine and have it fit in 8K. ;-) >>> >>> I do hobby projects that interface hardware and do real-time-ish stuff >>> on a PIC. >>> The data gets sent out the rs232 port to a PalmIIIC that does all the >>> heavy lifting and user interface in an interpreted language where time >>> don't matter. Saves a LOT of packaging grief for the touch screen >>> and display. >>> >>> I keep trying to justify buying an Arduino, but giving up on all the >>> PIC infrastructure I've built over the years for no obvious gain >>> keeps it on the back burner. >> >> if you're doing PIC stuff in C or assembler don't bother with arduino, >> just go straight to AVR. the assembler syntax is easy to grasp and you >> can get a USB programmer delivered for under $5 on ebay or ali-express >> if you don't have a parallel port handy. >> >Over the last 44 years, I've written exactly ONE C program that did >anything useful. >And that only because I just couldn't get interpreted BASIC to keep up >with the data from the spectrum analyzer. > >C, as defined by K&R is simple enough. Although I balk at a language >that makes me do a function call to concatenate two strings...and most >anything else I want to do. >I get lost in all the defines and includes and pragmas and and and... >Life is too short ;-) >I'm sure it's all trivial the second time you get it set up. > >PicBasicPro and inline assembler is the sweet spot for me. > >I went in search of a way to change my development environment from >Windows to linux. >Gambas3 looks interesting for PC programs, but the search for >a linux microcontroller development paradigm that fit within my >attention span came up short. The hype for the microcontroller >version of gcc, exceeds reality for simple minds like mine. > >When you've got a complete design/debug environment set up, >it's hard to justify change that you don't really need. >It's just an intellectual exercise with short attention span. > >I'm sure I'll change my tune if I need something I can't do. >
Try the PowerBasic Console Compiler. It can make useful (and readable!) Windows programs in minutes. ' ' ROBOT.BAS ' ' ' By John Larkin ' Highland Technology, Inc ' San Francisco ' December 27 , 2012 ' ' Remote Batch File Executor Dropbox version ' ' If this program sees a file called ROBOT.BAT, it shells to it then deletes ROBOT.BAT ' ' ' One good command is shutdown -r -f to reboot the PC. ' ' This program is coded for PBCC v 5 ' ' #COMPILE EXE '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$ MAIN PROGRAM $$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ FUNCTION PBMAIN() AS LONG DEFLNG A-Z REV$ = "D" CONSOLE SET SCREEN 25, 80 CONSOLE NAME " ROBOT Batch File Executor Rev " + REV$ CURSOR OFF ' DEFINE VGA COLORS BLK% = 0 GRY% = 7 BLU% = 9 GRN% = 10 CYN% = 11 RED% = 12 VIO% = 13 YEL% = 14 WHT% = 15 DARK% = -8 TOP: COLOR VIO%+DARK%, WHT% : CLS TLOOP: SLEEP 2000 IF DIR$("ROBOT.BAT") <> "" THEN ' GOT A BATCH FILE TO RUN? PRINT "Executing ROBOT.BAT "; DATE$; " "; TIME$ TRY SHELL("ROBOT.BAT") ' RUN COMMAND AS A SYNC PROCESS THEN SLEEP 5000 KILL "ROBOT.BAT" ' NUKE COMMAND FILE PRINT CATCH PRINT "Error "; ERR ' OOPS, SOMETHING'S WEIRD PRINT END TRY END IF GOTO TLOOP END FUNCTION
On 12/29/2012 10:57 AM, John Larkin wrote:
> On Sat, 29 Dec 2012 10:04:14 -0800, mike<ham789@netzero.net> wrote: > >> On 12/29/2012 12:49 AM, Jasen Betts wrote: >>> On 2012-12-28, mike<ham789@netzero.net> wrote: >>>> On 12/27/2012 6:12 AM, Nico Coesel wrote: >>>>> mike<ham789@netzero.net> wrote: >>>>> >>>>>> On 12/27/2012 1:17 AM, Nico Coesel wrote: >>>>>> >>>>>>> >>>>>>> Yes. PIC and other 8 bit controllers are a stepping stone anyway. At >>>>>>> some point you have to move forward. Besides that the software to >>>>>>> compile for ARM microcontrollers is completely free. >>>>>>> >>>>>> I could use a project. Point me to your favorite free basic-like compiler >>>>>> for the ARM. Something with lots of available functions so I don't have >>>>>> to reinvent >>>>>> the wheel for I/O or display drivers or keyboard muxes data formatting etc. >>>>>> Life is too short to program in C. >>>>>> Period...I don't need or want to hear otherwise. >>>>> >>>>> http://www.eluaproject.net/ >>>>> >>>> Thanks for the link. Interesting read. >>>> I'm sure that it's wonderful for a lot of stuff, but the overlap for me >>>> is zip. >>>> >>>> I only studied it or an hour, but I'm having a hard time believing >>>> I can write a power supply control loop using an interpreted language >>>> running on a virtual machine and have it fit in 8K. ;-) >>>> >>>> I do hobby projects that interface hardware and do real-time-ish stuff >>>> on a PIC. >>>> The data gets sent out the rs232 port to a PalmIIIC that does all the >>>> heavy lifting and user interface in an interpreted language where time >>>> don't matter. Saves a LOT of packaging grief for the touch screen >>>> and display. >>>> >>>> I keep trying to justify buying an Arduino, but giving up on all the >>>> PIC infrastructure I've built over the years for no obvious gain >>>> keeps it on the back burner. >>> >>> if you're doing PIC stuff in C or assembler don't bother with arduino, >>> just go straight to AVR. the assembler syntax is easy to grasp and you >>> can get a USB programmer delivered for under $5 on ebay or ali-express >>> if you don't have a parallel port handy. >>> >> Over the last 44 years, I've written exactly ONE C program that did >> anything useful. >> And that only because I just couldn't get interpreted BASIC to keep up >> with the data from the spectrum analyzer. >> >> C, as defined by K&R is simple enough. Although I balk at a language >> that makes me do a function call to concatenate two strings...and most >> anything else I want to do. >> I get lost in all the defines and includes and pragmas and and and... >> Life is too short ;-) >> I'm sure it's all trivial the second time you get it set up. >> >> PicBasicPro and inline assembler is the sweet spot for me. >> >> I went in search of a way to change my development environment from >> Windows to linux. >> Gambas3 looks interesting for PC programs, but the search for >> a linux microcontroller development paradigm that fit within my >> attention span came up short. The hype for the microcontroller >> version of gcc, exceeds reality for simple minds like mine. >> >> When you've got a complete design/debug environment set up, >> it's hard to justify change that you don't really need. >> It's just an intellectual exercise with short attention span. >> >> I'm sure I'll change my tune if I need something I can't do. >> > > Try the PowerBasic Console Compiler. It can make useful (and > readable!) Windows programs in minutes.
Thanks, Deal Breaker: PB/CC 6 is priced at $169 I'm a hobbyist with a serious cheap streak. I write virtually all my Windows PC programs in Visual Basic 6. The only disadvantage is that you sometimes have dependencies that don't exist on older systems. PITA. I migrated dos basic stuff to FreeBasic with FBIDE gui development wrapper. For non-gui progs, it produces one file that doesn't need VB libraries and still runs in win7. It's cold and wet outside. I keep telling myself I'm gonna take another crack at microcontroller C. But my body just wants to hibernate...nap time!!!
On Fri, 28 Dec 2012 18:42:41 -0500, rickman <gnuarm@gmail.com> wrote:

>On 12/28/2012 5:48 PM, John Larkin wrote: >> On Tue, 25 Dec 2012 06:05:02 -0600, "RogerN"<regor@midwest.net> >> wrote: >> >>> >>> I'm wanting to use a microcontroller to control the output of a =
switching
>>> regulator, maybe something like a LM2576 simple switcher. I see the >>> adjustability is on the feedback lead but what's the best way make it >>> adjustable from a microcontroller. I'm guessing the feedback may be =
used in
>>> switching timing, ie, I guess I can't just use a DAC and get an =
output of
>>> 1.23V more than the DAC output? I want to monitor voltage and =
current and
>>> use a control algorithm in the microcontroller (Arduino at first for >>> experimentation) for custom battery charging experimentation. >>> >>> RogerN >>> >> >> Somebody should do a GUI, vaguely LabView-ish, Windows app to design >> digital power supply controllers around a uP or a DSP-based power >> supply controller chip. Fill in the boxes and get both documentation >> and compiled code. It may as well simulate, while it's at it. It could >> output a nice PDF document for the record. > > >Open source or would you pay for this? Sounds like a good companion app=
=20
>for LT Spice. > >Rick
LT has one to sell their regulator ICs, so does TI. So far as i know nobody makes one for random uPs. ?-)
"Tim Wescott"  wrote in message 
news:ZO-dnalKjYHz2kbNnZ2dnUVZ_vOdnZ2d@web-ster.com...

>On Tue, 25 Dec 2012 06:05:02 -0600, RogerN wrote: > >> I'm wanting to use a microcontroller to control the output of a >> switching regulator, maybe something like a LM2576 simple switcher. I >> see the adjustability is on the feedback lead but what's the best way >> make it adjustable from a microcontroller. I'm guessing the feedback >> may be used in switching timing, ie, I guess I can't just use a DAC and >> get an output of 1.23V more than the DAC output? I want to monitor >> voltage and current and use a control algorithm in the microcontroller >> (Arduino at first for experimentation) for custom battery charging >> experimentation. > >I don't know that anyone actually answered the question that you asked. >You got a lot of good responses -- personally, if I were doing this I'd >see if the microprocessor had a suitable PWM output and think about using >that. >
<snip>
>-- >Tim Wescott >Control system and signal processing consulting >www.wescottdesign.com
I'm wondering about another idea for the control. What if I used a resistor from the output to the feedback pin, and then a NPN transistor from the feedback pin to ground. A DAC would feed the base through the base resistor, it would use the transistors current gain to control the current through the resistor, more current would require move voltage drop through the resistor and increase the output voltage. Does that sound like it would work? RogerN