Author Topic: Building a Simple Switching Circuit  (Read 4780 times)

0 Members and 1 Guest are viewing this topic.

Offline T3sl4co1lTopic starter

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Building a Simple Switching Circuit
« on: July 10, 2017, 05:14:35 am »
Last night, decided to build a high power flashlight real quick.

Step 1: basic design.

I have some spare 18650 cells, and holders.  A few amperes is pretty reasonable for these: conservative, and more than enough for a painfully bright flashlight.  With terminal voltage around 3-4V, that's about 10W, or three 3W LEDs.

If I connect the LEDs in series, I don't have to worry about current sharing.  The supply will then be around 11V, which is quite reasonable for a single stage inductive boost converter.

This covers pretty much everything relevant to the power stage.  All that's left is filling in component values and types (see below).



Because of the relatively input high current, it would be nice to operate in CCM (continuous current mode).  This gives higher efficiency, extending battery life some, and more importantly it reduces waste heat.

The basic control schemes to select from are: peak current mode, average current mode, hysteretic mode, and voltage mode.

The latter has no direct control over inductor current, so is ruled out immediately. Hysteretic would be fine for LEDs, but I want more adjustable range than that would afford (better dimming range).  Peak current mode is questionable in CCM: even with slope compensation to help it, it tends to be unstable.  This leaves average current mode being the best option.

(Note that the control method has very little, if any, bearing on the design and layout of the power circuit.  Dividing the design into strict blocks helps clear the mind, and lets you optimize each one on its own.)

The current being controlled is the input (battery) current.  That means the output power depends on battery voltage.  This isn't bad, since the cell voltage is fairly tight (whereas an alkaline battery might start at 3.1V or so, then have useful charge remaining all the way down to 1.5V).  But I would like to regulate the LED current.

