Current sink switching power supply - Page 1
Forum section: electronics / projects

author: IoTguy
author_rank: Contributor
timestamp: November 08, 2017, 02:11:32 pm
content: Hi,I’m developing an 8 channel controllable current sink power supply for an electroforming application. The input is 12 volts DC from a 300W mains (cage type) supply. There will be a micro controller -- probably an STM32 of some kind -- for controlling channel current and some other not so intensive tasks. The loads are restive and will not resistance change quickly. The loads are commoned on the high side which will be connected to 12 volts therefore the requirement is to sink (rather than source) current - I have no control over this. The current range is 0 - 2 Amps (this includes some overhead). Reliability is important and production volumes will not be high (a few dozen). I would like to use a buck converter IC but these do not seem to exist for driving the low side of the load.I’ve thought of the following options (in order of preference) but would welcome any thoughts or ideas.Option 1Use PWM and a firmware PID loop to control a low side switcher (inductor, capacitor, diode, MOSFET + gate drive). However to switch at high frequency (e.g. 500khz) the resolution of the PWM would be poor. I guess I could reduce the switching frequency and increase the size of the inductor and capacitor to get reasonable output ripple. Some of the STMF32F4xx series seem to support 8 (or more) PWM channels and can run at 180 MHz so could achieve a reasonable PWM resolution at a PWM frequency of say 100kHz or lower.Option 2Use DAC output(s) from the processor instead of PWM. I can also use a multiplex DAC chip to get 8 channels if needed. The DAC output gets compared with a generated triangle wave to drive the N channel MOSFET of the switcher in the traditional way. This solves the PWM resolution issue and would allow a higher switching frequency but the down side is I would be getting into all the issues of designing fast switching buck converters (fast comparators, fast output change OP-amps for the triangle wave etc..).Option 3Use a buck converter LED driver IC. They drive the low side of the LED chain so suit my current sink requirement but have the following problems for this application:The control is usually a dimmer PWM input that basically stops driving the LEDs during the off phase of the PWM. I need a steady(ish) current.They tend to be only 5% accurate which less accurate than I'd likeMost seem to require the current measuring shunt resistor to be on the high side of the load which in my case is not possible as all 8 loads are commoned together on the high side external to my circuit.The more I think about this option the less I like it.

author: Siwastaja
author_rank: Super Contributor
timestamp: November 08, 2017, 04:14:03 pm
content: Option 2, but instead of dumbly generating some duty cycle set by you in software and feedbacking it from the voltage measurement, make the better use of your components: use the DAC, comparator and a current sense amplifier to directly produce the desired triangle wave in the inductor current - this is called "current mode" control, and for the last maybe 10-15 years, has been the only sensible and sane operating mode.So your voltage feedback drives the current setpoint, directly driving DAC, and the comparator directly drives the FET driver.Bounding the current setpoint guarantees no blown fets, inductor never saturates, separate soft start / corner case logic is not needed - in addition, it almost guarantees the stability of the voltage control loop, unless you totally mess it up, and even then, no blown components.Since the instantaneous inductor current is actually measured and directly used to drive the FETs, the feedback doesn't need to try to compensate around the hidden state of the inductor (inductor current in continuous mode).Electroforming sounds like you are going to output very low voltages. So a synchronous buck would be the obvious choice, otherwise the diode drop causes poor efficiency. OTOH, at 2A only, maybe the diode drop could be accepted (about 1W of wasted power).Option 3, using a LED driver, would make sense since they are naturally almost all employing proper current mode control. You need to use one with adjustable current, which is a different concept than PWMing the enable-style DIM/whatever pin. Some might not go down to zero current (which might be the reason they are often dimmed by low-frequency PWMing instead).

