It's hard to build an oscillator

6 hours ago (lcamtuf.substack.com)

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

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

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

  • "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

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

  • this is always the risk of posting on hackernews: a random commentator absolutely iq mogs the op.

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.

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

  • Often the biggest thing holding you back from doing something is the sensible, mature understanding that it’s impossible.

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.

Easy negative resistance oscillator: a neon bulb in parallel with a capacitor connected to a DC power supply through a resistor.

I've build a signal injector to debug a guitar pedal that was not working. It was a nice little journey in itself. The astable multivibrator produces so much harmonics that I could hear it all the way back from the input jack, where it was supposed to be silent. Heck, I could hear it just by putting the probe nearly close to the circuit. The signal pushed through the circuit like Juggernaut breaking walls. Learned a lot about filters and was able to produce a nice sine wave out of it, it worked great.

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!

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

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

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.

  • Most use GPSDO references for equipment, as they are inexpensive. Even miniature TCXO tend to still offer quite good value these days. =3

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.

One of my favorite is an RC circuit with a Schmitt triggered inverter. So simple and ingenious.

I remember creating an oscilator by soldering a transistor onto an inductor with two windings in series with loudspeaker an battery.

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

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

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

  • The comment is by the author. And it's not wrong! You can get super cheap microcontrollers for pennies that will act as an easy to use programmable oscillator, if that's what you want. And more to the point, you usually want an oscillator to _do something_, not just to wiggle in isolation, and the cheap microcontroller lets you skip the middleman in many cases.

    Yes, you're using a million transistors to do something you could have done with a couple of discrete passives, but it will often result in a lower total BoM and development time. Not always.

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.