Function Generator
click on the above image for clearer view
Notes:
Built around a single 8038 waveform generator IC, this circuit produces sine, square or triangle waves from 20Hz to 200kHz in four switched ranges. There are both high and low level outputs which may be adjusted with the level control. This project makes a useful addition to any hobbyists workbench as well.
All of the waveform generation is produced by IC1. This versatile IC even has a sweep input, but is not used in this circuit. The IC contains an internal squarewave oscillator, the frequency of which is controlled by timing capacitors C1 - C4 and the 10k potentiometer. The tolerance of the capacitors should be 10% or better for stability. The squarewave is differentiated to produce a triangular wave, which in turn is shaped to produce a sine wave. All this is done internally, with a minimum of external components. The purity of the sine wave is adjusted by the two 100k preset resistors.
The wave shape switch is a single pole 3 way rotary switch, the wiper arm selects the wave shape and is connected to a 10k potentiometer which controls the amplitude of all waveforms. IC2 is an LF351 op-amp wired as a standard direct coupled non-inverting buffer, providing isolation between the waveform generator, and also increasing output current. The 2.2k and 47 ohm resistors form the output attenuator. At the high output, the maximum amplitude is about 8V pk-pk with the square wave. The maximum for the triangle and sine waves is around 6V and 4V respectively. The low amplitude controls is useful for testing amplifiers, as amplitudes of 20mV and 50mV are easily achievable.
Setting Up:
The two 100k preset resistors adjust the purity of the sine wave. If adjusted correctly, then the distortion amounts to less than 1%. The output waveform ideally needs to be monitored with an oscilloscope, but most people reading this will not have access to one. There is however, an easy alternative:- Winscope. This piece of software uses your soundcard and turns your computer into an oscilloscope. It even has storage facility and a spectrum analyser, however it will only work up to around 20KHz or so. Needless to say, this is more than adequate for this circuit, as alignment on any range automatically aligns other ranges as well. Winscope is available at my download page click here. Winscope is freeware and designed by Konstantin Zeldovich. After downloading, read the manual supplied with winscope and make up a lead to your soundcard. My soundcard is a SoundBlaster with a stereo line input, i made up a lead with both left and right inputs connected together. Connect the lead to the high output of the function generator, set the output level to high, shape to sine, and use the 1k to 10k range, (22nF capacitor). A waveform should be displayed, see the Figure 1 below:-
Figure 1.
Here an undistorted sine wave is being displayed. The display on winscope may flicker, this is normal as it uses your soundcard to take samples of the input waveform. The "hold" button on winscope will display a steady waveform.
Alignment:
First adjust the 100k preset connected to Pin 1 of the 8038. An incorrect setting will look similar to the waveform below:-
Adjust the preset so that the top of the sine wave has a nicely rounded peak. Then adjust the other preset, again an incorrectly adjusted waveform is shown below:
The two presets work together, so adjusting one affects the other. A little is all that's needed. When your waveform is adjusted and looks similar to Figure 1 press the FFT button on winscope. This will perform a fast Fourier transform and the displayed output will be a spectrogram of the input. For a pure sine wave, only one signal is present, the fundamental frequency, no harmonics will be present and so a spectrogram for a pure sine should contain a single spike, see Figure 2 below:-
Figure 2.
A distorted sine wave will contain odd and even harmonics, and although the shape of the sine may look good, the spectrogram will reveal spikes at the harmonics, see below:-
Once alignment of the sine wave is complete, the other wave shapes will also be set up correctly. Below is a picture of the triangle waveform generated from my circuit:-
Finally the ICL8038PCD is available from Maplin Electronics order code YH38R.