Author Topic: Understanding transistors and opamps  (Read 15486 times)

0 Members and 1 Guest are viewing this topic.

alm

  • Guest
Re: Understanding transistors and opamps
« Reply #25 on: February 18, 2012, 11:38:06 am »
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.
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 5758
  • Country: au
Re: Understanding transistors and opamps
« Reply #26 on: February 18, 2012, 01:48:22 pm »
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.
« Last Edit: February 18, 2012, 02:03:20 pm by vk6zgo »
 

Offline Joshua

  • Regular Contributor
  • *
  • Posts: 194
  • Country: us
Understanding transistors and opamps
« Reply #27 on: February 18, 2012, 04:46:08 pm »
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.
« Last Edit: February 18, 2012, 04:47:55 pm by Joshua »
 

alm

  • Guest
Re: Understanding transistors and opamps
« Reply #28 on: February 18, 2012, 04:58:51 pm »
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 ;).
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #29 on: February 18, 2012, 09:43:06 pm »
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
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10339
  • Country: my
  • reassessing directives...
Re: Understanding transistors and opamps
« Reply #30 on: February 18, 2012, 10:13:42 pm »
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?) :P

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.
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #31 on: February 18, 2012, 11:32:09 pm »
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
 

Offline electrode

  • Regular Contributor
  • *
  • Posts: 141
  • Country: au
Re: Understanding transistors and opamps
« Reply #32 on: February 19, 2012, 01:19:31 am »
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.
« Last Edit: February 19, 2012, 01:24:42 am by electrode »
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 5758
  • Country: au
Re: Understanding transistors and opamps
« Reply #33 on: February 19, 2012, 02:20:36 am »
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.
Yeah,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! ;D
« Last Edit: February 19, 2012, 03:24:04 am by vk6zgo »
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #34 on: February 19, 2012, 05:17:31 am »
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
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10339
  • Country: my
  • reassessing directives...
Re: Understanding transistors and opamps
« Reply #35 on: February 19, 2012, 05:59:44 am »
I'm not sure what you're saying with "funny rectifier, funny filter"
mains 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/Rectifier
http://www.play-hookey.com/ac_theory/ps_rectifiers.html

i figured that out the hard way long time ago... on the bench, with real solder and oscilloscope ;)
edit 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. ;)
« Last Edit: February 19, 2012, 06:06:57 am by Mechatrommer »
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10339
  • Country: my
  • reassessing directives...
Re: Understanding transistors and opamps
« Reply #36 on: February 19, 2012, 06:06:04 am »
Quote
Double-regulator-with-zener.PNG (16.34 kB, 803x392 - viewed 19 times.)
no! no! no! not double! its just simply a waste! how many do we have to tell ya? do it on real circuit man!
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10339
  • Country: my
  • reassessing directives...
Re: Understanding transistors and opamps
« Reply #37 on: February 19, 2012, 06:20:53 am »
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 correct ;)
ps: dont take the value in the 1st picture seriously, i only quick cad it for you. choose the value as it suits you.
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #38 on: February 19, 2012, 06:25:44 am »
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
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10339
  • Country: my
  • reassessing directives...
Re: Understanding transistors and opamps
« Reply #39 on: February 19, 2012, 06:27:12 am »
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 mosfet :P
you also need to google opamp basic configuration (follower with gain config). that i will leave to you, thats it.
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #40 on: February 19, 2012, 06:31:56 am »
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
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 5758
  • Country: au
Re: Understanding transistors and opamps
« Reply #41 on: February 19, 2012, 07:47:55 am »
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





OK! I see where you are coming from! ;D
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.
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #42 on: February 19, 2012, 08:29:58 pm »
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 account  ;)

thanks all,
electronwaster
« Last Edit: February 19, 2012, 08:34:48 pm by electronwaster »
 

Offline electronwaster

  • Regular Contributor
  • *
  • Posts: 60
  • Country: au
Re: Understanding transistors and opamps
« Reply #43 on: February 21, 2012, 10:23:42 am »
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?

Thanks
electronwaster

Edit:

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 :-)
« Last Edit: February 21, 2012, 10:51:50 am by electronwaster »
 

Offline Christe4nM

  • Supporter
  • ****
  • Posts: 245
  • Country: nl
Re: Understanding transistors and opamps
« Reply #44 on: February 21, 2012, 11:46:51 am »
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.
 

Offline electrode

  • Regular Contributor
  • *
  • Posts: 141
  • Country: au
Re: Understanding transistors and opamps
« Reply #45 on: February 21, 2012, 12:05:40 pm »
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.

Which picture(s) are you referring to? As far as I can see, they all have negative feedback loops.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 2363
  • Country: us
Re: Understanding transistors and opamps
« Reply #46 on: February 21, 2012, 12:51:50 pm »
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.

Nope, 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.
 

Offline Christe4nM

  • Supporter
  • ****
  • Posts: 245
  • Country: nl
Re: Understanding transistors and opamps
« Reply #47 on: February 21, 2012, 04:21:22 pm »
Which picture(s) are you referring to? As far as I can see, they all have negative feedback loops.
The picture "single mosfet reg.PNG" from post #42. Thanks to ejeffry I now see the same feedback loops as you do  ;)

Nope, 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.
Thanks that clarifies a lot. So it ís indeed a differential amplifier, which by adjusting the regulator also adjusts its own feedback.

Quote
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. 
I 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 read this .pdf file starting at page 207. Hope it helps.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 10339
  • Country: my
  • reassessing directives...
Re: Understanding transistors and opamps
« Reply #48 on: February 21, 2012, 04:52:55 pm »
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? ... 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.
741 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?

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
told 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.

but I'm excited to have a variable power supply that can go down to 0V with no negative supply :-)
you are getting there... with solder and fumes/smokes ;) and probably another 2 months or so :P just watch out for the heat(sink) if you dont want to make a new order.
It's extremely difficult to start life.. one features of nature.. physical laws are mathematical theory of great beauty... You may wonder Why? our knowledge shows that nature is so constructed. We simply have to accept it. One could describe the situation by saying that... (Paul Dirac)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf