EveryCircuit
Contact
Reviews
Home
jason9
modified 5 years ago

Accidental sine wave oscillator

6
23
272
03:57:26
Shake to start if it doesn’t auto-start. I accidentally made a triangle wave oscillator with a very similar circuit, so I decided to swap out the BJTs with MOSFETs and remove the power supply resistor to see what happens. As a result, I accidentally made a sine-wave oscillator with a THD (total harmonic distortion) of only 2.35%*! Of course, results may vary IRL, but in the sim this makes for a great sine-wave oscillator with a remarkably pure output considering the lack of filtering. *Originally measured 0.74% but forgot to take into account the attenuation of the measured distortion from the measuring setup so I re-measured and adjusted for the attenuation which gave me 2.35%.
published 5 years ago
fatcat2
5 years ago
Uh-oh, seems that an LC notch made up of a 39.57858736uF cap, a 100 ohm resistor and a 1mH inductor is malfunctioning in EC. Sorry to ask but what values did you choose here?
jason9
5 years ago
I think I chose either 10Ω or 100Ω with 10mH and 3.95μF with a slowed down sim (increased the disconnected 800Hz source to something like 8kHz or so to force the time-step smaller, this works better than decreasing the sim speed the usual way). I also connected it using a buffer op-amp so as not to disturb the oscillator.
jason9
5 years ago
I think I must’ve used 10Ω because that better matches the results I got. Re-measuring and this time adjusting for attenuation of the second harmonic (first being the fundamental) I get a measured THD of 2.35%. Of course this amplifies the third and fourth and so on harmonics, so this gives a slightly conservative estimate.
fatcat2
5 years ago
The attenuation on the fundamental and the first 4 harmonics are 3.95m, 0.948, 0.983, 0.991 and 0.995 respectively. The pk to pk voltage of the filtered output (harmonics) is 10mV but idk how to get the RMS of the individual harmonics. Then what should I do?
JoeHH
5 years ago
Genial...
jason9
5 years ago
I just measure the peak to peak of all the harmonics combined and the peak to peak of the original signal and compare those. So, if the sum of the harmonics gives a peak to peak of 10mV and the original signal has a peak to peak of 1V then I would say it has a THD of 1%.
fatcat2
5 years ago
Here, THD={10mV*(0.948*0.983*0.991*0.995)^(-1)/0.59}=1.84%. I know that this result is misleading but I didn't get any other results. However, we cannot directly compensate for the attenuation caused cuz I'm not taking the RMS of the harmonics. Obviously, this isn't the actual THD.
jason9
5 years ago
Where’d you get those values?
fatcat2
5 years ago
I measured it with an RLC notch with the values you used. The attenuation was calculated using the transfer function.
selman
5 years ago
3 (infact odd number of) inverters connected back to back, with a delay in each will obviously oscillate. The trick is not in the capacitor it is in the inverters the capacitors only increase that stage delay...
selman
5 years ago
http://everycircuit.com/circuit/6648610132066304
jason9
5 years ago
@selman I understand why it oscillates. The point of the circuit isn’t that it oscillates, but that it oscillates with a near-perfect sine-wave.
jason9
5 years ago
@fatcat2 why are you multiplying together the attenuations of the various harmonics? That’s literally just summing the decibels each harmonic is attenuated by and using that value which is greater than the attenuation of any single harmonic. If the first is attenuated by -1dB, the second -250mdB, and the third -62.5mdB, then that equation is saying everything is attenuated by -1.3125dB. How is that supposed to make any sense?
fatcat2
5 years ago
What did you do to compensate for the attenuation caused? I know that simply adding the attenuation (in dB) won't work cuz I'm not taking the aquare root of the sum of the squares of the individual attenuation times the harmonic pk voltage. That doesn't make sense but what other way was open for me? Care to explain what you did for the attenuation compensation and THD calculation?
selman
5 years ago
Weird, all other harmonics seem to cancel out, except that frequency, when you add all outputs from the 3 stages...
jason9
5 years ago
@fatcat2 I just assumed the entire signal was attenuated as if the entire signal was just the first harmonic. So I just divided the peak to peak voltage by 0.948 (assuming that’s the attenuation of the first harmonic) and then used that peak to peak. You shouldn’t need to worry about RMS as for a given waveform the ratio of peak to peak to RMS is constant. Since not all parts of the waveform are attenuated as much as the first harmonic I‘m slightly over-adjusting for attenuation which isn’t a problem since it simply gives a slightly conservative estimate for the actual THD. If you combine (multiply) all the attenuations of the harmonics you get an even bigger attenuation giving an estimate with a greater error towards the conservative side (larger estimated THD than actual THD). Dunno how you ended up getting a lower THD of 1.84% instead of 2.35% though. Perhaps our measurements differed? Who knows.
jason9
5 years ago
@selman yeah, that is odd. When you combine this highly distorted waveform with itself phase shifted 120 and 240 degrees you get a much purer waveform. That does seem weird.
fatcat2
5 years ago
Sorry to trouble you with an unrelated thread but I got an amp circuit from bugger. It uses a weird config. :- http://everycircuit.com/circuit/6464688654123008 The right uppermost transistor is the problem. Moreover, I am not able to calculate the gain.
jason9
5 years ago
It looks like an ordinary differential amplifier. It’s essentially a discrete OP-amp. It has very high open loop gain, so we can assume that both inputs are equal at all times as long as the amp isn’t clipping.
jason9
5 years ago
The positive feedback side is connected to the audio source through a 3.3kΩ to 84.3kΩ voltage divider. This reduces the audio to about 96% voltage.
jason9
5 years ago
The negative feedback is a bit more complex due to the resistor connection to the audio source. I’ll have to work out the math behind it.
jason9
5 years ago
Using the property of the amp that both inputs are always at exactly the same voltage, ohm’s law (how to find one of voltage, current, and resistance given the other two), current basics (the current flowing into a wire equals the current flowing out of a wire), and a bunch of math I was able to derive the formula ((m - 1)/R1 + m/R2)*R3 + m for this particular configuration where m is 0.96 (how much of the input voltage is left after going through the 3.3kΩ/84.3kΩ voltage divider), R1 is 2.2kΩ, R2 is 14.1kΩ, and R3 is 100kΩ. This gives a gain of 6.075V/V which when multiplied by the 330mV input gives an output voltage of 2.005 which matches up with EC’s simulations. I can explain how I derived my formula if you want. There’s no fancy math; the most complicated part is factoring out terms in a fraction (e.g.: (x*y + x*z)/w = x*(y + z)/w).
fatcat2
5 years ago
I have a SIMILAR model:- http://everycircuit.com/circuit/5032194157051904 (you will understand the reason why I have stressed on the word 'similar' if you read the description of the above mentioned thread).

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2026 by MuseMaze, Inc.     Terms of use     Privacy policy