author: phil from seattle
author_rank: Super Contributor
timestamp: November 08, 2017, 06:11:21 pm
content: I had only vaguely heard of electroforming before this. Your posting caused me to go read up on it. Your product idea seems sound.It seems that most EFers start with a higher current and then drop to lower as the session goes on. A programmable controller makes a lot of sense. I believe dropping to the lower current is to get a finer grain (not sure that's the correct term) deposition. As such, does ripple actually matter that much? It's just pushing ions so I'd guess that the average "ion flux" is what matters. Even 10% shouldn't have that big an effect as the sites I looked at recommend starting at X current and dropping to X/5 or X/10 after an hour or so. It all seems fairly inexact in the first place.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 08, 2017, 08:15:44 pm
content: This might be relevant?Drew this years ago as a result of a conversation about using a computer power supply for electrolysis.Downside is it's linear. If you insist on digital control, use a DAC to program the input instead of a pot.Huh... wait, that's voltage regulated? Yeah, so let's see, if you want a regulated voltage, there you go, and if you want a regulated current, put in a clamp circuit to limit how high the op-amp's output voltage goes (and hence the output current). It's CC/CV.I wonder if alternating polarity would be of any use as well. That's usually necessary for long-throw plating (e.g. PCB vias).Anyway, for a switching version, any switching controller will do. There are three ways to control these:1. The only input is a voltage feedback pin: "bleed in" some bias from a DAC, to offset the setpoint. Instead of just a resistor divider from Vout to FB, there is a third resistor from DAC to FB.2. The error amp is accessible -- these come in two forms: a voltage mode op-amp, or a transconductance amp. It's voltage-mode if the compensation network is placed between FB (op-amp -in) and CMP (op-amp output), transconductance mode if from CMP to GND.3. Current control: you may be able to bleed in an offset to the current sense / shunt resistor, same as #1. This may affect the system in unintended ways (e.g., forcing ripple to be higher or lower because it thinks the current is something else), so check the internal logic of the controller to see what effect it should have.Examples:- UC3842: voltage mode error amp, CMP pin represents peak current output. To regulate average current, you need a current sense at the output, and you feed that to the error amp. To the extent that peak current is representative of average current (not usually very good), you can strap the error amp as an inverting amplifier (no compensation needed) and connect it to the DAC. The #3 method above could also be used, but since you have the same action from the CMP pin, it's not needed.- TPS54233 and such: transconductance amp, so you can strap it as an inverting amplifier (use fairly large resistors), or ground the input and overdrive the CMP pin directly (since it can only source/sink a few microamperes). This is a peak current regulator with slope compensation, so V(CMP) is even less representative of output current than otherwise. So you'll need a load current sense to regulate average current.Okay, bad example, it's a regulator (integrated switch), not a controller (external switch), but controllers are available, with external current sense so you can do #3 as well.- TL494 and such: hah, not such a good idea on account of their being slow, not having very useful drive capability, and their mostly being used for voltage mode control (bad). But because they're pretty general (uncommitted error amp, CMP pin is PWM%), you can set up a current feedback path, and get average current mode control (which doesn't need a load current sense). This is the preferred use case, anyway, and if you want regulated voltage, you add an external error amp to implement it.I'm not sure if any modern controller ICs use average current mode control. Peak current mode is very common, which prefers smaller inductor values (less cost, size), whereas average current mode prefers larger values (which can be cheap lossy powdered iron).Anyway, plenty of options!Tim

author: langwadt
author_rank: Super Contributor
timestamp: November 08, 2017, 09:17:50 pm
content: any synchronous buck should be able to sink current, adjust the output by forcing the feedback voltage dividermeasure current with shunt and current sense amplifier

author: IoTguy
author_rank: Contributor
timestamp: November 09, 2017, 03:42:23 pm
content: Hi Langwadt,Interesting idea of using a synchronous buck converter. So in this case the switch (MOSFET) used instead of the diode in a non-synchronous converter would be switching to ground and the other switch would be replacing the diode. I guess the feedback voltage needs inverting in this case but that's not a problem as the feedback needs to incorporate the DAC output anyway.So something like this (ignore values)?https://photos.app.goo.gl/L2JFMlOrBPTaXnuR2

author: langwadt
author_rank: Super Contributor
timestamp: November 09, 2017, 08:15:35 pm
content: Quote from: IoTguy on November 09, 2017, 03:42:23 pmsomething along those lines. If the load is changing slowly maybe just make it voltage modei.e. set the output voltage with 2 with resistors to FB, measure the current with MCU and injectcurrent into FB to change the voltage

author: ogden
author_rank: Super Contributor
timestamp: November 09, 2017, 08:32:54 pm
content: Voltage mode is not a good idea. I suggest to consider negative input, negative output buck converter with current feedback regulation. - Practically every voltage-regulated buck converter can be redesigned for current control, by introducing shunt and current sense amplifier and maybe level shifter if needed. As a starting point I suggest this article:https://www.eetimes.com/document.asp?doc_id=1272382Yes, it's counter-intuitive for us who mostly live on positive side of the ground

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 10, 2017, 12:16:22 am
content: Sync isn't necessary for a fully dissipative load. It does improve efficiency (at these voltages -- pretty significantly).For current mode control, basically swap the position of the current sense resistor and capacitor, so that inductor current is being monitored first, then voltage second.Any controller worth using will have current mode control built in, e.g. LM5117. Follow the appnotes, or heck, buy a few eval boards and use 'em as is!Tim

author: ogden
author_rank: Super Contributor
timestamp: November 10, 2017, 09:37:23 pm
content: Quote from: T3sl4co1l on November 10, 2017, 12:16:22 amIn case of 2A current, power dissipation in shunt resistor can be unacceptably high for voltage mode controller. That's why I agree to you that it is worth consider only current mode controllers or penalty in form of additional opamp shall be paid.

author: IoTguy
author_rank: Contributor
timestamp: December 01, 2017, 11:19:45 am
content: Just to update on this.At first I tried with various synchronos buck converters but they did not work (at leat in simulation). I suspect because the current measurement inside the chip (for CCM) is in the wrong direction for this configuration or maybe the MOSFET gate drive voltage generation is only implemented on one MOSFET and in this configuration it would be the wrong MOSFET. The feedback circuit was also complex as it needed to be inverted as well as level shifted.Inspired by the article ogden linked to, I found this:http://www.electronicspecifier.com/power/space-sensitive-design-with-negative-input-negative-output-buck-convertersSo this is what I've got now:https://photos.app.goo.gl/K33LtmDa4ym19XLo2Using a boost converter means the feedback has only to be level shifted (and not inverted).This simulates well and matches my calculations. I'm a bit concerned with the bandwidth of the INA240 being 400kHz (-3b point) so I plan to reduce the switching frequency (R6). I'll maybe use a high bandwidth op-amp to drive Vdac. I'll use the micro-controller to calibrate using a multi-point table and/or maybe also run a PID output adjust all the time.Thanks for all the suggestions so far and I welcome any thoughts on the schematic linked above before I build a prototype.

author: jbb
author_rank: Super Contributor
timestamp: December 01, 2017, 09:06:31 pm
content: I might be a bit late to the party, but I can say that some of the Texas Instruments C2000 microcontrollers have High Resolution PWM (HRPWM) blocks that are good to approx. 300psor better.Direct digital control can offer some advantages if you're willing to go the extra mile, but will involve quite a bit more software effort to get things right due to the high-speed requirements. One big advantage is that it's easier to adjust controllers (and they give more consistent behaviour across channels) and calibrate current and voltage sensors.Considering a TMS32F28069:Clock freq 90 MHz12b ADC with scan rate of 3.46 MS/s8 HRPWM channelsControl Law Accelerator (CLA) (small high-speed numeric co-processor)As we would like to scan 8 currents + 1 bus voltage + 1 temperature sensor, we see that the highest rate available is 346 kS/s on all channels. Therefore a maximum switching frequency of, say, 300kHz could be used (Ts = 3.33us). 90MHz clock * 3.33us = 300 clock cycles per period, so approx. 300/8 = 37 clock cycles would be available for inner control loop execution by the Control Law Accelerator.With Ts = 3.33us and HRPWM granularity of 0.0003us, the effective realisation available is approx. 11000 counts or 13 bits. This is one more bit than the ADC resolution, so control should be quite good and not prone to limit cycle oscillation.So multi-channel digital control is possible, but at the cost of quite a bit of software development.For current sensing, the LEM CASR 6-NP might be a good option. They're a bit large and expensive (especially when you need 8) but offer a lot of nice stuff:isolated measurement (i.e. will be largely immune to common mode ripple problems with the 12V supply rail)just enough bandwidth (-3db @ 300kHz)good linearity (0.1%)good DC drift (50ppm/K worst case, so +- 15mA over 50 degree temperature rise)OK initial gain accuracy (0.7%)good gain drift (40ppm/K worst case, so +- 12mA over 50 degree temperature rise)external reference pin (very important for getting good DC accuracy)for 200kHz switching, set to 3A range to provide derating for ripple currentfor >200kHz switching, set to 6A range to provide derating for ripple current