Understanding transistors and opamps - Page 1
Forum section: electronics / beginners

author: electronwaster
author_rank: Regular Contributor
timestamp: February 17, 2012, 10:53:32 pm
content: Hi,I want to build a power supply (I mentioned that before in the "linear power supply ideas" thread), and though I started down the path of the LM317, I ended up at HP schematics full of transistors and opamps, none of which I understood, so I am trying to understand how to design very basic circuits using these things. I'm playing in LTSpice at the moment, which is a great tool, and the more I use it, the more I learn and the less time I spend burning myself with a real soldering iron :-)I guess I learn and retain information best when I learn the hard way, so I've been having small aha moments when trying to figure out why people don't just use a voltage divider (or potentiometer) as a regulator, etc. It may be obvious to everyone else, but now I get it too, which pleases me!I have mucked around with npn transistors following a voltage divider in emitter follower configuration (series-pass), and this is good, much improved load regulation over just a voltage divider, of course, but nothing like ideal. I have also played with an opamp buffer after the voltage divider, and this is improved but still not ideal.The stage I'm at, and the best I have come up with on my own is a voltage divider (potentiometer), followed by 741 opamp buffer, followed by power transistor (NPN) as a series pass device, and the opamp output voltage (being load-protected by the NPN) is untouched under varying loads, which is great. The transistor output is ~0.6-0.7V down because of the base-emitter junction volt drop, which I don't know how to get around (negative supply? like an LM317?) Also - the transistor output isn't quite as rock steady. When I vary the load from e.g. 1Ohm to 1Meg Ohm, to simulate a large variation in current demand, the voltage isn't too well load-regulated. How would you improve the load regulation of this circuit (attached)?Any ideas what I should try next? I want to take small incremental steps so that I understand as much as possible and learn all the reasons not to do it like this or that, but I don't yet want to worry about anything like current limiting, line regulation etc.Another next step is to look into precision voltage sources, either zeners, dedicated ICs, maybe just an LM317, but this brings along the problem of regulating down to 0V. Any really simple solutions to this problem gratefully received too!Thanks,electronwasterPS: R1 + R2 are my voltage setting potentiometer, R3 is my load resistor, Q1 is a 7A power transistor

author: DaveW
author_rank: Frequent Contributor
timestamp: February 18, 2012, 12:45:14 am
content: Try taking the inverting input from Vout instead of the output of the op-amp.Alternatives to correct the Vbe drop include using a diode to add the voltage on; but Vbe drifts with temperature, so as your output transistor heats up, your voltage correction will drift out.

