Search for LTspice in Topics


LT Spice Switches?

I have a simple question... If anyone here knows about the program LTSpice, is it possible to create switches that are manual, like pushbutton switches, spdt/dpst/etc., not automatic switches?

Question by 101yummYYummy101    |  last reply


How to measure open loop H(s)? Answered

When designing constant current linear dummy loads, and when I was (attempting) to design a really nice linear power supply with op amps and pass transistors, I consistently run into the devil of the circuits that incorporate feedback. INSTABILITY! Especially if I use fast op amps, or MOSFETs, etc. My understanding as to why this happens is because I still have some positive gain at the point at the frequencies where signal the total loop has that dreaded -180 degree phase (gain margin) and then where the gain is unity and phase is at -180, again allowing that frequency component to be successively amplified (or never attenuated) as that wave whirls around the loop. However, with op amp circuits, how am I supposed to get an accurate open loop measurement, when the DC gain is so stupidly high the input to an op amp is essentially a comparator? http://www.ti.com/lit/an/snva364a/snva364a.pdf This article suggests whacking in a 20 ohm resistor and injecting a signal into it, and measuring the voltage on either side of it (?) How is this supposed to work? Is there a better method in something like LTspice?

Question by -max-    |  last reply


Accurate Variable Current Sink? Differential Voltage Reference?

Some background: I have recently aquired a few really nice (and really heavy!!!) LAMBDA power supplies, The largest one supplies 24V, and up to 9A, but has annoying foldback current limiting, which causes the output shut off when even a short period overload (like inrush current) is detected. What I want: I would like to modify this power supply to give me (ideally) completly variable 0-15v dual rail voltages & 0-5A adjustable current limit, & I would like this to be controlled with arduino so that I can use a nice LCD display and control the supply remotely with a bluetooth or wifi app, and possibly do some data logging which could come in handy for energy measurements and stuff! My current PSU design: The schematic below is what I've currently built in LTspice. Both the voltage & current regulation work. The voltage across the (+) and (-) inputs of the current error amplifier should be the sum of the voltage drop across the shunt resistor and the voltage drop of a voltage reference, so when the voltage on the shunt resistor exceeds the voltage of that reference, the op amp will start to limit current by reducing the bias voltage on the pass transistor. This V_ref needs to be both variable and accurate, but since this V_ref is a differential voltage between the output of the pass transistor and the input of the error amp, I came up with the clever idea to use a resistor there and a variable constant current sink. That way the constant current through that resistor results in a fixed V_drop across it. With a bit of fudging around with it, I was able to make it work. However, I need to replace that "ideal" current sink with a real one. I tried using the classic NPN-based one, but it wasn't good enough. I then attempted to make the slightly improved version of that current sink with a spare op amp, although this worked, it would stop pulling current once the voltage fell below what was being maintained across the small resistor. The REAL question: Would anyone happen to know how to make a really accurate and variable current sink? Maybe if this is not such a great idea, what other methods can I use to generate a fixed differential voltage?

Question by -max-    |  last reply


Power Supply Question? Answered

