Crystal Oscillator Question (Transistor Based Amp)

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

[email protected] wrote:I think we're running into some confusion about the term 'impedance'.

Just to benchmark that, impedance is the generalized form of resistance. It includes resistance per se (converting electrical energy to heat) and reactance (temporarily storing electrical energy in an electrical or magnetic field). All forms of impedance give voltage something to push against as it tries to make charge carriers move.

A resistor has no reactive properties, so its impedance is the same as its ordinary resistance.

The sketch above says any current that reaches the output has to travel through Rc, so the impedance looking back into the amplifier will be Rc.
I don't think that terminology is the issue here. I may be confused as all get-out, but I understand what impedance is. :lol:
Based on your diagram alone, yes... I agree that the impedance is Rc.

Let me try asking my question in a different manner....

The formula for gain for my transistor-based amplifier is approximately G = - Rc / Re. Re in my test circuit is a fixed 100 ohms. The operating frequency of my test circuit is "fixed" at about 1MHz.

If I increase the value of Rc, my gain should increase until I hit rail voltage. I would therefore expect see something very close to a square wave -- but as you reminded me a few posts ago, the RLC portion of my test circuit filters out the harmonics, so I get a sine wave.

Question: The "sweet spot" in my circuit occurs at about Rc=3k. If I continue to increase the value of Rc, I observe that the amplitude of this sine wave starts to decrease. Why doesn't the amplitude of the sine wave max out and just stay there? It is not something that I would have predicted given the formula for gain.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

mauifan wrote:Question: The "sweet spot" in my circuit occurs at about Rc=3k. If I continue to increase the value of Rc, I observe that the amplitude of this sine wave starts to decrease. Why doesn't the amplitude of the sine wave max out and just stay there? It is not something that I would have predicted given the formula for gain.
This is where the capacitor comes into play.

Increasing Rc increases the gain, but it also increases the amp's output impedance. Less current flows through Rc to the capacitor, so the voltage fluctuation across the capacitor gets smaller.

Let's pretend the relationships are linear for a minute and run the math:

We'll start with a base circuit where Rc is some fixed-but-I-don't-care-exactly-what resistance. For that Rc, the gain will be A. Applying a sine wave of amplitude h to the input will produce a sine wave of amplitude Ah at the output (assuming a high imput impedance for the next stage). Driving a capacitor with the amp's output will put a significant load on the amp, so the amplitude of the sine wave at the top of the cap will be B.

Now let's make an almost identical circuit, but replace Rc with a resistor twice as big. That will double the gain (to 2A), but will only charge the load capacitor half as fast. The amplitude of the sine wave at the top of the cap will now be B/2.

Now let's stick a second, identical amplifier onto each circuit so it takes input from the cap (this is an analysis trick called 'unrolling' an oscillator).

For the first circuit, we have a signal of amplitude B at the top of the cap, and that feeds into a second amplifier of gain A. If we put a high-impedance load on the second amp, the output would have an amplitude of AB.

For the second circuit, we have an input half as big (amplitude B/2) passing through an amplifier with twice the gain (2A), and the 2s cancel. The output from the second amp would still have an amplitude of AB, assuming a high-impedance load.

Increasing Rc gives you more gain in the amp, but it also gives you more attenuation at the cap. If the relationship was truly linear, they'd always cancel each other out. In practice, the relationship between gain and attenuation isn't linear, and you end up losing more to attenuation than you get back in gain.

I tried sketching that out, but all the node labels and voltage equations made an unreadable mess.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

mauifan wrote:Question: The "sweet spot" in my circuit occurs at about Rc=3k. If I continue to increase the value of Rc, I observe that the amplitude of this sine wave starts to decrease. Why doesn't the amplitude of the sine wave max out and just stay there? It is not something that I would have predicted given the formula for gain.
This is where the capacitor comes into play.

Increasing Rc increases the gain, but it also increases the amp's output impedance. Less current flows through Rc to the capacitor, so the voltage fluctuation across the capacitor gets smaller.

Let's pretend the relationships are linear for a minute and run the math:

We'll start with a base circuit where Rc is some fixed-but-I-don't-care-exactly-what resistance. For that Rc, the gain will be A. Applying a sine wave of amplitude h to the input will produce a sine wave of amplitude Ah at the output (assuming we give the amp a high-impedance load). Driving a capacitor with the amp's output will put a significant load on the amp, so the amplitude of the sine wave at the top of the cap will be B.

Now let's make an almost identical circuit, but replace Rc with a resistor twice as big. That will double the gain (to 2A), but will only charge the load capacitor half as fast. The amplitude of the sine wave at the top of the cap will now be B/2.

Now let's stick a second, identical amplifier onto each circuit so it takes input from the cap (this is an analysis trick called 'unrolling' an oscillator).

