Showing posts with label analog. Show all posts
Showing posts with label analog. Show all posts

Sunday, April 06, 2014

IC Design Interview 6: Op-amp Circuits

You must know your op-amp circuits to do analog circuit design! During an interview, you even have to derive the operation equations. Each of these derivations starts with the result in bold (because you must just know that) followed by the derivation.


Inverting Op-Amp

Vout = -(R2/R1)Vin

Vin/R1 = -Vout/R2
-(R2/R1)Vin = Vout


Non-Inverting Op-Amp (Buffer)

Vout = Vin(1+R1/R2) = Vin((R2+R1)/R2)

V- = Vout R2/(R2+R1)  [Voltage Divider]
Assume V- = Vin
Vin = Vout R2/(R2+R1)
(R2+R1)/RVin = Vout
The special case of R2 being open (infinite resistance) creates a Unity Gain Buffer

Difference Amplifier

Vout = R2/R1 (VB-VA)

Assume V- = V+
V+ = VB R2/(R1+R2)   [Voltage Divider]
Since I1=I2                 [Kirchoff's Current Law]
(Vout-V-)/R2 = (V--VA)/R1
Solve for V-
R1Vout+R2VA = V-
      R2+R1
Which is the same as V+, so
R1Vout+R2VA = VB R2
      R2+R1             R1+R2
Which can be solved for Vout
                                                                                         Vout = R2/R1 (VB-VA)

Wednesday, December 05, 2012

Boost Regulator Powering Small White LEDs

My short contract turned out to last from March until November. Great for the paying the bills, lousy for getting anything else done. It was a decent gig, I got to do lots of things. Everything from writing and synthesizing Verilog, to block level analog verification, to top level mixed-signal verification, to Perl/Tk for a simulation environment, and creating a PSpice model to round the contract out. I had never done high level modeling in PSpice before, so I got to do a variety of things I've done before and something new. Not too bad. 

I have decided to publish this blog on a monthly basis; I intend to publish on the first Wednesday of each month. I should be able to keep up that pace even if I am in neck deep in a contract. Since I am briefly between contracts, I will write several blog entries ahead. I might even proofread them if I write them ahead of time like that. 

Enough administravia, on to some design!

I am revisiting and finishing the LED lighting system for a boy scout trailer. As you might recall, the challenge is to place a robust, low power lighting system inside a boy scout troop equipment trailer. The lighting system will be powered by a 12V lead acid battery that may only get charged for a couple of hours each month. the lights need to usable for two nights of camping in between those charges. Low power (30-40mA) white LEDs seem like a good way to handle this. 

To simplify the wiring to the LEDs, the LEDs are connected in series. Only two wires need to be connected to the LEDs from the control box this way. I want to keep the highest potential present in the system below about 40V. The white LEDs I chose have a maximum forward voltage drop of up to 4.4V. So eight in series. 

I am using the National Semiconductor (now Texas Instruments) LM2585 boost regulator controller. It's a nice chip for this application. It is simple to use, has a low pin count, and has more than enough power capability. The LM2585 datasheet recommends using TI's WEBENCH Power Designer. This is a nice tool, I like it's power, it's simplicity, and it's wealth of produced information (even a suggested parts list). However, it requires a more recent version of Adobe Flash than I have bothered to install on my Linux computer, so I had to shift over to my Windows laptop to use it, and I didn't really get the feel of the circuit. Since I am using the regulator in a current feedback mode, the simulations can't be made to do what I'm going to do. So it's a great system but I had to fiddle a bit with it's results before I was comfortable. Of course, I checked the results with hand calculation to make sure they made sense. 


Figure 1. LM2585 30mA LED driver.
There isn't much to say about this. It is close to the standard application schematic except that the feedback point is taken at the top of a 41Ω current setting resistor. The LM2585 will try to control the out voltage to maintain 1.23V at the FB node (1.23V/41Ω=0.03A). The 36V zener diode across the output keeps the voltage from increasing wildly if the chain of LEDs is broken. I have tested this by intentionally opening one of the LED connections. By the slight smell, I can tell this is straining the capacitor and the circuit is none too happy about that operating mode, but it is keeping the circuit from actually blowing up. Bursting into flames is almost always a bad thing.

I put this circuit together on a generic PC board as poorly shown in figure 1. The close up in figure 2 shows that my way of making a surface mount inductor into a through hole inductor. Just solder a couple of wires to it.

Figure 1. The physical implementation. The 1mH inductor is almost as large as the rest of the circuit. 


Figure 2. Now it is a through hole inductor.



Figure 3 shows a scope shot of the circuit in operation.

Figure 3. Scope shot. Channel 1 (yellow) is SWITCH. Channel 2 (blue) is FB. Channel 3 (purple) is OUT. Channel 4 (green) is IN. The too large capacitor (22uF) keeps the output level. 



When I started this project, I assumed getting the LED regulator going would be most of the work. I was wrong. Next time I will show what I came up with for the on/off switch. That turned out to be more complex. In fact, the installment after next will be the program for the micro-controller that is becoming part of the switch. 

Figure 4. The whole circuit on my dining room white board.


Next month, the on/off switch circuit and a complete parts list. Until then, I hope I'm doing someone besides myself some good. Good luck on your own projects!

By the way, does anyone out there know how to submit Design Ideas to EDN? I couldn't quickly find the submission guidelines online or in the print magazine. 

Bruce


Wednesday, May 23, 2012

Design Notes: Op-amp Stability Analysis in SPICE

Op-amp stability analysis involves getting an DC operating point with the amplifier running normally then opening the feedback loop and getting small-signal AC information. This can be done by using a very large inductor to pass DC and block AC and a very large capacitor to pass AC and block DC, but I've only seen it done that way once (and that was just last week, go figure).
HSPICE and many of its relatives, including SmartSpice, have the ability for a resistor to have a different value depening on if the simulation is DC (like an operating point analysis) or AC. The schematic below shows a simple way to accomplish this. This even works with Cadence's analogLib res, but I have not gotten it work with Cadence's analogLib resBias. But if you have access to Cadence you probably want to use the stb analysis and skip all of this. 


The listing shown here is for Silvaco's SmartSpice. HSPICE isn't that different. 


.option
+ post=1
+ measout
+ nomod
+ unwrap=1
+ usedegrees
+ savemfiles=1
+ savemodelslog
+ ingold=1
.temp 25
.AC DEC 50 10 10000meg
.LET AC mGAIN = vdb(out)-vdb(pos)
.LET AC mGAINM = -(vdb(out)-vdb(pos))
.LET AC mPHASE = vp(out, pos)
.LET AC mPHASEM = 180+(vp(out, pos))
.MEAS AC mGANMRG FIND mGAINM WHEN mPHASE=-180
.MEAS AC mPHSMRG FIND mPHASEM WHEN mGAIN=0
.MEAS AC mUGF WHEN mGAIN=0



There have been some some health problems in my family, so this was just a quick note to keep this blog weekly. I expect to have assembly and operation notes on the LED drivers next week. 

Bruce McLaren

Wednesday, May 16, 2012

Boost Regulator Soft Start

I am using the soft start circuit more-or-less straight from the LM317 datasheet

Soft Start using an LM317. Takes 300msec to reach 9V.

I started by adjusting the resistors to give a 9V output and use 1mA of bias current. It turns out the LM317 requires 10mA of output current to regulate. It's right there in the datasheet, but I missed it until I started to put the circuit together and couldn't figure out why it wasn't regulating. So I went for 10mA of current. Which seems like a lot. Maybe I should make an improved 317.

10mA. Ouch!

My intention is to soft start both the power supply for the compensator and the reference voltage. I used a diode model I had handy; I don't think the diode itself is particularly important.

Soft Start simulation results.


This entry is just a quick note. I ordered parts from Mouser and have started actually building the LED driver. I had trouble finding comparators of the needed speed at a price I could stomach. I'm going to try using the op-amps and only buy comparators if I need to. 

The approach to building the circuit will be to make the linear regulator with soft-start and use it to provide references. Then make the triangle-wave generator and see if I can really get a 400kHz triangle wave out it. Then make the boost regulator, but drive it from a pulse generator to check it out. Then pull the whole thing together. 

Then design a battery charger and interface and an on/off switch. Then install the beast in the trailer. 

I intend to publish photos of the building and verification process next week. I will also publish the schematic as it now is. I switched to direct current control and didn't document the change. It's not a big change, but it lowers the operating voltage and therefore the power requirements.

Late addition. I soldered the linear regulator and soft-start (and resoldered after finding I needed more LM317 current as explained above). I'm actually hitting 9.2V for input voltages above about 11V, that's less than 5% error.  The scope shot shows lower because my waveform generator only goes up to 10V. The soldering is not the best I've done. I could blame the re-solder, but I'm out of practice. I will have to do better when I put the triangle wave generator on here. I'm trying to decide if I use sockets for that part. It would make soldering safer.


9V regulator with soft start.

Soft start in operation. A bit faster than expected, but close enough. 


Miscellaneous tidbit for this week. I use this alias in my .cshrc.
alias big 'find . -type f -exec ls -s1k {}  \; | sort -gr | head'

And this one in a .bashrc.
alias big='find . -type f -exec ls -s1k '{}'  \; | sort -gr | head'

I don't remember now if the syntax is different for the different shells or just how they have drifted.
big gives a sorted list of the ten largest files in the current hierarchy


Bruce McLaren

Wednesday, May 09, 2012

Triangle Wave Generator

The part of the saw-tooth wave generator has been played by an ideal voltage pulse source in my boost generator schematics and simulations. It's time to make a "real" one. 

Note that a saw-tooth wave generator can be replaced by a triangle wave generator operating at twice the frequency. Think of a triangle wave as two back-to-back saw-tooth waves. So I need a triangle wave generator operating at 200kHz. 

This little circuit took me longer than I thought it would. I've designed triangle wave oscillator on chips in the 100kHz to 1MHz range. Doing this from components and keeping the capacitors large enough that I'm not worried about stray capacitance swamping the real capacitance has been a bit of a mind-bender for me. 

Triangle Wave generator schematic

In the schematic shown above, the comparator has significant hysterisis. On an IC, I am used to implementing that circuit using two pass gates (an analog multiplexor) selecting which reference voltage to apply to the positive input of the comparator. This is a smaller, simpler solution on a CMOS chip.  Two resistors are the smaller, simpler solution on a PCB. 

The 10Ohm resistor R4 was needed to get the circuit to converge. 
I needed to select a very small minimum time step to get the circuit to simulate accurately. This will cause trouble if I integrate this circuit in with the boost simulation. 

Triangle wave generator simulation. The light blue signal third from the top is the output.


This is actually operating at 448kHz. once stray capacitance has its way on what will be a hand soldered board, I wouldn't be surprised at 400kHz. That's still twice as fast as I expected. I will gladly re-do my calculations in return for a smaller inductor. 

Bruce

Wednesday, March 07, 2012

IC Design Interview 3: Bandgap Reference

Life has intruded so not much update on the boost converter. I do now understand there is a brand new shiny zero that has to be taken care of. I also now understand the gate drive needs to forced to oscillate at some duty cycle regardless of the output value. I need to rework the feedback compensator to account for the boost AC characteristics instead of the buck that is in there now. Until I have that ready, here's some more interview notes.


The bandgap equations must be derived sometime during every integrated circuit design interview. At least it seems that way. It is a standard, useful circuit found in nearly every chip. I think the discussions about the circuit are better able to gauge a candidate's knowledge and experience, though. 

Start with a schematic like the one shown below. 




That last equation isn't the final answer, though I've never been asked in an interview to go beyond it. VBE has a negative temperature coefficient and the VT has a positive temperature coefficient so appropriate values of resistors and bipolar multipliers can be found.In general R1 and R2 are made equal. Then the bipolar multipliers are set based on layout. Pick a rectangular array that allows Q1 and Q2 to be arranged in a common centroid configuration. Then set the ratio of R1 and R2 for zero temperature coefficient.

There are at least four other sub-topics that I will put off until a later blog entry.

  • Current conveyor instead of an op-amp
  • Lower voltage reference
  • Producing a VPTAT (Voltage Proportional To Absolute Temperature)
  • Start-up issues
Bruce McLaren

Wednesday, February 08, 2012

IC Design Interview 2: Miller Op-Amp

I sprinkle Miller op-amps around my designs. They are useful to drive low capacitance internal signal lines. They make fine buffer amplifiers. Many IC designers seem to be dead set against them, but I think they do have their place. Even those engineers who would never use a Miller op-amp and spend a fair amount of time during the interview explaining why no one should ever use them will expect good knowledge of the structure, theory, and practice of design and use of the lowly Miller op-amp.

These are my interview notes so they only cover the things I tend to forget, i.e., the equations.



I am hoping to have interior trailer lights ready for next week.

Bruce McLaren