Why my BJT common emitter circuit didn't work as expected?

Status
Not open for further replies.

crutschow

Joined Mar 14, 2008
38,563
+
I don't know why you have a problem with this.
It's obvious.
Your explanation does not make sense.
I already explained how to explain why you need a lower frequency SETTING for the filter. It's because if the fundamental gets attenuated, you lose part of the original signal and that is what causes the distortion.
I now what you already explained.
Still doesn't hold water.
If you use a HP filter with a corner well below the fundamental, it has negligible attenuation of the fundamental, yet the square-wave is still significantly distorted.
You explanation for that does not make sense.
The filter is just a filter, it has nothing to do with the frequency components of the signal going in.
Okay mister obvious.
But a filter certainly affects the frequencies going out.
The test for audio I was talking about used this concept so as to provide a quick, rough idea about how the audio amplifier was behaving. If it cut some of the lower frequencies of a perfect square wave input then the output would be distorted just as you show in your plots (very nice BTW). That gives you a very quick idea what is going on, but that is what is going on inside the audio amplifier so it's a test of the amplifier.
Specifically a test of the amps frequency response.
The square wave will never contain frequencies below the fundamental though that is probably why it is referred to as the "fundamental".
It's called the fundamental because that's the Fourier component with the highest value.
But you certainly need response below the fundamental if you are to pass the square-wave without significant distortion.
You keep dancing around that (seems like arm waving to me) with any good explanation as to why that is needed.

Ball's in your court. :p
 

Thread Starter

bstdms

Joined Jun 14, 2023
22
Since you just want maximum gain to operate as a comparator and give a nice, square-wave output, eliminate RE and bias the base to about 0.5V (just below cutoff) with an R2 value of about 10kΩ.
(Calculating the value of R1 is left as an exercise for the reader).
Add a 100Ω resistor in series with the base (after the bias network) to increase the low base impedance.

The droop in the square-wave is due to the input capacitor being too small.
Using the fundamental frequency to calculate the capacitor value required is for a sinewave, not a square-wave.
A square-wave has much lower frequency components than its fundamental frequency, so you need to design for a frequency about 1/10th or less of the fundamental, depending upon how much droop you can tolerate.
A square-wave typically has significant Fourier frequency components from 1/10th to ten times the fundamental frequency.

You can calculate the droop by using the formula for the RC exponential voltage change versus time.

Below is my simulation result for a circuit with those modifications for a 50Ω source.

View attachment 306648
Thank you for the suggestion, the revised circuit works perfectly!
I would also like to ask if there are any switching circuits that have a faster response compared to this BJT circuit.

Siyao
 

BobTPH

Joined Jun 5, 2013
11,566
If you use a HP filter with a corner well below the fundamental, it has negligible attenuation of the fundamental, yet the square-wave is still significantly distorted.
You explanation for that does not make sense.
Very interesting discussion @crutschow and @MrAl. I found it very puzzling.

I have to agree with MrAl that there are no lower than fundamental frequencies in a square wave.
And I have to agree with MrChips that the wave is highly distorted even though the amplitude of the frequencies is barely affected by the filter.

What you are both missing is that the filter alters two things for each harmonic: the amplitude and the phase.

At the -3db point, the phase of the fundamental is shifted by 45°, whereas the phase of higher harmonics is barely shifted at all. This is what causes the massive distortion of a wave that is even 10 times the cutoff frequency of the filter as you can easily see in a simulation (I did that, and that is how I realized the phase shift was in play).

The highly distorted waveform well above cutoff frequency will have amplitudes that are not affected all that much, but the phases are totally out of whack and that is why you no longer get a square wave.
 

crutschow

Joined Mar 14, 2008
38,563
The effect of only phase-shift on the square-wave can be clearly seen if the square-wave is run through an all-pass filter, which has a flat amplitude response, but from 180° to 0° phase-shift as the frequency goes from below the corner frequency to above. (below):

1699467111724.png

1699469083208.png
 
Last edited:

MrAl

Joined Jun 17, 2014
13,724
+
It's obvious.
Your explanation does not make sense.
I now what you already explained.
Still doesn't hold water.
If you use a HP filter with a corner well below the fundamental, it has negligible attenuation of the fundamental, yet the square-wave is still significantly distorted.
You explanation for that does not make sense.
Okay mister obvious.
But a filter certainly affects the frequencies going out.
Specifically a test of the amps frequency response.
It's called the fundamental because that's the Fourier component with the highest value.
But you certainly need response below the fundamental if you are to pass the square-wave without significant distortion.
You keep dancing around that (seems like arm waving to me) with any good explanation as to why that is needed.

Ball's in your court. :p
Hello again,