I want to build a switching Power Supply, without the use of IC's with everything already inside. I only want to use op amps and passive components. Below are my goals on what to achieve. I would like to make this PSU current limited, or at least shut off when the current goes too high. I basically took the concept of the linear voltage regulator and expanded on it, turning it into a 'proof of concept' switchmode supply. Input Voltage range: . . . .7-24 Volts Voltage: . . . . . . . . . . . . . . 5-24 Volts Max Current: . . . . . . . . . .10 Amps Price: . . . . . . . . . . . . . . . . $5 -- $10         Instead of feeding a voltage reference into an op amp, I modulated it with a few components. (A triangle wave generator, and a array of resistors to lower the amplitude and introduce a DC bias.) The DC bias is controlled by the current protection module, which is simply an op-amp that reads the voltage on a small resistor and multiplies it by 5. This finalized current controlled, DC reference biased triangle wave is fed into a comparator, which will then switch a rather large MOSFET on and off at about 200 Hz, with varying PWM, depending on how much 'droop' there is on the output. Here is a rundown of what the components will do: OK, I refined my plan to this general specs: Input Voltage range: . . . .7-24 Volts Voltage: . . . . . . . . . . . . . . 5-12 Volts Max Current: . . . . . . . . . .10 Amps Price: . . . . . . . . . . . . . . . . $5 -- $10        I basically took the concept of the linear voltage regulator and expanded on it, turning it into a 'proof of concept' switchmode supply. I don't want to use any prebuilt chips where you have a magic black box with inductors, capacitors and resistors connected to it. I want this to be entirely raw, basic, cheap parts. Maybe later, I will replace many of the op amps with a single programmable chip (like an Atmega328P)         Instead of feeding a voltage reference into an op amp, I modulated it with a few components. (A triangle wave generator, and a array of resistors to lower the amplitude and introduce a DC bias.) The DC bias is controlled by the current protection module, which is simply an op-amp that reads the voltage on a small resistor and multiplies it by 5. This finalized current controlled, DC reference biased triangle wave is fed into a comparator, which will then switch a rather large MOSFET on and off at about 200 Hz, with varying PWM, depending on how much 'droop' there is on the output. Here is a rundown of what the components will do: Green field: This contains a voltage regulator which acts as both a 5V power source and a voltage reference. Not only will this module produce a 5V output, but also produce a triangle wave. Blue field: This module will be fed the triangle wave, decrease it's amplitude, and inject it with a bias voltage, controled by the current limiter (red field). Red field: This basic module simply measures current flowing through a 0.1 Ω resistor, and multiply that reading by a factor of 10, and inert it (the circuitry is probably wrong, and I am not sure how this will work, if it even will do what I want it to Will this work?) Yellow field: The final modulated triangle wave is then fed into the last comparator, which will switch a MOSFET on and off at a fixed frequency of 200Hz. The output of this last comparator is now PWM. As the output voltage sags, the pulse width will increase, and cause the final voltage to stabilize at either the peak value of the triangle wave (with little to no load), or near the bottom end of the wave (with a heavy load) ------------------------------------------------------------------------------------------------------------------------------------ My questions:  I try to run this in LTspice simulator but some reason the output of the last comparator is a distorted triangle wave. I think this has to do with my filtering capacitor and MOSFET gate capacitance. Can anyone give suggestions about this design?  I'm sure the current limiting function is not going to work as intended until I finalize it's design (I hope I don't need more than 4 op amps altogether, It would be nice to use a single chip I already have) Any suggestions? I might just omit this part entirely, as it is not necessary.

Question by -max-    |  last reply


PSU design (major revisions): Transformer calculations help?

