It's hard to build an oscillator
78 points
4 hours ago
| 16 comments
| lcamtuf.substack.com
| HN
ErroneousBosh
2 hours ago
[-]
> There’s an old electronics joke that if you want to build an oscillator, you should try building an amplifier

It's funny, I was just thinking this morning about an old article in (I think) Television magazine that I read in the 80s when I was getting into electronics. The author was talking about some service notes he'd received for a particular model of Philips radio, which had just come out, and it was when shops tended to have their own service department that would repair things right there in the shop - and also, apply any "factory fixes".

One such fix was described as "Fix VIUPS", and involved changing a couple of resistors and adding a couple of capacitors. Not really any difference, but the author did think it seemed to make the amp a bit more stable and less inclined to make squealy ploppy noises at high volume when the battery was low. But, curiosity got the better of him, so he rang the Philips rep - what's this "VIUPS"?

No idea. But I'll get hold of someone at head office you can ring. Okay, what's this "VIUPS" thing? No idea, said the head office guy, but I can put you in touch with one of the factory engineers in Eindhoven.

So, a call came in, an international call! Quite a big deal in the 80s. "What's this VIUPS Fix thing in the service notes?" he asked the guy.

"Aha yes", he said in a heavy Dutch accent, "the VIUPS is the noise the set makes when the fault is present."

VIUPS VIUPS VIUPS. Yup.

reply
Zardoz84
21 minutes ago
[-]
> There’s an old electronics joke that if you want to build an oscillator, you should try building an amplifier

The most easy way to annoy a neighbor using AM radios, it's using a regenerative AM receptor with too high gain. Could oscillate and begin to emit noise at the same freq that are you tuning. Adding a simple carbon microphone to it, and setting the gain to the max, was a very easy way of building a AM radio emitter.

reply
dvh
3 hours ago
[-]
It's super easy to build LC oscillator.

I made a program that generate random topology and uses spice simulation to find if it oscillate. The goal was to find some novel LC oscillators. It worked, it found many different oscillators. I let it ran for a while and soon I found out that the simplest possible LC oscillator has 1 inductor, 2 capacitors, 1 resistor and 1 transistor. I found many different variations of it, I called this class of oscillators "LCCRT oscillator" and it also always had 2 internal nodes so that's not very large search space (40000 combinations) so I generated all possible combinations and I found out there are exactly 12 distinct LCCRT topologies.

Basically any time cap connects to a rail it can be placed to other rail as well, and any time one rail connects via resistor, the resistor can also be moved to other rail. This creates 12 possible combinations. I tested them in real life and they are stable, even used one in metal detector.

Of course it found many different topologies. Some times they were unique, other times they could be simplified into already found oscillator. It can also use multiple transistors not just one. You can find entire project on github, it is a ngspicejs script: https://github.com/dvhx/lc-oscillator-finder

reply
seg_lolr
2 hours ago
[-]
"Novel". Those are all Collpits LC oscillator variants, circa 1918. All LC oscillator topologies were thoroughly investigated more than a century ago, hundreds of books have been written about them. A little more humility please
reply
ofalkaed
10 minutes ago
[-]
Passive circuits have been novel for a long time now, or at least very very quaint. It is hard to put much stock in a coil when it is banal to walk around with 100 billion transistors in your pocket.

One of my favorite books is Tremaine's Passive Audio Network Design, seems appropriate right now. Passive circuit design is great fun and a lost art.

reply
amelius
3 hours ago
[-]
Nice! Perhaps you could sort them based on Q-factor.
reply
webdevver
2 hours ago
[-]
this is always the risk of posting on hackernews: a random commentator absolutely iq mogs the op.
reply
ofalkaed
2 hours ago
[-]
When I was starting out in electronics I found the easiest way to build an oscillator was to build an amplifier and the easiest way to build an amplifier was to build an oscillator. I guess the trick is to be 7 years old and have far more ambition than skill. Couldn't guess at how many tries it took me to make an amplifier that didn't oscillate and when I moved onto oscillators, they never oscillated but they did amplify. In that first year or so, I couldn't actually read resistor color codes, but I thought I could.
reply
fallous
33 minutes ago
[-]
If you combine a 3 year-old, whose favorite word is "why?", and the ambition of a 7 year-old you might just end up with the most productive genius possible.
reply
seg_lol
2 hours ago
[-]
> the trick is to be 7 years old and have far more ambition than skill

Never lose this

reply
hollerith
2 hours ago
[-]
Apologies for my bluntness, but in my humble opinion, American society would be better if it had fewer adults like this.
reply
ofalkaed
2 hours ago
[-]
Being able to enjoy and find worth in the process regardless of the outcome is bad? Are we man-children if we don't treat everything as if it were as serious as cancer? I'm not really sure what you are trying to say.
reply
jacquesm
41 minutes ago
[-]
Yes, but then again, we could make a very similar comment about Hackernews.
reply
immibis
2 hours ago
[-]
Ambition develops skill. One of the problems with American society is people thinking they have skill when they don't. If people knew they had ambition and no skill, they'd try things and learn.
reply
taneq
58 minutes ago
[-]
I think the scenario of childlike wonder and limitless ambition is a little different to the scenario of embraced ignorance and wilful misrepresentation of any surviving facts in furtherance of the agenda du jour.
reply
fragmede
1 hour ago
[-]
that's a helluva thing to just drop. What are your priors? Are you American yourself, or living in or near it? In what way would it be better? How so?
reply
taneq
1 hour ago
[-]
Often the biggest thing holding you back from doing something is the sensible, mature understanding that it’s impossible.
reply
kurthr
3 hours ago
[-]
Building an oscillator is "just" putting some gain around a large enough phase delay (>90deg). The challenge is in making the oscillator predictable and STABLE.

