# BJT ring oscillator

I would like to build a ring oscillator with a BJT but the waveforms do not look correct. currently, I am using the following circuit:

My question is how do I control the frequency while at the same time maintaining the square shape on the pulses? Currently, the pulses look like this:

Edit: I took the output at the collector of the last stage. Here is the set up:

And here is the waveform:

What technique, if there is one, can I use to obtain a square wave at the output?

• That waveform looks like about what I'd expect. Taking the collector of one of the transistors (rather than the base, which you're doing here) as the output would probably make more sense though. Nov 27, 2023 at 3:59
• Also, you're just using the default NPN model. Try using a model that represents an actual part close to the one you plan on using; the default model is geared more towards integrated circuit design. Nov 27, 2023 at 4:00
• The oscillator you have designed here is not made of inverters that should in theory be on or off; it's made of inverting amplifiers that have a wide range between on and off. To get the kind of "snap-action" "on-or-off" inverter you describe is more complicated. Nov 27, 2023 at 4:48
• @spiderman19 If you are looking for a square wave you may need Schmitt triggers (or here.) This means positive feedback at each stage so that it snaps on and snaps off, quickly, and includes a hysteresis band. Nov 27, 2023 at 6:21
• For 50% high and 50% low square wave, design for a frequency twice what you desire for output. Then drive a flip-flop to convert 2X frequency back to 1X frequency. Flip-flop output will be square, and guaranteed 50% duty-cycle. Nov 27, 2023 at 13:51

When is an inverter NOT an inverter? (Pun intended.)

Understand that digital is a subset of analog. Digital logic is a collection of rules, which, when a system obeys them, can be used to synthesize digital logic circuits much faster and more reliably than is possible with fully continuous analog circuitry. Most commonly: when we don't need to simulate capacitor charges and whatnot, but can approximate their effect as time delays instead.

A single-stage inverter, as you can see here, isn't a very good inverter at all. Its output voltage varies continuously with the input voltage (slowed considerably by the capacitor attached to it); it's more of an amplifier than a logic gate.

The assumption that has been violated here, is that the input is a clean digital logic level. If it were, the output could be as well. But there's no capability of correcting such violations

If you chain together three in a row (inverters that is, without the large capacitors), you can increase gain enough that you might not mind the slow input; the output won't be strictly a pure logic level, but it'll at least be moving fast enough (say 100x the input) that it's recognizably "square".

Or you can use a Schmitt trigger circuit; basically as above, but with a feedback resistor from the 3rd stage output to the 2nd stage input, enough so that the positive feedback effectively raises its gain beyond infinity. (Obviously, this breaks the linearity assumption underlying the mechanism of feedback loops, and we get a different behavior instead.) This nonlinear effect (hysteresis) works particularly well to convert slowly-varying or indeterminate inputs to reasonable logic levels.

But now you've tripled the component count, roughly, and it's a lot less satisfying, say, if you wanted to build this on the breadboard or whatever?

This explanation extends to logic gates proper, as well: we are fairly picky about our logic gates, and want to see well-behaved outputs as much as possible, even if we're being loose with our input voltages, or output fanouts. This is why most gates are buffered, meaning additional NOT gates are added at the inputs and outputs, to better isolate the core logic function from the real physical input and output signals. Any generic CD4xxxBE or SN74HCxx(x) or etc. part you find (minus the partly-analog ones like timers and PLLs, but only at the analog-facing pins) will have these features.

There are still special cases where it's nice to have single naked inverters, and these are available usually in -U variants, e.g. CD4069UBE, 74HCU04. They're handy for making cheap amplifiers, crystal or other oscillators, etc. If you use one to make a ring oscillator as above, you will find exactly the same symptom. :)

Just to point out the use of a Schmitt (one that in this case uses 3 BJTs, too, but it is only one Schmitt stage), here's an example that I literally threw together from memory and some guessing from there. I'm not going to attempt to put in the care/time that may be needed to get down to $$\V_{_\text{CC}}=1.2\:\text{V}\$$, though. That would make me spend time. But I'll go close and let you work on the rest of it. I'm just pointing out something to consider:

simulate this circuit – Schematic created using CircuitLab

It's just a Schmitt inverter, with the middle of the hysteresis set to about $$\1\:\text{V}\$$, and driving an RC for timing. Should get you somewhere around $$\1\:\text{kHz}\$$. But I'm not going to go compute all that stuff. If you want, you can look at some of the papers I link here.

If you are zeroed in on making your 3-stage system work, and especially if it must work on $$\V_{_\text{CC}}=1.2\:\text{V}\$$, have fun. I don't want to think harder on this question. But there are some here who may do it better/quicker and may chip in for you.

At least the above shows that a Schmitt can do a similar task and generate "nearly" square wave outputs for you on "nearly" similar $$\V_{_\text{CC}}\$$.

Just did a simulation:

At least one Spice program says it may oscillate.

• If you aren't dead-set on doing this out of discrete transistors, you could probably do the whole thing with a single 74AUP3G14; that's a triple schmitt inverter specified to work down to Vcc of 0.8 V. You'd just need to add the resistors and capacitors to slow it down. Nov 27, 2023 at 7:53
• @Hearth Talk to the questioner. In no way am I dead set on anything. I don't care, at all. Just trying to offer another thought. I would use a 7414, myself. At least, that's what I've used in the very long past. Or something CMOS like, now. Or just buy a real oscillator. Nov 27, 2023 at 7:54
• This was meant to be an addition to your answer for the questioner. I didn't mean it to be directed at you. Nov 27, 2023 at 7:56

If you want a square wave and you need an inverted output, use a hex(6) Schmitt inverter IC with resistor from input to output and a capacitor from input to ground..

My question is how do I control the frequency while at the same time maintaining the square shape on the pulses?

You can control the frequency by the Rs and Cs, with no changes to the circuit as it is now. I suspect that you only really need a nice square wave at one node: the output, I don't think you need them on all the intermediate nodes in the BJT ring oscillator.

To get a nice square wave output, leave the circuit as-is, and simply add a separate sub-circuit that provides a means to square-up the not-so-square output you are seeing now. This sub-circuit could take many forms, here are a few ideas:

1. an amplifier with sufficient gain so that its output is either a logic 0 or logic 1. PS: what is the logic voltage you are designing for, 5V, 3.3V, or something else?
2. a simple analog comparator.
3. a suitable Schmitt-trigger logic gate (inverting, or non-inverting).

Any of these options can be implemented in many ways, including using discrete components (BJTs, or MOSFETs), and common ICs.

Of course, any sub-circuit would need to meet certain requirements regarding:
A. Input voltage range and trigger thresholds.
B. Input impedance (it should not unduly load the stage that is driving it).
C. Output voltage range (must be compatible with the logic it is intended to drive).
D. Delay time.
E. Rise and fall times of the output "square wave".

Depending on what your requirements are, some solutions will be more suitable than others.

Looking at option 3: I took a quick look at the commonly available 74HC14 "Hex Schmitt−Trigger Inverter", but unfortunately, this may not be suitable at supply voltages above 3V, since its positive threshold input voltage is above the 1.8V you showed in the simulation; for the 74HC14, VT+(max) is stated as 2.15V at Vcc=3.0V, and 3.15V at Vcc=4.0V, refer datasheet:
https://www.mouser.com/datasheet/2/308/74HC14.REV1-34947.pdf

So in this case, you may have to resort to designing a discrete Schmitt trigger, in which case you can refer to these for guidance:

This may also be useful:
https://electronics.stackexchange.com/a/691566/341959