Recently I have attempting to design a proper dual-rail power supply that will allow me to set a voltage as low as +-1V up to +-30V in 0.1V increments at (hopefully) 3 significant digits (at least for the lower voltage settings). Anyway, this supply is also going to be current limited to up to 5A,again, it can be set to just about anything. I plan on using an Arduino micro-controller to set the output. In order to do this, I plan on using the analogWrite functions, or better yet, a legit DAC. There will be 4 outputs from the Arduino that will set the power supply output by applying a 0-5V voltage on the input of the 2 current limits and 2 voltage sets. (one for the negative rail, one for the positive). However, I have kept running into the same problem: how do I plan on driving this linear power supply with up to 200W*? My first idea was to use a a MOT, due to their high-power capabilities, and re wind the secondary with the right number of turns to achieve this output. However, I have heard that these transformers are not optimal for continuous running due to their poor and cheap design. (losses are very high). My second idea was to search around for a 250VA transformer. However, even until now, the VA rating confuses me. How does VA compare to W? I know this has something to due with reactive power, real power, and apparent power. However, I have no intuition of any of these 'powers.' How would I go about calculating the correct size transformer for the job, also, I am going to assume this linear power supply has the properties of a resistive load, since it is rectified and smoothed with a filter capacitor, so practically nothing should react with the AC power. (unless there is something more to the full-bridge rectifier setup I am considering.) This is when I came across unwound toroidal cores found on eBay for $25, the perfect price range! However, this has raised more questions! to start off, beyond turns ratio, I do not know now many turns I need for the AC side of things. I know intuitively and from experience, mains-frequency transformers do not work with only one (or even few) winding(s). I think this has to do with saturation, but I'm no expert by any means. and the inductive reactance of the transformer's primary. How do I calculate losses, inductance, and other important parameters of a homemade transformer like this? Things get very nasty when I look back at rewinding an old transformer. Now I have all these questions about inductive reactance, power, currents, magnetic flux and saturation, but also, about determining the original power rating of something like a very old small welding transformer or one from a large 10A car-battery charger. Is it possible to approximate the power by measuring the dimensions of the core? How close will this approximation be?  After getting frustrated with this, I considered alternative approaches. What if I purchased 2 ~20V ~6A SMPS (switch mode power supplies) connected them in series, and connect the center tap of my linear supply to the joining point between the 2 SWPS's? Would this be unstable and be bad for the SMPS if a load was connected between the 'outputs' of this new center tapped supply? Would any sort of balancing be required? Also, a bigger problem includes how this will be connected to my linear PSU design. With a low voltage @ high currents, I would be wasting a LOT of power, power that has to be dissipated away from the transistors. This heat can approach 200W, which is company unreasonable! Anyway, I would them have to either a switching preregulator, or modify the SMPS's so the voltage can be controlled easily and varied between, say, 3V to 20V. absolute accuracy is not required, close enough, and rest of my PSU should handle it. This becomes seemingly impractical too, and many other considerations need to be made. What should I do? what are the calculations and factors I need to know? i do not have an LCR meter to measure inductance, so trial and error is out. Does anyone here have experience at this? Help would be greatly appreciated! *The 200W figure was calculated by taking 40V, (What I believe would be a safe to allow some slack for +-5V voltage drop across my 2 shunts and transistors) and multiplying it to 5A of current for the maximum power output. ------------------------------------------------------------------------------------------------------------------- I have added an image of my current design, and I have modularized it the best I could. The YELLOW is all my current power-management circuitry. Currently just a transformer with many taps, going to a currently-undesigned switch box that will change the voltage on the output, which is then rectified and enters a filtering capacitor, finally entering the circuit.  The GREEN field is the voltage set. It is the most major part of the PID feedback loop, along with the ORANGE field. It works simply by feeding a voltage to the positive of a op amp configured as a comparator, and with negative feedback from the output. It then outputs a signal to the transistor, turning it either more ON, or more OFF depending on how the output voltage compares to the +Vset. The negative portion is largely the same, but the input voltage needs to be inverted so the output voltage is set negative properly. I was not able to use less than 2 op amps for this portion, unfortunately. The ORANGE field is current set. It works by measuring the voltage drop across the shunt resistor, and outputting a unity voltage that is referenced to ground, instead of to the positive rail. (It took me forever to finalize and perfect that!!!) Anyway, this voltage is then fed into a op-amp configured as a comparator to drive the transistor. The BLUE field is my switching regulation topology, which is controlled by both the ORANGE and GREEN fields. Do you like my use of diodes as a super-simple voltage or current selection switch? the op amp that outputs a lower voltage is the one that gets 'listened to' by the transistors. This way, current and voltage mode enable properly. This does add a small problem when it comes to powering the op amps, all of them have to be powered off of slightly higher voltages to swing the full range due to the voltage drops of those diodes. In the PINK field is simply a single-transistor solution to a constant current load. This allows the regulator to be regulated even at very low voltage set levels. This is why I am able to achieve a +-0.5V on the output (at least within LTspice) Finally, and most unimportantly, the light PURPLE fields have a simple ultra high-gain difference amplifiers that will detect if the output current and current set are the same, and turn On or OFF the respective LEDs. The green LEDs are voltage-mode indicators, and the red LEDs are to show when current-limiting mode comes on.

Question by -max-    |  last reply