You want a frequency generator that oscillates with a constant period/frequency. Even an unbalanced oscillator can just be divided by two to provide uniformity. However, it turns out that building something that is not sensitive to any outside inputs (temperature, strain, voltage, time, etc) is really hard to do over a very wide frequency range (from ~DC to many MHz), but from that you can build a stable clock.

Look up Allan Variance, if you're looking for bit of a rabbit hole on clocks and oscillators and other sensors.

reply
ErroneousBosh
1 hour ago
[-]
Two things not mentioned - hey maybe I should blog about these myself and post them up?

The first being the "Two Transistor Metronome" that I can't even remember where I saw first - possibly Electronics Today International or Hobby Electronics, although Practical Electronics was a contender - we didn't get that one much though. I remember my dad and I building this when I was probably about seven or eight, and I've built loads since.

https://tinyurl.com/22qjecj7

It's a relaxation oscillator where the two transistors form more-or-less an SCR, which fires when its (negative-going) gate voltage exceeds its anode voltage. Kind of.

A similar circuit using three transistors and a diode is used in the oscillators in the Roland TB303 and Korg MS10/20/50 series, with a current source used to set the capacitor charging time so you get a nice linear sawtooth. Conveniently the expo converter turns an incoming control voltage into an exponentially-rising current, which is just what you need!

reply
lm2s
2 hours ago
[-]
For anyone interested in this kind of stuff with a music oriented gist, a while ago I found this awesome YouTube channel: https://www.youtube.com/@MoritzKlein0/
reply
Mizza
3 hours ago
[-]
Never found it hard to build an oscillator, the hard part is musical voltage per octave. 3340 repro chips are the way to go, the best non-3340 circuit I've seen is this one and it's still temperature-sensitive: https://www.youtube.com/watch?v=FiCMjt0mqvI
reply
ofalkaed
2 hours ago
[-]
Temperature sensitivity only matters in polysynths where you don't have easy access to per-oscillator tuning. It is not difficult to build an oscillator with better pitch stability than a guitar, even my VCOs with no temperature compensation require less tuning than any guitar I have owned.
reply
Mizza
2 hours ago
[-]
But that's for synths where the oscillators are ICs. I'm talking about simple oscillators from basic components
reply
ofalkaed
2 hours ago
[-]
My VCOs which lack temperature compensation are oscillators built from basic components. The closest I have to oscillator on an IC these days, are the VCOs in my Moog Prodigy which use a quad OPAmp and a 3086 transistor array, it is far more stable than any guitar string.
reply
reactordev
2 hours ago
[-]
As someone with a CS degree and not an EE degree, this is fascinating. I tried a decade ago to build some simple RC lights controller circuit that would operate off of a PWM signal and failed. Hats off to you hardware folks. Manipulating atoms and electrons and building circuits that allow us to play games, build businesses, communicate with loved ones, and write this post.
reply
eternauta3k
4 hours ago
[-]
I was hoping this would go more into startup and amplitude control, which are for me the tricky parts of building a phase shift oscillator (because you have to analyze the non-linear behavior).

I guess hobbyists nowadays are just using SI5351 and calling it a day.

reply
Joel_Mckay
2 hours ago
[-]
Most use GPSDO references for equipment, as they are inexpensive. Even miniature TCXO tend to still offer quite good value these days. =3
reply
a5c11
2 hours ago
[-]
One of my favorite is an RC circuit with a Schmitt triggered inverter. So simple and ingenious.
reply
fjfaase
1 hour ago
[-]
I remember creating an oscilator by soldering a transistor onto an inductor with two windings in series with loudspeaker an battery.
reply
IsTom
2 hours ago
[-]
I wish Esaki oscillator was mentioned. It's a funny bit of trickery.
reply
Zardoz84
25 minutes ago
[-]
> The circuit can be simplified to two transistors at the expense of readability, but if you need an analog oscillator with a lower component count, an operational amplifier is your best bet.

Well... Using a NOT (really a NAND) gate was a very classic way of generate clocks for discrete logic.

reply
atoav
4 hours ago
[-]
Coincidentally I thought a class of art students just yesterday how to build oscillators. And it is not hard at all. Take a logic inverter IC (CD40106 Schmitt-Trigger Hexinverter) pick a single gate, connect the output to the input, add a capacitor from the input to ground. That is it. Three parts and you got a Relaxation Oscillator. And then you have 5 inverter gates left.. But of course one could argue ICs are cheating, since any PLL-IC would have an oscillator onboard.

Why the first two circuits fail is also pretty obvious without derper circuit analysis: to get reliable oscillation you don't only need amplification, you also need some time setting element, usually in the form of a capacitor (or involuntary capacitance).

reply
eternauta3k
4 hours ago
[-]
Relaxation oscillators are easy, good phase shift oscillators are an art.
reply
ZyanWu
1 hour ago
[-]
What intrigued me was the "just use a microcontroller" comment at the bottom of the page - I genuinely don't know if it was pinned because it's a joke, a genius idea or just top 10 dumbest comments of 2025
reply
temp0826
1 hour ago
[-]
As the famous one-liner from EE goes- if you want to build an oscillator, build an amplifier; if you want to build an amplifier, build an oscillator.
reply