A more succinct explanation is that the fundamental gets "filtered" and that may or may not include a phase shift in addition to the amplitude change.
The FUNDAMENTAL is what changes the most, that's why it's distorted. How hard is that to understand? The fundamental is changed in both amplitude and phase, and even a small change in phase will cause some distortion. What we are seeing may only be a 10 degree phase shift, but it's enough to cause distortion.
The phase shift plays with the trailing edge while the attenuation plays more in the middle of the half cycle.
The key point is the fundamental changes, but there are still no added frequencies below that.

So what if you need to design a high pass filter with a lower cutoff to pass the square wave? Referring to the original argument, that does not add harmonics to the input signal, and that is why I replied, and we already knew that we needed to set the FILTER spec to meet the application, which is true of any design.

Thanks to Bob for making the phase shift effect more clear.
 

MrAl

Joined Jun 17, 2014
13,724
The effect of only phase-shift on the square-wave can be clearly seen if the square-wave is run through an all-pass filter, which has a flat amplitude response, but from 180° to 0° phase-shift as the frequency goes from below the corner frequency to above. (below):

View attachment 307050

View attachment 307051
Hi,

If you want to you can do an analysis of the high pass filter and just run the fundamental through it while leaving the other harmonics alone. The effect is almost the same as running them all through it, which shows the change in the fundamental is the most important change and that causes the distortion.
 

BobTPH

Joined Jun 5, 2013
11,566
Hi,

If you want to you can do an analysis of the high pass filter and just run the fundamental through it while leaving the other harmonics alone. The effect is almost the same as running them all through it, which shows the change in the fundamental is the most important change and that causes the distortion.
If you run a sine wave through an RC high pass filter, you get a sine wave out. There is NO distortion. The distortion of the square waves is because different harmonics are shifted by different amounts. They no line up to make a square wave.
 

crutschow

Joined Mar 14, 2008
38,563
The FUNDAMENTAL is what changes the most, that's why it's distorted. How hard is that to understand?
It's not hard to understand, so please stop being condescending.
But it's apparent that it's the phase-shift of the fundamental, not any amplitude change that causes the distortion.
That's the part you never previously mentioned, or apparently understood in your long explanations.
 
Last edited:

MrAl

Joined Jun 17, 2014
13,724
It's not hard to understand, so please stop being condescending.
But it's apparent that it's the phase-shift of the fundamental, not any amplitude change that causes the distortion.
That's the part you never previously mentioned, or apparently understood in your long explanations.
Hello again,

You seem to have some of the facts but not all of the facts. How it is being condescending when you did not understand that the fundamental is the lowest frequency encountered? That's not my fault. I just tried to explain what was happening. If you understand it already that's great.

But the fact is that it is not JUST the phase shift it is BOTH the phase shift AND the amplitude that changes. See I already said that and yet you still came back and specified that it was the phase shift not the amplitude, and you keep asking me to show this and that, and i am trying to do that but i am also dealing with some sort of flu or something after eating at Outback this past weekend, so it's taking me more time to deal with the different questions. Luckily i think i am getting over it now but i thought that a few days ago too.

Anyway, you asked me to show where the distortion came from and i tried to, and that was because you said that you could not understand where it came from. I tried to show that because you asked, and you asked because it didnt seem like it was what i was saying or something. I was willing to show more.

Now, you are saying that it is just the phase shift NOT the amplitude, so can you show that to be true now?
I could save you some time by telling you that it is both the phase and the amplitude, but you won't believe it, so it's the ball in your court now to show that it is just the phase and nothing to do with the amplitude :)

If you think I am being condescending then just let me know I'll correct it, it's as easy as that. You could also tell me in a PM I'll even change the wording or just remove it altogether, no problem. It's always my goal to keep the discussions civil and respectful. To that end also, don't forget the past when I acknowledged and appreciated your contributions to the forum and I will continue to do so in the future.
 

MrAl

Joined Jun 17, 2014
13,724
If you run a sine wave through an RC high pass filter, you get a sine wave out. There is NO distortion. The distortion of the square waves is because different harmonics are shifted by different amounts. They no line up to make a square wave.
Hello again Bob and thanks for the reply.

It's not your fault, and it's not my fault, but this was not the intended interpretation of why I suggested running the fundamental through a RC high pass filter.
The intent was to show that it is MOSTLY the change in the fundamental that causes the distortion. It's the change in phase and amplitude. That means that if you pass it through an RC HP filter, the phase and amplitude change and then WHEN MIXED with the other harmonics, the distortion appears even though the other harmonics where not passed through the HP filter (only the fundamental).
So it is not about just running the fundamental through the HP filter, it's about that but also adding that output to the other harmonics. The end result is almost the same distortion that you get from running all of them through the HP filter. That shows that the fundamental change is the most significant, and so we can concentrate on the changes in the fundamental in order to get a good idea what is going on.