It's not a big change: instead of controlling the input current against a fixed (probably user-selectable) reference, that 'reference' setpoint can be adjusted by another error amplifier, which controls LED current against a fixed reference.  Only an op-amp and a few resistors and capacitors are needed, so it's not a big deal.  It can also be expanded for voltage regulation, whether as an alternative, or jointly.  (How'd you like a 12V 1A bench supply-on-the-go? ;D )

Step 2: sectioned build.

Construct any parts needed.

First, I built the LED array itself.  I used blank 0.8mm PCB stock (copper clad).  I drilled three holes, for the heatsink slugs.  I carved gaps in the face, dividing the copper into five regions: ground, and the four nodes of the LEDs in series.

I soldered the LEDs in place, then cut hunks of copper as heatsink slugs.  I soldered these to the backside of the LEDs, in the holes.  Then I filed the rear surface flat.

I selected a nicely sized heatsink for the array, and epoxied them together.

This gives a module with excellent thermal performance, so that even these cheap Chinese LEDs should be okay running at 3W for quite a while.

(As a side effect, it is now very difficult to solder near the LEDs' heatsink pad...)

I also built up the rest of the base frame:







Step 3: component selection.

Having designed the basic circuit, I selected some components to implement it.  I found:
- NIKO brand P45N02LD (45A 20V DPAK N-ch MOSFET)
- SB945 (9A 45V schottky diode, DO-201)
- A pair of 10uH 3A inductors (Bourns, molded style; two in parallel gives the desired 5uH and current handling)
- Ceramic capacitors salvaged from a laptop motherboard.  About 40uF at 10V is required for output, and 80uF at 4V for the input.  I found 4 x 10uF and 4 x 22uF, 1210 size chips.  (The former were around the battery charging / main power circuit, and the latter were around the main CPU.)

While these capacitors should be okay given the size, I measured the C(V) of them anyway.  I did this by connecting the oscilloscope to the signal generator (50 ohms), to a pair of leads attached to tweezers, and measuring the risetime at different DC bias settings.  (For more info, check out EEVBlog #626.)  The 10uF chips were stable (within 25%) over the generator's 15V range.  The 22uF dropped off above 5V, which is fine (they only needed to handle 1.2V originally, talk about overspec'd! :) ).

- Current shunt resistors: I have 10mohm 5W shunts, 27mohm and 56mohm chips, and various selections at 0.1 ohm, 0.22, and up.  I chose to use 2 x 56mohm in parallel, for the battery current sense.  They are Panasonic "high power" (0.5W 1206, if you believe it) chip resistors.  I'll be using them at under 0.5W total, so that should be fine.  A 0.1 ohm 2512 chip handles LED current sense (1A = 100mV).

The battery holders, by the way, are Keystone #1043.  They're really nice.  The fit is just right, not too tight, not loose.  The mounting pegs snap into the board snugly, and can just barely be extracted again (with some chafing).  (I mounted this, successfully, by drilling one hole, then pressing and sliding the holder against the board to get the position of the other hole.  There's also a small registration peg in the corner.)  The material is glass fiber reinforced, and the dull finish feels nice in the hand.  This will be a very nice open-frame flashlight, I think!

Step 4: layout.  (Refer to the pictures above, throughout this section.)

With everything else decided, I began mapping out component placement.  All the power components (save the battery) must be located close together, to keep circulating currents contained.

The power components also need to be mounted on pads / pours / traces fat enough to handle the current draw (a few amps, not a big deal) and thermal dissipation (shooting for 1W total dissipation in the power circuit), and to keep parasitics (stray inductance) down.  The SB945 being an axial diode is the clear standout on that, unfortunately.

Layout proceeds backwards from the LEDs:
- I outlined a pad for VOUT.  This has the output capacitors, diode, and LED connection.  This was about 5-6 capacitor-widths wide, and 2 capacitor-lengths long, rectangular.

All pads are cut with a utility knife, making a V-score over several passes.

- I added a pad right beside it for the LED current return.  The 0.1 ohm current shunt connects this to ground.
- Capacitors need ground, so let ground pass all the way around these pads.
- Next pad, the main switching node SW: inductors, MOSFET drain, and diode anode connect here.  This should be larger for thermal reasons.  It can't be the full width of the board, because I need some ground wrapping around it to carry the return current from the capacitors.  I also need to reserve some space for the gate and source pads.  Placing the transistor perpendicular to the board's long axis seemed the best approach.
- For now, a 1kohm resistor keeps GATE lightly grounded.
- The inductors connect to an adjacent pad, BATT.  This needs to be as wide, because the inductors are placed side-by-side.  The input bypass capacitors are also placed here, opposite the inductors.  (The battery then connects to the capacitors via wires.)
- The battery isn't grounded, as such, but is "suspended below" on shunt resistors.  Thus, BATTSNS gets one last pad.

With these carved out, the placement is set in stone, or at least in fiberglass.  The overall length is not the best: it spans about 5cm.  But half of that is taken up by the inductors and battery bypass, which is fine because that stray inductance is in series with the main inductor.  And the axial diode will eat up a good 10nH alone, so that the switching loop can't be improved very much by smooshing it together more, anyway.

Step 5: verification.

Because why build something on hunches, if you're not going to confirm those hunches?

After tinning the pads and placing components, the circuit is ohmed out.  Nothing is shorted that shouldn't be.  Apply a little voltage: nothing happens.  (Vin is measured at Vout, since the schottky is quite leaky, and there's no load on it at low voltage.)

Set the function generator to 5V (into 50 ohms), square wave, 100kHz, adjustable duty cycle (set to minimum first).  Connect to a tee with a terminator, and BNC-to-binding-posts for a pair of clippy leads.  Clip onto the gate resistor.  Insert battery.

It lights!



The SW waveform looks reasonable:



(Top: SW, Bottom: GATE)

The SW ringing corresponds to about 1.4nF || 5.6uH, which is about right: the diode and transistor sum to around that capacitance, and the inductance is 5uH.

The ringing couples into the gate pretty strongly, and pretty nonlinear at that (look at that nearly sawtooth shape!).  Not enough to be a problem, and of course, this is a symptom of the crappy gate drive -- a source resistance of 25 ohms.  That's also why the Miller plateau is some 100-200ns long.



Turning it up to about 4.5us on-time gets the peak input current around 4A (not shown).  It also gets pretty frikkin' bright...



Also, what's that ringing on the rising edge?



It's about 70MHz, corresponding to a stray inductance of ~5nH.  Not bad, I was expecting worse for that diode!

That is, of course, the diode acting as an inductor, against the transistor's drain capacitance (about 1nF).

There should be ringing associated with turn-on as well.  It will only be significant in CCM, because of the higher commutation voltage (i.e., the amount of voltage the transistor has to turn on at).  It appears across the diode rather than the transistor.  Likely, this isn't switching the transistor fast enough to see it anyway, but it will also be difficult to measure directly because of the diode's shape.  (It will be visible by inductive probe.)

Step 6: the control circuit.  To be continued...

Tim
« Last Edit: July 10, 2017, 05:19:04 am by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: BravoV, tautech, doktor pyta, orolo, lem_ix, MK14

Offline T3sl4co1lTopic starter

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Building a Simple Switching Circuit
« Reply #1 on: July 22, 2017, 07:59:55 pm »
And the completed build:







The schematic is slightly different from the build (not that you can tell, I hadn't taken a closeup of the finished controller), but the operation is identical.



This is a traditional PWM generator.  The ramp generator is in the top-left.  It runs at about 200kHz.  The current mirror charges C9 with constant current (with good compliance, important for the low voltage overhead in this application: only 3V), then the comparator discharges it through a diode.  (R10 is necessary to slow discharge, so it doesn't produce runt pulses.)  The ramp is compared with the PWM control voltage, PWMV, which changes gradually in response to inductor current.  Thus, GD is PWM.  This is buffered with a parallel logic gate to drive the MOSFET.  (In the proto build, I used a 74HC14 instead, with a boosted drive topology that gets ~60ns rise/fall on the 45N02 transistor.)

The rest is just slow analog controls.

IC3B controls PWM based on inductor current.  INSP is the inductor current setpoint.

INSP is, in turn, controlled by IC3A, which regulates ILED based on an adjustable reference voltage.  (R15 is a logarithmic pot, so the intensity response feels right.)

The remainder of the circuit (the bottom left) is a limiting circuit: two of these are protection, one is functional and protective.
1. R17-R21 senses the supply voltage.  When it goes below threshold (3.00V), ILED1 is pulled up, reducing output current.
2. A thermistor senses LED temperature, preventing destructive operation (yeah, the heatsink really is kind of too small for this, and gets hot at full power).
3. VOUT is clamped with a zener diode.

Note that all of these limits are very soft.  The diff pair (Q5 and Q6B) transitions from "off" to "on" (that is, Q5 collector carrying ~zero to ~full emitter current, which is set by Q4) over almost 100mV.  This is important, because these limits are closed loop, and they could oscillate if they had too much gain.  With limited gain, they are very easy to stabilize.  In fact, I didn't notice any instability: no additional compensation required!  The limits do not need to be accurate, so this is acceptable.

Because of the two stage regulation, the output current is very stable.  It is pretty much independent of supply voltage (from 3.0 to 5.0V), output voltage (given that VOUT > VBATT, because it's a boost converter), and accurately follows the setpoint (R15) from zero to maximum.

Because of the modular design and multiple feedback signals, the same design can be modified trivially for a number of applications.

To make a portable bench / lab power supply, simply swap the feedback source for IC3A: instead of LED current, use a divider on VOUT.  Move ILED to Q5 (you'll need to add a current sense amp to boost and invert the signal, however), or add an additional error amplifier for precise (and adjustable) current limit.  (You might also add a diff amp to sense the output voltage minus the shunt voltage.)

Voila, 12V 1A single cell bench supply!

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: MK14


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->