Anyone who has done any considerable amount of repairs and troubleshooting knows the importance of having a signal generator. For audio circuits, at least in my experience, this doesn't need to have particular requirements, neither in terms of frequency precision nor distortion, as long as it gives something to visualize on a scope; large output amplitude isn't that necessary either, even if nice to have.
This is why I've managed so far with a simple phase-shift sine generator made from two transistors and housed in the shell of a broken DC wall wart, with the output available from the former mains prongs. It was fun to use, but distortion was awful (~4%) and it stopped working if the supply voltage dropped too much, an issue with battery power. 4% might seem like a lot of distortion and it is, but the output still looks sinusoidal enough on a scope.
It's also perfectly suitable to use phones or other devices capable of outputting audio as signal generators, with apps such as this one, as long as the phone doesn't output ultrasonic frequencies that aren't audible but still apparent on scope (such as my Samsung). Still, while this method gives multiple waveforms, low distortion, frequency control and even sweeps, it's still nice to have something that's quicker to setup, and doesn't have me worried about connecting it to some suspicious circuit to test (even if the phone or mp3 player is an old one).
In particular, I wanted to try using a triangle wave to better see the eventual onset of clipping, because the sharp peaks would be flattened, as I had seen in some old service manuals. That's why I had the idea some months ago, while reading through the Wireless World "Circard collection part 3"(a true treasure trove of CMOS application, already in the 70s), to combine some of the ideas presented in a circuit that could output multiple output waveforms using a single CMOS unbuffered hex inverter. Some time later, I finally put together a schematic, breadboarded it, and found it to work just as expected:
The core of the circuit is the schmitt-trigger + integrator pair formed by U1B, C and A, a classic triangle + square generator. The main addition to this part of the circuit is a trim pot that adjusts the symmetry of the output waveform (and the duty cycle of the pulse wave), as suggested in the circards, a necessary addition because the threshold voltage of CMOS inverters isn't perfectly half of the supply (but is still proportional to it).
Two output waveforms are already handled, even if the triangle output passes through an inverting amplifier made from a spare inverter, just to give it a bit more output without changing the shape of the wave and isolate it a bit more from the oscillator.
It's very easy to add upwards and downward-ramping sawtooth outputs: putting a diode in parallel to the resistor feeding the square output to the integrator, the discharge time in one direction is much faster than in the other. The frequency remains roughly the same. It's even possible to have an additional potentiometer after the diodes that varies continuously between the two saw ramps and triangle in the middle, while also varying the pulse wave width if wanted. Care must be taken that this doesn't influence the sine wave output, or the eventual fixed symmetry trim.
To generate the sine wave output, the triangle is simply passed through a multiple-feedback low-pass filter with high Q tuned close to the oscillation frequency. The sine wave is then further amplified by an inverting amplifier made by another inverter.
You might think that filtering a triangle can't give a low distortion sine wave, but actually the output of this circuit measures 1.40% with ARTA, which is lower than my expectations and much lower than the "looks like a sine on a scope" bar. You might also think that the amplifier after the filter isn't very linear and would increase distortion, but I've actually found that the distortion is lower after the amplifier, because the non-linearity further smooths out the waveform. After all, shaping a triangle wave, even if in much more refined ways, is also the basis of famous function generators like the ICL8038.
The output voltages (on 9 V) are 2.2 V for the sine, 2.6 V for triangle and saw, the full supply voltage for the square. Of course the potentiometer allows any value between 0 and those.
The frequency with the values shown is a bit below 600 Hz, but it can be anything else, by changing C1 for example (the low-pass filter must be scaled accordingly).
The current draw can be expected to be around 25 mA, because CMOS inverters used as linear amplifiers have high current draw, but that's perfectly normal and nothing to worry about.
I've messed in the past with sine generator circuits with and without nonlinear feedback elements, but never with good results. The circuits either refused to oscillate or gave untolerable distortion, with or without painful trimming. The reason I had finally settled on the phase shift oscillator was because it was actually "reliable", even if it was sensitive to supply voltage. This new circuit, being based on a triangle oscillator, is much more reliable and independent of supply voltages. I've found no measurable changes in output and distortion for a reduction of supply voltage of at least 1 V. Even on a battery with the mentioned current draw, the circuit will operate reliably for long periods of time.
The layout
If you want to make one, here's the perfboard layout I used:
The build
Since this is "bench equipment", the look is even more utilitarian than usual, with a cheap plastic enclosure and recycled knobs. The main output is the 6.3 mm jack, while the parallel BNC jack allows me to use other cables I have.
Update
It occurred to me that I could easily squeeze a bit more performance out of the sine generator by turning its output amplifier into another low-pass filter. I've just tested this and it works! THD now measures 0.7%, which I find impressive from such a humble circuit. The output amplitude stays more or less the same. Here's the new schematic:
I've realized this in a not so pretty way by breaking connections and adding components to the back of the board. If you are capable of doing the same, you don't need my help as to how to do it, and the same goes for making an updated layout! My sketch for it is even less pretty than the final result!
Thanks a lot, I will look to get one up and running with a 1P4T (smaller 1P4T/2P4T/1P8T are easier to source) and SPDT for SAW. Is pin 11 of your 2P6T supposed to be saw_d?
Wow, such a neat little circuit! I have a cheap XR2206 based function generator which seems to achieve similar THD figures as yours but only after a massive headache trimming it. It also lacks sawtooth options and doesn't work great powered with a 9v battery.
I think I have a spare CD4069 lying around so I'm going to give yours a try! It seems ideal to keep on the bench and the compact form-factor means it won't take up much space.