My conclusions were:
1. The changes in the fundamental are the most significant factor in causing the distortion we have seen in the various square wave output plots.
2. The phase and the amplitude changes in the fundamental are the causes of the distortion (it was you who zeroed in on the phase part).
 

BobTPH

Joined Jun 5, 2013
11,566
Nope, here is what you said:

If you want to you can do an analysis of the high pass filter and just run the fundamental through it while leaving the other harmonics alone. The effect is almost the same as running them all through it
I simulated just that. Here is just the fundamental of my square wave (in other words a sine wave) run through the same RC filter that I used in post #26. It does not look to me like " The effect is almost the same as running them all through it ". As I said before, there is no distortion just a reduction in amplitude and change in phase, which you can see on the graph.

1699647227440.png
 

crutschow

Joined Mar 14, 2008
38,563
How it is being condescending when you did not understand that the fundamental is the lowest frequency encountered?
I do understand that, but your explanation didn't show why a response below the fundamental of a square-wave is needed to prevent distortion of the square-wave, which has no frequency components below the fundamental.

Condescending is when you imply that it's simple and that I am not smart enough to understand ("How hard is that to understand?").
Now, you are saying that it is just the phase shift NOT the amplitude, so can you show that to be true now?
I could save you some time by telling you that it is both the phase and the amplitude, but you won't believe it, so it's the ball in your court now to show that it is just the phase and nothing to do with the amplitude
You can tell me all you want but that doesn't necessarily make it true (saying you could save me some time but I won't believe what you think is true, implying I'm too dense, is also condescending. Perhaps you should look up the meaning of that word).
It is due mainly to the filter phase-shift (although amplitude change will also certainly have an effect, but it's not necessary).

You apparently did not read my post #25.

Ball back to you.
 
Last edited:

MrAl

Joined Jun 17, 2014
13,724
Nope, here is what you said:


I simulated just that. Here is just the fundamental of my square wave (in other words a sine wave) run through the same RC filter that I used in post #26. It does not look to me like " The effect is almost the same as running them all through it ". As I said before, there is no distortion just a reduction in amplitude and change in phase, which you can see on the graph.

View attachment 307199
Hi Bob,

Apparently I did not make it clear enough yet.

To see the effects of something alone we often try to transform things so that the variable in question runs along one of the axis like 'x' or 'y', and does not mix with the other variables too much. That way we can vary that one variable and see the effect that one variable has on the total outcome, to some degree. Sometimes the change has to be kept small, but it still gives us insight as to what that one variable is causing overall.

In this case, the variable is the fundamental amplitude and phase, or more simply, the instantaneous amplitude of the fundamental. That does not exclude the other variables though, it's just that we don't have to consider them when we just want to know what the fundamental itself is causing and in this case with the square wave.
In order to keep it a square wave though we must keep the other frequencies also. The only one we change however is the fundamental, either in phase, amplitude, or both. I will illustrate this.
Another way of looking at it is instead of adding all the harmonics to the fundamental and running that through a HP filter, we run the fundamental through a HP filter and not the other harmonics, and then we add them. This shows what happens when the fundamental is changed due to the effects of the RC filter, and since the other harmonics are not going through the filter but are later added as before, we see a wave that gives us a better understanding of what happens when the fundamental is changed, both in phase and in amplitude, because we then have a way to vary that parameter alone while seeing what happens to the square wave.

I'll illustrate this in my next post.
 

MrAl

Joined Jun 17, 2014
13,724
I do understand that, but your explanation didn't show why a response below the fundamental of a square-wave is needed to prevent distortion of the square-wave, which has no frequency components below the fundamental.

Condescending is when you imply that it's simple and that I am not smart enough to understand ("How hard is that to understand?").
You can tell me all you want but that doesn't necessarily make it true (saying you could save me some time but I won't believe what you think is true, implying I'm too dense, is also condescending. Perhaps you should look up the meaning of that word).
It is due mainly to the filter phase-shift (although amplitude change will also certainly have an effect, but it's not necessary).

You apparently did not read my post #25.

Ball back to you.
Hi,

Ok :)

I understand what you are saying about the condescending thing and it was not meant to be taken like that, it was just that I was sort of shocked at your response. It's no big deal though so I retract that.
If any of this sounds condescending it is not on purpose as I am just trying to state facts and keep the discussion respectful.

No it's not that you are too dense, it is simply that you do not believe someone that has worked in the industry for years on design projects and in particular, converters that had to deal with harmonics on an every day basis. You simply do not like to believe what you are hearing. It's not about being dumb.
I am still not sure though what you think would constitute proof, but I will try to show this here.
I guess I have to assume that you have never seen this illustrated and so I will try to do that now.

My main argument is if the fundamental is attenuated (or phase shifted) with a given RC HP filter with a set point w1=1/RC, then it stands to reason that if we lower the set point frequency then the 3db down point moves lower in frequency and thus the fundamental is affected less. That's why we get a better response. It's the fault of the filter alone.

A few fundamentals...
First, the way we have analyzed the 'distortion' of the square wave has been in the time domain. The time domain is convenient then as we only have to deal with instantaneous amplitudes and how much they add together algebraically.

The attachment shows 5 waves, a half cycle of the square wave made up of a limited number of harmonics so we can see how this works a little better. The harmonics are limited to the 3rd, 5th, and 7th, which are added in the right proportions to the 1st (fundamental) to get a square wave.
It's a little interesting that I wrote that sentence like that and not on purpose I mentioned the "proportions" which is really what this is all about.
Anyway, the plots are as follows:
The black is the resulting square wave without being run through any filter.
The blue wave is the 1st (fundamental) without being run through any filter.
The green wave is the 1st (blue wave) but shifted in phase only by a small amount.
The red wave is the 1st but decreased in amplitude but not phase.
The violet wave is the 1st decreased in amplitude AND shifted slightly in phase the same amount as the green wave.
The two orange vertical lines are sectioning off a slice of time near the last peak of the square wave. This is the analysis section. We look at this area to see what happens because we know that the distorted square wave decreases in amplitude in that area at the very least.

Looking at the blue wave and the black inside the slice, we can see that the blue wave instantaneous amplitude must have contributed a lot to the peak of the black wave inside that slice. Since the waves are added, if we increase the amplitude of the blue wave in that slice we will necessarily see the black wave increase at that peak, and if we decrease the amplitude of the blue wave in the slice we will necessarily see the black wave decrease at the peak, which is the distortion we have seen in the past. It is also true that if we decrease the amplitude over the full half cycle we will also see other changes which results in more distortion.
This, in itself, tells us that the amplitude has a lot to do with the change in that last peak at the very least.
However, if we change the phase of the blue wave (to get the green wave) we also see the instantaneous amplitude change within that slice, and so the peak of the black wave changes due to phase we well. If we shift it to the left (green) we see a decrease in amplitude, and if we shift it to the right we see an increase in amplitude. The decrease is also what contributes to the distortion we have seen with the square wave test.

Now looking at the red wave in that slice, we see the amplitude has decreased from the blue wave. That would reduce the peak of the black wave within the slice as well. If we look at the violet wave in that slice we see that also decrease with reference to the blue wave, and thus the peak of the black wave within the slice would also decrease.

This shows that we see a decrease in the last peak of the black wave (square wave) regardless what we do: decrease the amplitude, shift the phase to the left, or both.

The last question is why do we have to go to a lower cutoff point to get more of the square wave to pass through without as much distortion. The answer is because when we set the filter specification to a 3db down frequency that is lower than before, the FUNDAMENTAL is changed less, and that is both in amplitude and in phase. Changing it less means we can go back over the above multi-colored plots and see less change in instantaneous amplitude and thus the addition adds up to a higher value, closer to that without any filter.

So the main answer is that the fundamental is changed less when we reduce the filter frequency cutoff specification.

I hope this helps, but if this does not satisfy you then you will have to elaborate a little more.
 

Attachments

crutschow

Joined Mar 14, 2008
38,563
I hope this helps
Yes, I have always understand what you have said.

My problem with your previous posts, was that it did not satisfactorily show (at least to me) why you needed a HP passband so far below the square-wave fundamental to pass the square-wave without distortion since, even with a passband below 1/10 of the fundamental where the fundamental frequency is only slight attenuated, there was still large distortion of the square-wave.

My continuing quibble with your explanation is, it would appear the filter's phase-shift for HP filters with a corner below the fundamental has the most effect on the square-wave shape, and the amplitude change has only a smaller second-order effect, as Figures 6 and 8 in post #38, and my post #25 would seem to show.
Do you not agree with that?
 
Last edited:

MrChips

Joined Oct 2, 2009
34,920
High Pass Filter
1699721661028.png
Cross-over frequency fc = 1/(2πRC)
R = 3.18kΩ
C = 1μF
2πRC = 20ms
fc = 50Hz
half cycle = 10ms

Let us examine this from an RC time-constant perspective.
Time Constant τ = RC =3.18ms

If we wanted to see very little droop in the flat portion of the square wave, we would have to set the cross-over frequency two orders of magnitude lower, i.e. time constant = RC = 318ms, or fc = 0.5Hz.


Single pole filter phase response.jpg

Reference: https://www.analog.com/media/en/ana...ticles/phase-response-in-active-filters-2.pdf

Therefore, yes, the phase shift of the fundamental has a significant effect on the droop in the square wave.


1699722385586.png
 
Status
Not open for further replies.
Top