For the first circuit, we have a signal of amplitude B at the top of the cap, and that feeds into a second amplifier of gain A. If we put a high-impedance load on the second amp, the output would have an amplitude of AB.

For the second circuit, we have an input half as big (amplitude B/2) passing through an amplifier with twice the gain (2A), and the 2s cancel. The output from the second amp would still have an amplitude of AB, assuming a high-impedance load.

Increasing Rc gives you more gain in the amp, but it also gives you more attenuation at the cap. If the relationship was truly linear, they'd always cancel each other out. In practice, the relationship between gain and attenuation isn't linear, and you end up losing more to attenuation than you get back in gain.

I tried sketching that out, but all the node labels and voltage equations made an unreadable mess.

User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

[email protected] wrote:This is where the capacitor comes into play.
This statement confuses me a bit (which capacitor are you talking about?), but I am not sure that it matters. I think I may see the error in my ways.
[email protected] wrote:Increasing Rc increases the gain, but it also increases the amp's output impedance. Less current flows through Rc to the capacitor, so the voltage fluctuation across the capacitor gets smaller.

Let's pretend the relationships are linear for a minute and run the math:

We'll start with a base circuit where Rc is some fixed-but-I-don't-care-exactly-what resistance. For that Rc, the gain will be A. Applying a sine wave of amplitude h to the input will produce a sine wave of amplitude Ah at the output (assuming we give the amp a high-impedance load). Driving a capacitor with the amp's output will put a significant load on the amp, so the amplitude of the sine wave at the top of the cap will be B.

Now let's make an almost identical circuit, but replace Rc with a resistor twice as big. That will double the gain (to 2A), but will only charge the load capacitor half as fast. The amplitude of the sine wave at the top of the cap will now be B/2.

Now let's stick a second, identical amplifier onto each circuit so it takes input from the cap (this is an analysis trick called 'unrolling' an oscillator).

For the first circuit, we have a signal of amplitude B at the top of the cap, and that feeds into a second amplifier of gain A. If we put a high-impedance load on the second amp, the output would have an amplitude of AB.

For the second circuit, we have an input half as big (amplitude B/2) passing through an amplifier with twice the gain (2A), and the 2s cancel. The output from the second amp would still have an amplitude of AB, assuming a high-impedance load.

Increasing Rc gives you more gain in the amp, but it also gives you more attenuation at the cap. If the relationship was truly linear, they'd always cancel each other out. In practice, the relationship between gain and attenuation isn't linear, and you end up losing more to attenuation than you get back in gain.

I tried sketching that out, but all the node labels and voltage equations made an unreadable mess.
Correct me if I go astray, but I was thinking along the lines of "increased gain means increased current." While that is technically true. I think I failed to realize that the increased current was through the transistor. If the lion's share of current is going through the transistor, there is less current available to go to the next stage as Rc continues to increase. So if the next component is an inductor or a capacitor, the amp's output impedance would be affected by Rc.

Haven't done the math... but I guess I can see how Rc would "overwhelm" the amp's output at some point.

So... I guess the next question is: How do I know where the "sweet spot" is located? Am I correct to assume that it becomes an impedance matching problem, i.e. transistor impedance Rc needs to match the impedance of the tank circuit (which in turn is approximately equal to the wire resistance of the coil -- or ESR in the case of a crystal)?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

amuifan wrote:which capacitor are you talking about?
The combination of C2, C3, and C.breadboard in the schematic you posted at the top of page 4. More generally, the capacitor in your tank circuit.
mauifan wrote:Correct me if I go astray, but I was thinking along the lines of "increased gain means increased current."
This one's a common stumbling block. Increased current gain means increased current (and tautologies are tautological), but increased voltage gain doesn't give us enough information to make meaningful statements about the current.

Let's say we have a CE transistor amp with Rc=1k and Vcc=5v. We've arranged the bias network to put the quiescent output voltage at 2.5v, and twiddled the base resistor so 10mV of swing at the input gives us 1V of swing at the output.

Working those numbers backwards, we can see that the voltage gain is d.Rout/d.Rin = 100. The quiescent current is (Vcc-Vq/Rc) = 2.5mA, and the change in collector current for a 10mV swing at the input is d.Rout/Rc = 1mA. So.. assuming our input stays within a +/-10mV band, our output voltage will range between 1.5v and 3.5v, and the collector current will rage between 1.5mA and 3.5mA.

Now let's replace Rc with a 100 ohm resistor. Everything else stays the same, so our quiescent current is still 2.5mA and the collector current still ranges between 1.5mA and 3.5mA. That current only produces 1/10th as much voltage across the new Rc though. The quiescent output voltage is now 0.25v below VCC (4.75v) and our +/-10mV input produces +/-100mV of output swing (4.65v to 4.85v). The voltage gain has dropped to 10 even though the current through the transistor hasn't changed at all.