author: DaveHardy
author_rank: Regular Contributor
timestamp: February 18, 2012, 12:47:23 am
content: Do you have an objective or power requirements for a project? If you're just doing it for fun, there are several circuits that you can "Google." First, I would avoid messing with op amps until you understand how to bias a transistor because op amps really aren't necessary for a simple high quality linear power supply design. Op amps themselves are just a bunch of discrete components in a monolithic package. I suggest that you read up on Bipolar Junction Transistor H-type biasing and work from there.There are an endless amount of linear supply schematics on the web. I hope that this insn't too complicated, but here's an over engineered PSU that employs just about every trick that you should know:The whole thing shuts down if one rail dies, protection diodes on the output, etc. Study it because it employs a bunch of protection circuitry and safety measures.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 18, 2012, 12:56:35 am
content: These are some of the things you can move on to from here...Replace the voltage divider with a resistor and zener diode. The voltage divider in your circuit only works now because you have a regulated input voltage--a constant 10V. The zener diode will allow for variations in input voltage. It will typically be the case that the input voltage isn't regulated. It might be the rectified output of a transformer, for example.Zener diodes are fairly simple to understand. You will be using one as a voltage reference in this particular case. They're not exactly ideal--there are better voltage references out there--but you'll need to understand how they work, nonetheless.Once you're comfortable with zener diodes you might check out voltage reference ICs such as the TL431. The TL431 can replace both the zener (and the resistor necessary when using zeners) as well as the op amp. The datasheets for TL431s are good references for voltage regulator circuits, by the way.Take feedback from the output. Right now your op amp is just a voltage follower. It is 'following' the voltage presented to the non-inverting input. This means it isn't actively regulating the output. By feeding back a portion of the voltage at the output, the op amp can actually react to what is happening at the output. This is also how you get rid of the 600 to 700 mV you are losing due to the series pass transistor's Vbe and how you can create a variable output voltage.The feedback will go to the op amp's inverting input. Just use the output of a voltage divider placed between the output and ground for this. You'll need to understand the basics of how negative feedback to an op amp works. In this case the op amp is going to make the voltage at its output whatever is necessary (if possible) so that the inverting input's voltage (via the feedback) matches that of the voltage at the non-inverting input. To keep things simple just use a voltage divider with equal value resistors. That means that the op amp will drive its output to the voltage that is necessary to bring the voltage divider's output (the op amp's inverting input) to the same voltage as the non-inverting input. If your input voltage reference (zener diode) is 2.5V then the op amp will output a voltage of approximately 5.7V. The emitter follower (series pass) transistor then outputs 5V. And the voltage divider returns half of this--2.5V--back to the inverting input.You can vary the output voltage by making one of the resistors in the divider a potentiometer instead of a fixed-value resistor.Something else to look into is using capacitors on the input and output as well as on your voltage reference.You will eventually want to investigate transformers and rectifiers. If you are going to built a power supply then this is likely where the input voltage will come from.As a side note, in the real world, low voltage zener diodes (less than 5V, or so) are somewhat dodgy. This probably won't matter for your simulation but I would avoid them if you are going to make a real circuit.

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 18, 2012, 02:24:32 am
content: Quotewhich is what? i see your schematic still using voltage dividerQuoteand the less "real life" information/experience will get burnt in your brain cellltspice and other sims are just another ee version of playstation, unless... you are really, really good at scripting it.Quoteditto! and do you know the answer why? (through your hard life experience)just as you, i've departed earlier (few weeks) ago in hard learning of transistors/mosfets (few of them are dead for the cause), first you need to follow other's advice... use the datasheet. first i read one graph, tinker around, one dead, and then 2 graphs, another one dead, and so on until now, i almost use up all the available graphs in the datasheet to understand properly the transistors/mosfets behaviour, but yet i dont think i'm good enough. i still capable of killing them in one way or another, so... hard learning experience? i still can smell the solder flux lingering in my mind, cant wait for the next solder burning experienceps: and err, not to mention the graphs/spec for an opamp that you want to choose (slew rate, GBW etc), let alone the "choosing" itself!

author: IanB
author_rank: Super Contributor
timestamp: February 18, 2012, 02:57:03 am
content: Quote from: Mechatrommer on February 18, 2012, 02:24:32 amOn this I strongly disagree. Simulation tools like *spice are excellent learning tools, as long as you understand what you are trying to learn.You don't need to script it, you just need to understand the objectives of the circuit you are trying to examine, how you expect that circuit to behave, and where the simulation might have limitations.So for instance if you are looking at voltage regulation you need to examine the output voltage when the input voltage changes, when the load changes, when there is noise (or an AC component) on the input, and so on. To use simulation effectively, just as with real prototypes on the breadboard, you need to examine the effect of changing variables. Simulation doesn't replace building prototypes, but it can certainly help you learn if you use it effectively.

author: IanB
author_rank: Super Contributor
timestamp: February 18, 2012, 03:07:31 am
content: Here's a for-instance of why simulation can be a useful learning tool.I was investigating the use of an integrating op amp to produce a triangle wave from a square wave. I fed in a square wave (green) and got out a triangle wave (blue).Two problems exist: (1) the triangle wave is curvy like a sawtooth; (2) the triangle wave is offset downwards and is not centered around zero.Question for the student: why is this? What changes should be made to produce a good triangle wave centered around zero?I pondered these questions and tried various experiments until I figured it out. That was a learning exercise. I could have done it with real op amps and an oscilloscope, but I might not have learned the same things, and it would certainly have been slower and harder. This way, I can now build a real circuit and check that it behaves the way I expect it to behave.

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 18, 2012, 03:49:57 am
content: i didnt say simulation is useless, what i meant is its a halfway in the total journey. sims do speed up your design and avoid silly/obscure mistakes, but in no way to simulate the real situation of the components you are using in real life, take for example, how do you simulate loading effect of a battery/transformer? as i said, unless you are very good at scripting it, nothing beats real life.ps: playstation does simulate the real life of people fighting/car racing/explosion/blood etc

author: IanB
author_rank: Super Contributor
timestamp: February 18, 2012, 04:07:55 am
content: Simulation isn't very good at telling you how individual components behave; you need a good model for that with parameters fitted to real data. But if you have a library of components with good models, simulation is an excellent tool for examining what circuits made from those components will do.To take your transformer example, here are some measurements I made on a transformer I have. It shows a plot of output voltage vs load current:From this data I can fit a model of my transformer as an ideal AC voltage source of 15.2 V in series with a resistance of 1 ohm. Given that model, I can now use this transformer in circuit simulations to see how it interacts with other components.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 04:11:39 am
content: Quote from: DaveW on February 18, 2012, 12:45:14 amHi Dave,This is a great help, and I understand why it works, I'm taking my input from the wrong place, so the output will be wrong. With the inverting input taken from right on the output, it takes the PN volt-drop into account, and sits at the voltage I choose.I think I understand why the circuit can't adjust from 0-10V with just a 0-10V input too now, I need to take into account a saturation voltage across the CE junction (1.1V for the virtual transistor I'm using at the moment), and I need to supply the opamp negative supply with a few negative volts.Thanks for your help,electronwaster

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 04:24:42 am
content: Quote from: DaveHardy on February 18, 2012, 12:47:23 amMy long-term objectives are pretty lofty for a complete beginner, I want to create a dual power supply (not tracking, both entirely isolated and independent) with voltage control, current control, screens, output down to 0V, moderate current output, basically something like you can buy from Agilent. I am mostly doing it for learning, but also fun, and it would be very handy to have a power supply for future projects of course. The reason I'm starting off with these simplistic and impractical circuits, is that I know next to nothing about electronics, and working on these in the simulator (and in real life as soon as I get something feasible), is that it's making me learn how each component works and why they are there.I thought I knew a little about transistor biasing, I've understand the idea of raising up the operating voltage so that a transistor that's used for amplifying AC (e.g. audio) can reproduce the full AC swing, then taking out that DC bias with a coupling (or is that bypass, or filter, I never remember) cap. Clearly I need to look into that more, but that's great, I didn't realise that is what I should be doing until you pointed it out, so thanks.The reason I am looking into op-amps is they are in all the high quality HP power supplies as voltage followers, I assume they are there for good reason! I get better voltage control in my simple circuits with an opamp in voltage follower mode, compared to an NPN transistor in emitter-follower mode. Should these two techniques be just as good as one another?QuoteI have looked at (and not understood), almost every one of them. I am starting from scratch with a power supply circuit just so that I can understand how the things work! I am understanding more each time I play with the simulation and it's less of a problem if I screw up, and much easier to recover from a screw-up.To be honest, there is too much in that circuit that I cannot understand. I really am a beginner. I am sure that soon enough more of these subcircuits will click and make sense. I am just trying to build on my own supply circuit gradually until it is useful, I may even then switch to some other circuit that I hopefully will understand by then.Thanks,electronwaster

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 04:37:27 am
content: Quote from: TerminalJack505 on February 18, 2012, 12:56:35 amI knew about zener diodes (and I have a value pack of the things), but I am turned off by them because they are all several volts or more and I don't know whether it's possible to use say a 6.8V voltage regulator to output an accurate voltage below 6.8V - I can't think of a way how to do that, so I've kind of abandoned that idea. I guess something with a resistor divider in the feedback loop of an opamp might work. I also guess that supplying the zener with a negative supply might work, but I haven't tried these approaches.QuoteI have a rough idea how they work. Another thing that turned me off them is I'd like variable output from 0V up to the input voltage or as close to it as I can get.QuoteGreat idea, though for now I'm trying to simulate with components I already have (lots of value packs from futurlec, so a fair amount of opamps, transistors and stuff), so I can quickly go from simulation to breadboard.QuoteThis worked a treat, thanks, someone above (Dave?) suggested this too, and it looks obvious to me now, and I fully get why it works. The whole opamp action thing, and adjusting that output until the inputs match.QuoteYes - I am using those two resistors AS a potentiometer. :-) I adjust one to 1Ohm and the other to 10K, and then vice versa and then both to 5K to see what the results are.QuoteYes - I have some idea about RC circuits, I've just been Keeping It Simple for now!QuoteI have a wallwart which is just a 1A or 1.5A 16V AC supply - unrectified, unfiltered etc. so a great chance to get the rectifiers and smoothing caps out and working.QuoteI have a bit of a blind spot about zeners as mentioned above in this post or the previous, I see how they can be used to create a very specific voltage divider because of the almost-fixed volt-drop in reverse mode, but I don't quite understand using that output to produce a lower voltage later in the circuit, i.e. Can a 6.8V zener help me produce a full range 0-15V output?Thanks - some great ideas and info there,electronwaster

author: IanB
author_rank: Super Contributor
timestamp: February 18, 2012, 04:41:29 am
content: Quote from: electronwaster on February 18, 2012, 04:24:42 amOp amps do a much better job as a feedback amplifier than a single transistor. So real power supplies will always contain op amps. However, since transistors are in some ways simpler it can help to start with transistor circuits before moving to op amp circuits.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 04:49:29 am
content: Quote from: Mechatrommer on February 18, 2012, 02:24:32 amYes - I'm still using that, but I'm just saying the circuit as shown (voltage divider, voltage following op-amp, series pass transistor), barely loads down the voltage divider, so it's a SLIGHT upgrade :-), still nowhere near ideal. What I was really saying is that I now fully get why people don't just make a bare voltage divider and take the power from that. At least with a buffer or two to provide the muscle, it's shielded from the load somewhat. Yes - I need a better voltage reference.QuoteReally - I'm just excited to have got LTspice to output some useful stuff, and I'm excited to have a circuit working which is more than an LED and a resistor. A couple of months ago, none of that made sense to me either. I feel like I'm making progress, and the simulation software is just accelerating my learning. I have a fairly well equipped electronics lab (for a complete beginner) downstairs, I just didn't know where to start, now I feel like I have a bit of a foothold, or a jumping off point, or what-have-you.QuoteYes - I understand why, a voltage divider sags and changes as you draw load through it due to Ohms law, The addition of an additional load on one half of the voltage divider changes the resistance and changes the reference - no good!QuoteSome of the things I've read in my new copy of The Art of Electronics [Horowitz and Hill] suggest not getting bogged down in the nitty gritty of maths, precise specs of components (apart from big obvious ones like voltage and current handling), and to design circuits with plenty of flexibility to not rely on specific gain levels or what-not, and to develop an intuition about what will and won't work. I've just been using the simulator for now, so it hasn't mattered yet..QuoteThanks,electronwaster

author: vk6zgo
author_rank: Super Contributor
timestamp: February 18, 2012, 05:37:26 am
content: Well,actually voltage dividers are used widely in Electronics where the current draw from the divider tap is small,compared to that through both legs of the divider.For instance, the voltage division of a divider with 100mA flowing through both resistors with no connection to the tap will not change much if we then connect a load which draws 5mA from the tap.

author: bfritz
author_rank: Regular Contributor
timestamp: February 18, 2012, 06:08:54 am
content: I would say that the way you are going this, you can learn... but is probably not the most efficient route.The way you are going about it, is to run with a concept you know very fast, until it doesn't work for what you want to do, then try to learn how to design your way out of that. It has taken many people many years to discover how to do these things, and you are in effect, reinventing the wheel, because you have square blocks in your toolkit right now.The best way, is to learn the building blocks of modern electronics, without necessarily knowing how to implement them in a real world way. This sounds weird, but this is how almost every college teaches the first EE classes, and it does work. First step is Ohms law, and mesh voltages and currents. Next step is usually capacitors, and simple RC circuit response. Next is inductors, and simple RL circuit response. Next is RLC circuits and their response. If you are confident you know these, then you are ready for more.Next item that is normally taught is a pn juntion, a diode. How does it work, Why does it work? Then go through the equations. Next item is an npn junction, a transistor. How does it work, why? Then go through the equations. If you haven't done this, I know it doesn't seem as fun, but it will get you to your goal more quickly than fumbling without understanding the concepts. For example do you know the various configurations for a transistor amplifier? Can you develop the large and small signal gains for them? If not, study this.Then you are ready for the current mirror, which is the gateway to understanding much of IC design. The Op-Amp is next, as it implements a number of current mirror's that become unbalanced, and hence try to find balance.Once you have studied those things, you will then pick up the schematics, and be able to make sense of the blocks that those circuits are being used in. Circuits will then start to look more like functional blocks that are tacked together, to perform larger functions. This is when the circuits will make sense to you.You will find the simulator is a useful tool to learn the various components and how they are used in a circuit, but bypassing learning the functions of a diode or transistor before moving on to an Op-amp will not give you the kind of deeper understanding that you seem to be looking for.So unfortunately, my suggestion is to drop designing the supply for now, and work on learning diodes, transistors, current mirrors, and then op-amp's. Pick any of the Beginning Circuit Design texts used in colleges, and start reading. Do the exercises. It really is the quickest way to the goal, for the vast majority of people.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 06:58:24 am
content: Maybe I've misrepresented my approach so far?I have read and re-read the chapters on ohms law, resistors, caps, diodes, and transistors and when I reach "active" circuitry is where I find it hard to understand (and so hard to go further) without doing something practical to supplement - hence this power supply experimentation. If there are holes in my knowledge of those previous topics (ohms law, caps, resistors, RC & RL circuits), then they are not going to get filled in by more reading! I'm at the eye-glazing stage that another poster mentioned a few weeks ago (perhaps it could be named the self-tuition brick-wall stage). Both using LTSpice and experimenting with real components on the breadboard has definitely increased my intuitive understanding of some of the basics beyond where the books had got me. And I find myself re-reading those earlier chapters with a tiny bit of experience and they make more sense. I'm not neglecting the theory, I just need something to bolster it, and help it to sink in.I realise I'll be doing a bit of re-inventing and wheelspinning, and it might look backwards or wrong from the outside, but I think it's working, gradually! I think I can sense an avalance effect coming, where some of those basics really click and bigger things become understandable, at least I hope that will happen.

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 18, 2012, 07:40:04 am
content: Quotethat why the purpose of voltage divider is not to draw/drive a load. the "soft way" i learnt in this forum (thanks to it and its members) is you can only tap something out of voltage divider with at least 10 times of the divider's impedance. even if you dont tap anything through it, sagging of the source supply will sag/screw the divider as well. happy learning!Quotemaybe its just me, but it sounded much less fun!i'm unable to figure out whats a current mirror yet. what i understand what you are suggesting is going to Uni route. maybe just me. but i believe some rationale to it. i always though, move back and forth between bench and books... and the sim.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 08:35:42 am
content: I've just been scouring the internet looking for sources of variable zener/opamp based voltage regulators, and found loads of them, but not many are variable, and none that are variable go below the zener reference without a negative supply (which I've also managed to make work in spice).Then I had a thought. Do I need a zener? Sure it might be better for a fixed output regulator, but I'm looking to make an infinitely adjustable one, that works down to 0V. I'll need to control that with a potentiometer as a voltage divider anyway? Surely the best approach is to keep that pot in place, and just make sure it's really well buffered?electronwaster

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 18, 2012, 08:41:45 am
content: you can tap the 5V zener (ic et al) into the voltage divider? and amplify it using an opamp? then you get a stable adjustable voltage reference? but not near the supply rail, once your reference goes near the sagged rail, it will sagged as well, no matter how good the Vref/IC is.

author: vk6zgo
author_rank: Super Contributor
timestamp: February 18, 2012, 09:37:57 am
content: Quote from: electronwaster on February 18, 2012, 06:58:24 amIf you are only doing this to "supplement"your "book-learning",I would suggest that a regulated power supply isn't the best thing to start out with,as it does introduce some fairly complex concepts.In my opinion you are better off to leave the power supply for later,& just play around with simple single transistor amplifiers,& if you must play with Op Amps,just make the most simple applications.It isn't a bad idea to make up a more complex device,using a published design,just to get a feeling for how things are done.Even though the EEs on this forum design things,it is not essential thatyoudo so,sometimes you can learn a lot by studying what others have done.Does your book include worked examples of the maths involved?If so,don't just "read " them,work through them yourself,change the component values & work through them again.It is perilously easy to read through a description,& say,"Yeah,I know that!",& go on to the next.When you are sitting in an exam room things are very different!(This is from hard experience!)How good are you at reading Schematics?Get a lot of practice in finding your way through these ,& you will incidentally learn why designers do some of the things they do .

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 10:08:39 am
content: I am just trying to make a single transistor amplifier, a unity gain amplifier, with an adjustable input?The circuits I'm making I feel comfortable working on (especially in a simulator), and I think I'm learning more messing around like this (at this stage of my learning) than just banging my head against the wall with the textbook. When I find something I don't understand and can't figure out, I will go back to the books or ask for help. I guess earlier I was just asking for the next logical upgrade to the circuit that I already had working, not for the best way to learn.While everyone has been telling me to stop meddling in things I don't understand (that's the feeling I get), I have figured out that the a mosfet with it's zero (or close to it) gate current draw is a great option for following a voltage divider and opamp pair, because it doesn't load the circuitry significantly.(PS Here's my circuit currently. I seem to be getting < 0.0001V ripple on the output when I swing the output current from 0-8A. I realise the mosfet and transformer etc. probably won't handle that current anyway, but it's interesting anyway)electronwaster

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 18, 2012, 11:07:22 am
content: Quote from: electronwaster on February 18, 2012, 10:08:39 amso do you believe it? with one opamp and one mosfet and one voltage divider? not even a zener?

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 11:16:46 am
content: It's probably too good to be true, though the spice models are actual components with flaws and all, not idealised, as far as I am aware. Any advice on where to go from here, other than build it and find out that wayelectronwasterEdit: I still don't know how the zener helps me, as I don't need an independent/absolute voltage reference, just a relative reference that can go all the way down to 0V. Or do I misunderstand something?

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 18, 2012, 11:37:09 am
content: You definitely need a voltage reference to produce a voltage regulator. In fact, your circuit has one already: the constant input voltage.Your circuit is working in the simulator as well as it does simply because the input is an ideal voltage source. This is where simulators will burn you.Put a little bit of ripple on the input and see what happens at the output.

author: Unknown
author_rank: Unknown
timestamp: February 18, 2012, 11:38:06 am
content: The advantage of an (ideal) zener is that it produces a reference voltage independent of input voltage fluctuations. Imagine some ripple on your input voltage. The voltage from your resistive divider would follow this ripple, and so would your output voltage. Your design has essentially zero common mode rejection. Most commercial supplies will tie a variable voltage divider (pot) to a constant(ish) voltage source like an 7805.

author: vk6zgo
author_rank: Super Contributor
timestamp: February 18, 2012, 01:48:22 pm
content: Yes! throw away the constant voltage & constant current symbols----they are great for drawing equivalent circuits of a device or real circuit,but they don't exist in the real world.Your "single stage amplifier with an adjustable input" turns into something quite different when you have to supply those constant voltage sources (V1 & V2) using real components.If you must model things,model real circuits not ones using imaginary components.PS: I'm a bit bemused by your waveforms---where does the 100Hz current waveform come from?I thought this was supposed to be a DC supply!You haven't shown a rectifier circuit,& anyway,if you did, with 0.0001 V of ripple,the current ripple should not be that large.

author: Joshua
author_rank: Regular Contributor
timestamp: February 18, 2012, 04:46:08 pm
content: It's like this.In your model you start with say 10V. You set your 'pot' to the middle position, producing 5V at the wiper. Your op amp does its thing and creates 5V at the output. All is well and the elves are happy.Now let's take this to the real world. You hook up a 10V plug pack and for sake of education it is exactly 10V to start. Your output is still 5V and everyone remains joyful. But now you slightly load the circuit and the supply voltage drops some(Gasp!). Let's say it dropped to 8V. Your pot doesn't give a flyin fla-doodle what it's input is, it just puts out half of the supply. Now, your op-amp thinks you're telling it to put out 4V. It does it's thing and puts out 4v at the output. This is not witnessed in your simulation because your supply voltage model is a ideal voltage source. It sill always put out what you tell it regardless of outside influences.However, if you put a Zener in, say a 5v Zener, that will remain(nearly) constant regardless of the input. Now you ask, 'but I want a 0-15v supply'. Well take the 5v from the zener, and use that as the supply to your pot. Now you have an infinitely adjustable voltage from 0-5v which will remain the same regardless of supply voltage. Again you ask, ' how do I get a 0-15v output?' well take your 0-5v output from your pot and input it into an op amp with a gain of 3. Voila you have a stable 0-15 output. That is forgetting the op amp range, etc...I am also a beginner but that's how I understand what the others are suggesting. Others will have to confirm what I have said for your sake and mine.

author: Unknown
author_rank: Unknown
timestamp: February 18, 2012, 04:58:51 pm
content: Joshua's explanation seems fine to me.To get a more realistic model, try adding for example 0.5 V of 120 Hz AC (to simulate ripple) and add something like 0.1 ohm of series resistance for an 8A supply. Both are options for the LTspice voltage source if I remember correctly, click advanced and choose sine with DC offset of 10V. Now change the load to a current sink pulsating between 100% and 10% load (eg. 8 A and 0.8 A) every millisecond. Under these circumstances feedback and reference voltages will suddenly become important. Now try again to get 0.1 mV ripple.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 09:43:06 pm
content: I did mention earlier on that I wasn't too concerned about line regulation - what happens when I change the input voltage? I already know this because I've taken advantage of it in my tweaking and experimenting, the output voltage changes linearly.Thanks everyone for having this level of patience!I can now clearly see the importance of a zener or 7805 or any other reference to the line regulation now. I didn't get that before.The 100hz waveform, not sure where that's coming from, I assumed it was some kind of response time within the opamp showing itself.Thanks again - I have some more homework!electronwaster

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 18, 2012, 10:13:42 pm
content: and then you are going to need to specify your psu in the end, specify the real circuit, not specify the sim (if you are really serious to use it for your next ee project or want to sell it). here the ripple spec alone (no transient no step respond yet took me a night) for my recently handmade adjustable dual rail psu (somewhat similar to your schema), far from perfect, 2 months wasted developing it (for what?)i would say roughly, with correct usage (low amperage load at +ve rail, careful spec inspection), it should be around 100mV ripple, not even close to your perfectly 0.1mV psu. wrong usage? it can go to "the magnificent 0.5Vpp" ripple and larger.100hz? thats fully rectified 50hz mains, with imperfect limited smoothing capacitance and "nonzero" load. not to mention spikes, noise, opamp stability, and every distress frequencies in the imperfect spectral universe.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 18, 2012, 11:32:09 pm
content: Looks like you've put a lot of work into that!Here's my latest effort. It's basically a dual regulator now, one to provide a zener-regulated fixed output, and then another to add a variable output on top of that. It works quite well, I have the input voltage swinging from 16-18V or something crazy, and 0.1 Ohm parasitic resistance. The output is very ripple-free, but does change up or down 100mV when the load goes from < 1mA to 5A, for example.I've had to go back to the resistor as a load device because the simulation was stalling - or taking an extremely long time.If anyone can point out glaring errors, I'd be grateful! I don't think the 2 mosfets and the large-ish drop from input to output is ideal, but not sure how to get around that at the moment.Thanks,electronwaster

author: electrode
author_rank: Regular Contributor
timestamp: February 19, 2012, 01:19:31 am
content: Is there any reason you didn't just add gain to your first non-inverting amp (see attached)? Basically, right now you have a voltage follower, which is a non-inverting amp with gain of 1. It retains the high-impedance input of the op-amp.Edit: Should mention that this isn't complete. If for example you wanted 0-24V and your zener was 6V, you'd set R1 and R2 to a gain of 4, and use a pot as a voltage divider on the input of the op-amp from your zener. 0-6 in and 0-24 out.

author: vk6zgo
author_rank: Super Contributor
timestamp: February 19, 2012, 02:20:36 am
content: Quote from: Mechatrommer on February 18, 2012, 10:13:42 pmYeah,I know, but he didn't specify any 100hz "hum" component in his model,& the current seems to be all AC.Perhaps I can't read "pretend" Oscilloscopes!PS:- I went back to have a look,& he is supplying the load with 8A p-p of 100Hz sine wave current offset by + 4A.Funny rectifier,funny filter!

author: electronwaster
author_rank: Regular Contributor
timestamp: February 19, 2012, 05:17:31 am
content: I'm not sure what you're saying with "funny rectifier, funny filter". I guess you're saying I should have one of each, well the rectifier is unnecessary, as it's a 8A sine wave offset by 4A, which is a varying DC load ranging from 0-8A. How would a rectifier help this situation?And could you explain how I would use a filter on this varying load, I understood that having a circuit that can provide a steady voltage to a varying load was a good idea, hence this simulation.electronwaster

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 19, 2012, 05:59:44 am
content: Quote from: electronwaster on February 19, 2012, 05:17:31 ammains is 50hz sine wave, when fully rectified, it become doubled 100hz, but not a nice sine anymore just like what you had feed to your circuit, thats why he refered to funny filter, it will take another tremendous effort to produce a clean 100hz sine out of rectified mains. maybe a good read up for you... lmgtfy... the magnificent and "no better than in internet"... the wiki!http://en.wikipedia.org/wiki/Rectifierhttp://www.play-hookey.com/ac_theory/ps_rectifiers.htmli figured that out the hard way long time ago... on the bench, with real solder and oscilloscopeedit ps: and the wiki you read (if you care to read) is still a perfect theory, albeit closer to real life. what you get in real life is not what you expect such as in the wiki. there will be more questions coming.

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 19, 2012, 06:06:04 am
content: Quoteno! no! no! not double! its just simply a waste! how many do we have to tell ya? do it on real circuit man!

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 19, 2012, 06:20:53 am
content: here. if you really need a spoonfeed (1st picture), ok go sim it! and if you have free time, please also sim for me my circuit (2nd picture), i never have time to do it. please check for me if i got the transistor calculation correctps: dont take the value in the 1st picture seriously, i only quick cad it for you. choose the value as it suits you.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 19, 2012, 06:25:44 am
content: Thanks for your insights Mechatrommer, but I realise how a rectifier works and have done since school-age.I'm asking what the expression "Funny rectifier, funny filter" meant. (I also know what a filter is).Thanks also for your suggestion to design a power supply on a real circuit - but is that really the most efficient way? I'm finding that I'm able to try ideas out more quickly, and I'm making sure that I don't rely on spice as a crutch, and I realise that there are things (components, circuits) that can't be modelled perfectly.electronwaster

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 19, 2012, 06:27:12 am
content: and oh. its a high side switching, you should use p-channel if its mosfet! (npn if its bjt) not n-mosfet. i already too familiar with n channel mosfetyou also need to google opamp basic configuration (follower with gain config). that i will leave to you, thats it.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 19, 2012, 06:31:56 am
content: Just before my latest revision, I had a zener feeding a voltage divider, opamp and power mosfet, but the load regulation was better with two sets of opamps and mosfets. If you like, I'll draw it out again and show you the graphs.electronwaster

author: vk6zgo
author_rank: Super Contributor
timestamp: February 19, 2012, 07:47:55 am
content: Quote from: electronwaster on February 19, 2012, 06:25:44 amOK! I see where you are coming from!You want to vary the current drawn by the load ,to see what affect it will have on the regulated voltage.Normally,you would do this at a lower frequency,maybe 4-5 Hz,so we know the waveform is showing a varying load current.The modelling software doesn't know any better,so it will let you vary the load at 100Hz,which is a very unfortunate choice,as it appears to an outsider to be something to do with a rectified mains supply.This is what confused me,because I knew you did not model it as a rectified mains supply.

author: electronwaster
author_rank: Regular Contributor
timestamp: February 19, 2012, 08:29:58 pm
content: Well - thanks for the hint about not using two opamps/transistors etc., I think my design is getting more reasonable as time goes on.I have a wildly variable input voltage, which is being settled down to a steady 12V by a zener diode and resistor divider. This is fed into a potentiometer/voltage divider to give me some output between 0V and 12V, which is fed to an opamp that is used as a voltage follower, adding very little load to the voltage divider (without that opamp, the divider gets loaded down, and all regulation is out the window). The output of this opamp is fed to the gate of an n-channel mosfet transistor which is set up in source-follower (common-drain) mode (http://en.wikipedia.org/wiki/Common_drain) to provide the muscle. There is a volt or so lost between the gate and source of the mosfet, but that is no issue because the feedback for the opamp comes from the output of the mosfet and through opamp action it balances its two inputs. The result is a pretty stable voltage regardless of line variation (the source for this circuit is a DC voltage with a small AC component, so it's swinging through 15-17V positive, as a test. It's also pretty reliable on the output under varying load, I can switch out the load resistor between 3 Ohm (4A), and 3Meg (4uA) and the voltage only sways by 20mV at full output (0.1% regulation)Any other upgrades possible whilst keeping this as simple as possible?I think the next stage (unless I/we come up with any changes) is to breadboard this and see where the sim failed to take real life into accountthanks all,electronwaster

author: electronwaster
author_rank: Regular Contributor
timestamp: February 21, 2012, 10:23:42 am
content: Well - I had a 16V 1.5A AC adapter (AC output), which I built a rectifier and filter for, and I breadboarded this circuit. I have tried with an NPN BJT (TIP41C) and an N-Channel MOSFET (P16NF06), and although the circuit works fine with both, I have a minimum output voltage of 1.9V. I'm not sure where in the circuit this is coming from. When I measure the voltage with respect to ground at the inverting, non-inverting and output pins of the opamp, I get 1.9V, 0V and 4V for the FET, and 1.9V, 0V and 2.2V for the BJT. Does anyone have any clue?ThankselectronwasterEdit:I tried an LM358P (dual opamp), and that problem went away, so I guess the 741 isn't so good, or maybe it was a dud.I applied a .65A load at 15V (I didn't have a 12V zener, so I used a 6.2 + 9.1 for 15.3V regulation), and the output dropped by a whole 200mV, so the load regulation is terrible compared to the simulation - this is where you all say "told ya so!". I didn't expect such a simple circuit to have any really great properties, but I'm excited to have a variable power supply that can go down to 0V with no negative supply :-)

author: Christe4nM
author_rank: Unknown
timestamp: February 21, 2012, 11:46:51 am
content: Since I’m trying to understand linear power supplies too, I’m hooking on to this thread with a question that’s bothering me for quite a while now, and the answer may benefit electronwaster too.If I understand correctly: when the output voltage is (slightly) changed due to a change in load resistance, you want the internal resistance of the series regulator (the FET in this case) to compensate for that. In the case of a slightly raised output voltage you want the internal resistance of the FET to be slightly raised too, so the output current will be slightly lowered, and the output voltage will be lowered to the desired value.Now it seems to me that the opamp in this voltage regulated design (and in professional designs too for that matter) is configured as a comparator. So when there’s a slight difference in measured output voltage to reference voltage it will either supply the FET with its positive or negative rail voltage. Doesn’t that just turn the series regulator into a switch? I’d thought that the opamp would be configured as a differential amplifier (with negative feedback) in order to only amplify the difference between non-inverting and inverting inputs a bit. And so only slightly change the internal resistance of the series regulator. My best guess is that it ís actually configured as a differential amplifier, so what am I missing here? Can anyone please explain?@electronwaster: if you want good reading material on diodes, transistors, FETs, opamps etc. be sure to check out the book “Electronic Devices (conventional current flow) 9th edition” by Thomas L. Floyd. It’s well written and easy to understand (for me at least), and currently laying open next to me.

author: electrode
author_rank: Regular Contributor
timestamp: February 21, 2012, 12:05:40 pm
content: Quote from: Christe4nM on February 21, 2012, 11:46:51 amWhich picture(s) are you referring to? As far as I can see, they all have negative feedback loops.

author: ejeffrey
author_rank: Super Contributor
timestamp: February 21, 2012, 12:51:50 pm
content: Quote from: Christe4nM on February 21, 2012, 11:46:51 amNope, it is just that the regulator circuit is inside the feedback loop. This is not the most common way to use an opamp, normally you would use passives for feedback, but there is certainly nothing wrong with doing it this way. You do have to be careful to ensure stability. The active devices in your feedback loop can have very large phase shifts and cause problems. For fast circuits like a regulator this can usually be solved by adding a small capacitor from the output to the inverting input. This local feedback will provide enough phase lead to keep the system stable. Often you will be able to just guess the value (start with 100 pF). For slower systems like heaters and motors you will probably want to make a more careful feedback network like a PID controller to give the opamp more predictable gain.

author: Christe4nM
author_rank: Unknown
timestamp: February 21, 2012, 04:21:22 pm
content: Quote from: electrode on February 21, 2012, 12:05:40 pmThe picture "single mosfet reg.PNG" from post #42. Thanks to ejeffry I now see the same feedback loops as you doQuote from: ejeffrey on February 21, 2012, 12:51:50 pmThanks that clarifies a lot. So it ís indeed a differential amplifier, which by adjusting the regulator also adjusts its own feedback.QuoteI see that now. When the regulator regulates the output faster than the differential amplifier can react to the changes it might oscillate on it's own regulating action. Thanks a lot. It really helps understanding these regulator circuits. I'm going to play with it a bit and see if I can understand that "active device in the feedback"-kind of circuit better.P.S. @electronwaster: for an introduction on voltage regulator circuits you could readthis .pdf filestarting at page 207. Hope it helps.

author: Mechatrommer
author_rank: Super Contributor
timestamp: February 21, 2012, 04:52:55 pm
content: Quote from: electronwaster on February 21, 2012, 10:23:42 am741 isnt good enough? have you figured out whats the tip41 hFe? have you figured out how much those opamps capable of supplying current? have you figured out how much the pass element will request/suck current from its driver (opamp)? the mosfet full-on gate voltage, active/linear region bla bla bla?Quote from: electronwaster on February 21, 2012, 10:23:42 amtold ya so!. if you havent figured out the "great properties" yet, rewind back to reply #4, the last 2 paragraphs, i wont repeat it here.Quote from: electronwaster on February 21, 2012, 10:23:42 amyou are getting there... with solder and fumes/smokesand probably another 2 months or sojust watch out for the heat(sink) if you dont want to make a new order.