Generally speaking, you change a transistor amp's voltage gain by changing Rc, and change its current gain by changing Rb. The exact combination of voltage and current you want at the output guides your design calculations.

mauifan wrote:So... I guess the next question is: How do I know where the "sweet spot" is located? Am I correct to assume that it becomes an impedance matching problem, i.e. transistor impedance Rc needs to match the impedance of the tank circuit (which in turn is approximately equal to the wire resistance of the coil -- or ESR in the case of a crystal)?
It goes back to the filter equations.

The Thevenin equivalent circuit I drew WRT output impedance actually comes in handy in this context. You can reduce "transistor amp driving an inductor" to the kind of "input signal driving an RL filter" stuff you see in example problems.

User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

[email protected] wrote:
mauifan wrote:So... I guess the next question is: How do I know where the "sweet spot" is located? Am I correct to assume that it becomes an impedance matching problem, i.e. transistor impedance Rc needs to match the impedance of the tank circuit (which in turn is approximately equal to the wire resistance of the coil -- or ESR in the case of a crystal)?
It goes back to the filter equations.

The Thevenin equivalent circuit I drew WRT output impedance actually comes in handy in this context. You can reduce "transistor amp driving an inductor" to the kind of "input signal driving an RL filter" stuff you see in example problems.
Which... again... boils down to a question of maximum power transfer... which occurs when the impedance of the filter matches the impedance of the Thevenin equivalent amplifier... correct?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

Not really.. maximum power transfer does occur when the impedances match, but maximum power transfer is a 'least bad of both worlds' thing.

Voltage provides the force that makes current move, so there's always a tradeoff between the two. For a given amount of energy, more current means less voltage, and more voltage means less current. Maximum current transfer occurs where the voltage is zero, and maximum voltage appears where the current is zero. Impedance is the factor that controls the relative amounts of energy that appear as current and voltage, so low impedance gives you high current and low voltage, high impedance gives you low current and high voltage.

Neither pure voltage nor pure current do any work, so to get the most possible work from a given amount of energy, you need as much voltage and current as you can get at the same time. That's where impedance matching matters.. when you need to do work: driving motors, speakers, or things like that.

An oscillator is a "signal" circuit instead of a "work" circuit. You're free to sacrifice current to get voltage or vice versa. In this case we want as much voltage as we can get, so we want the impedance in shunt with the load to be as large as possible.

That occurs at the resonant frequency of the LC tank.

User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

Thanks for responding Mike... but think I am now more confused than ever. Your last post says that I can sacrifice current to maximize voltage (which is kinda what I originally thought), but your Mar 25 post mentions that there is a point when there isn't enough current to charge the capacitor in the LC tank, which explains why I saw a decrease in signal gain as the value of Rc increased above a certain point.

:?: :? :? :?:

For what it is worth, I don't see how this could be anything other than an impedance matching concern on the grounds that I [think I] want a circuit that maximizes voltage and current at the same time. As previously mention, my test circuit works when I set the gain to the "sweet spot" -- but it stops working if I set the gain too high.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

Yeah, the trouble with an extended technical conversation is that it's hard to keep the goalposts in one place. ;-)

In this case, it's a question of which end of the inductor we're talking about.

My comment about sacrificing current for gain was in context of impedance matching and power transfer. In this circuit, you can maximize voltage swing at the transistor's collector (the left end of the inductor) by hitting a frequency where the LC tank's impedance is high. In that state, very little current will flow through the inductor to the capacitor, so the voltage swing at the top of the capacitor (the right end of the inductor) will be small.

I think I know where you're getting confused, but my explanations just seem to churn up more dust, so I'm going to switch tactics and approach the subject Socratically: I'll make a couple of statements, then start asking questions that will guide you in the direction I think will be useful.

So: you've said that you see this as an issue of maximizing current and voltage. I assume you mean 'current flowing through the inductor into the capacitor' and 'maximum voltage swing at the top of the capacitor'.

Why does the magnitude of voltage swing at the top of the capacitor matter?

User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

[email protected] wrote:Yeah, the trouble with an extended technical conversation is that it's hard to keep the goalposts in one place. ;-)

In this case, it's a question of which end of the inductor we're talking about.
I think it might be helpful to repost my test circuit. This is the same diagram I posted on 02/26/13.
My "Original" LC Test Circuit
My "Original" LC Test Circuit
LC-oscillator-success-circuit.jpg (29.66 KiB) Viewed 1319 times
I have been playing with this circuit on and off for the last month or so, so I thought it would be helpful to take a few "snapshot" measurements:

R1 and R2 is actually a pot positioned such that R1=9k, R2=1k (approximately).
Re = 100 ohms (no change)
Rc = 24k (approximately, this is also a pot)
C2, C3 are not really in the circuit as physical components. The inherent capacitance of the breadboard seems sufficient.

These settings give me a roughly 2V peak-to-peak sine wave at about 1.15MHz. Adjusting the value of Rc up or down decreases the amplitude. (I am talking about adjustments more significant than a light tap on the pot.)
[email protected] wrote:My comment about sacrificing current for gain was in context of impedance matching and power transfer. In this circuit, you can maximize voltage swing at the transistor's collector (the left end of the inductor) by hitting a frequency where the LC tank's impedance is high. In that state, very little current will flow through the inductor to the capacitor, so the voltage swing at the top of the capacitor (the right end of the inductor) will be small.

I think I know where you're getting confused, but my explanations just seem to churn up more dust, so I'm going to switch tactics and approach the subject Socratically: I'll make a couple of statements, then start asking questions that will guide you in the direction I think will be useful.
Again... make no mistake... I appreciate the help. It just seems like the target I am shooting at keeps moving. It could very well be that I am not asking the clear, concise questions, but... well... let's just say that I think the answer to my question about whether or not this was a maximum power transfer problem appears to be "YES!" :D
(I assume that you are referring to the point on my diagram labeled OUT.)
[email protected] wrote:So: you've said that you see this as an issue of maximizing current and voltage. I assume you mean 'current flowing through the inductor into the capacitor' and 'maximum voltage swing at the top of the capacitor'.
I don't think that is the mental picture I quite had in mind -- I was actually thinking about power transfer at the transistor's collector (impedance = Rc) into the LC circuit -- but I think the answer your question is YES.
[email protected] wrote:Why does the magnitude of voltage swing at the top of the capacitor matter?
Again to answer your question, the voltage between the inductor and capacitor is what feeds back into the transistor's input. It needs to be in phase (or at least pretty darn close) with the input for the circuit to oscillate -- and in fact, the inductor/capacitor combo is what shifts the phase about 180 degrees (well... not quite... but certainly close enough).

For what it is worth, there is method to my madness -- or is that madness to my method? :D Specifically, a crystal is supposed to act like an inductor, correct? If that is the case, I am thinking that I should be able to simply replace the inductor with the crystal -- but experimentally, this is proving not to be the case... and I am not sure why. (Don't answer this just yet.... let's get nail down the inductor version first before tackling the crystal.)

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

Okay, let's assume we have an oscillator that's running happily and is in equlibrium.. the gain through the transistor is A, the voltage swing at the node marked OUT is h, the voltage swing at the transitor's collector is Ah, and the current flowing through the inductor is exactly the right amount to reduce a swing of Ah at the transistor's collector to a swing of h at the node marked OUT.

Now let's increase the gain through the transitor slightly without changing anything else about the circuit.

What will happen?

User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

[email protected] wrote:Okay, let's assume we have an oscillator that's running happily and is in equlibrium.. the gain through the transistor is A, the voltage swing at the node marked OUT is h, the voltage swing at the transitor's collector is Ah, and the current flowing through the inductor is exactly the right amount to reduce a swing of Ah at the transistor's collector to a swing of h at the node marked OUT.

Now let's increase the gain through the transitor slightly without changing anything else about the circuit.

What will happen?
Well... the ideal current through the inductor L1 would be I ("eye").
The voltage drop through the inductor L1 would be (Ah - h).
The impedance of the inductor L1 would be j * w * L (where "w" is 2*pi*f).

Increasing the gain would mean a slightly higher voltage drop through the inductor. It would also mean a slightly higher current through the inductor since the inductor's impedance is constant for a fixed frequency.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

Good enough, now what effect will that increase in current have on the voltage at the top of the cap?

User avatar
mauifan
 
Posts: 174
Joined: Sun Aug 12, 2012 11:13 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by mauifan »

[email protected] wrote:Good enough, now what effect will that increase in current have on the voltage at the top of the cap?
Well... the voltage at the top of cap C2 is the same as the voltage at OUT... which by your definition is h... which is really a function of time h(t)....

Current through a cap is a function of the cap's capacitance and rate of voltage change. Since the frequency and cap size are constants, a slight increase in current probably means that the voltage (amplitude) of the signal went up a proportionate amount.

Note: h(t) is inverted relative to the transistor's collector.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Crystal Oscillator Question (Transistor Based Amp)

Post by adafruit_support_mike »

Right again, but let me restate what you've said to emphasize a point:

The output (the voltage swing at the top of the cap) will be slightly larger than the original input (the signal h that we fed into the transistor).

Extrapolate the effects of that happening in a feedback loop.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”