Wednesday, June 20, 2012

Versatile 200KHz Function Generator using ICL8038

ONE of the most useful facilities in the electronic experimenter’s workshop is an ability to generate a.c. test signals of various waveforms, frequencies and amplitudes. This is where this Function Generator project comes in, the “function” in the name referring to the waveform of its output signal. 

The Generator can be used for testing or driving many circuits, from below audio up to a couple of hundred kilohertz, and may even be used as a variable speed clock for logic circuit testing. It has sine, square and triangle-wave outputs plus a separate 0V to +5V squarewave output for logic driving. This may also be used with a “sync” input when, for example, inspecting low-level signals on an oscilloscope.

Circuit Detail:
The full circuit diagram is shown in Fig.1. Starting with the power supply, this is of the dual rail type. The very low output frequencies require d.c. coupling in the output circuit, which in turn makes a circuit using separate positive and negative supplies about a central 0V or ground much simpler to design.

Transformer T1 has a 15V-0V-15V 100mA centre-tapped output, which after rectification by REC1 produces raw positive and negative supplies of about 22V each across capacitors C1 and C3. The voltage regulators IC1 and IC2 reduce these to plus and minus 12V.
function generator circuit
Function Generator Schematic
 Since the supply voltages must be symmetrical to avoid a d.c. offset voltage at the output an adjustable regulator is used for IC2, which can be trimmed with preset VR1 to achieve this. These regulators are 1A and 1·5A types which can dissipate the small amount of internally generated heat without additional heatsinks. Their outputs have the usual decoupling capacitors, C5 to C8, and the l.e.d. D1 indicates when the unit is powered.
Waveform Generation:
Most of the waveform generation is carried out by IC3, an 8038 dedicated waveform generator chip. The output frequency is determined by the voltage applied to the Frequency Sweep input at pin 8 and the value of the capacitor connected between the negative supply rail and pin 10.

The required range of control voltage is applied by the panel mounted Frequency control VR3 with minimum and maximum values adjustable with presets VR2 and VR4 for the desired frequency range. Note that the frequency rises as the control voltage is lowered and vice-versa, which explains why preset VR4, Set High Freq., is at the bottom. 
Seven frequency ranges are provided, in decade steps, by rotary switch S2 with associated capacitors C12 to C18. Some of these capacitors can be obtained in 1% tolerance, others may have to be 5% or 10%, and for the bottom two ranges electrolytics are used. These are notoriously inaccurate, so where these ranges are to be provided it helps if a capacitance meter is available to pick ones reasonably close to the correct value.
 
The top range is set with capacitor C11, which is slightly lower than the expected value to compensate for stray capacitance in the circuit. The value shown proved to be about right in the prototype.
 
Although the 8038 is capable of quite good waveform linearity without adjustment, some worthwhile improvement can be achieved by external trimming. Presets VR5, VR6 and VR7 are provided for minimising sinewave distortion. The sinewave output is taken from pin 2 and the triangle output from pin 3.

Square Wave:
The squarewave output is usually taken from pin 9. This is an “open-collector” output which requires a pull-up resistor to the positive supply so the speed of the rising edge depends to some extent on the value of this resistor. A sufficiently low value was found to result in some distortion of the sinewave output during development of this project so it was decided not to use it. Instead, the triangle output at IC3 pin 3 is fed to the inputs of the LM393 dual comparator IC4 at pin 3 and pin 5, via resistors R10 and R11.
 
One of the comparator outputs, from pin 1, is taken to the Waveform selector switch S3. The other, pin 7, drives the base of transistor TR1 which gives a 0V to +5V squarewave output from SK1 for driving logic circuits. This output may also be used for synchronising external equipment such as oscilloscopes when working with low level signals.
 
A couple of minor precautions are included in this part of the circuit to minimise  breakthrough of the squarewave into the other waveforms. Resistors R10 and R11 eliminate a problem of feedback which appeared to be from the inputs of IC4 back into the triangle waveform, and use of a two-pole switch for the waveform selector S3 allows the squarewave signal from resistor R17 to be “grounded” through S3b when not selected.

Range Selection:
The three signals, Square, Triangle and Sinewave, all have different peak-to-peak amplitudes at this point. Op.amp IC5 has a gain set by resistors R20 and R21 so that the sinewave leaves it at 10V pk-pk, then the two resistors R16 and R17 are used to attenuate
the other two signals in conjunction with resistor R19 to obtain the same pk-pk level.
 
Op.amp IC5 is an Elantec EL2045 which is a high-speed type. A TL071 can be used here, but the faster component offers less distortion of the triangle and squarewave signals at high frequencies. Potentiometer VR8 provides variable control of the output amplitude with decade ranges added by the attenuator network built around Amplitude Range switch S4 and resistors R22 to R26.
 
Finally, a buffer stage using transistors TR2 to TR5 and resistors R27 to R33 gives the circuit a 50-ohm output. The complementary design of this stage minimises quiescent current and keeps distortion to a minimum, even at high frequencies.

First Tests:
Always remember to disconnect the unit from the mains before making any adjustments. Do not come into contact with the 230V a.c. input to the transformer.
 
Normally the author recommends initial testing with a current-limited bench power supply but this is a bit difficult with a dual supply rail design so this project was just connected to its transformer (T1) and powered up, testing each part of the circuit in turn. It is assumed that a DVM and an oscilloscope will be available as a function generator is usually used in conjunction with a ’scope anyway.
 
The first check is to connect the transformer and power it up. Around 22V d.c. should be present with respect to ground or 0V, positive at the top of capacitor C4 and negative at the bottom of C2.
If these voltages appear correct IC1 can be fitted and on powering the board again the regulated negative 12V should appear at the bottom of C5. It should also appear at pin 4 of the sockets for IC4 and IC5, and pin 11 of the socket for IC3.
 
Next IC2 should be fitted. This time the regulated positive voltage should be present at the top of capacitor C6 and on pin 8 of IC4’s socket, pin 7 for IC5, and pin 6 for IC3. It probably won’t be exactly 12V, but it can now be adjusted to approximately this value with preset VR1.

Wave Form Check:
Frequency control VR3 should now be temporarily connected along with a 22nF 1% capacitor across the two connection points for switch S2. All of these points can be readily identified from the connections diagram shown in Fig.3. IC3 should now be inserted into its socket.
 When the circuit is now powered up, the sinewave (around 5V pk-pk) and triangle wave (8V pk-pk) should be present at their connection points for switch S3. The 22nF capacitor is the value for 200Hz to 2kHz, so Frequency control VR3 should give a range somewhere around this, though it may not be accurate until the presets VR2 and VR4 have been adjusted.

Next IC4 can be fitted. Both outputs of this, pins 1 and 7, should produce squarewaves with an amplitude of about 20V pk-pk. If transistor TR1 is now fitted, the 5V pk-pk squarewave output should appear from the connections for socket SK1. Note that this swings between ground (0V) and +5V, not symmetrically about 0V as the other waveforms will.
 
If IC5 is now fitted and an oscilloscope used to view its output (pin 6, but helpfully it also appears at the connection point for the top of amplitude control VR8), connecting the input (the connection point immediately above it) to any of the three waveform outputs for S3 should produce the appropriate output waveform at about 10V pk-pk.
 
The last stage of testing is to fit the remaining four transistors, taking care with type and orientation as there are two pnp and two npn types, and to connect the output from IC5 directly to the input to this stage (the connection point for the pole of S4). When the input to IC5 is connected to each waveform as before, it should appear at the final output, connection point for SK2, with a 10V pk-pk amplitude. This completes the board testing. It may be found that IC1 to IC3 run very slightly warm, this is normal.
   
Output Attenuator:
The resistors (R22 to R26) for the output attenuator are soldered directly to switch S4 as shown in the wiring diagram Fig.3. This also shows the connections of the frequency range capacitors C12 to C18 to frequency range switch S2, though these are shown positioned radially for clarity. In fact there is not room for this, so they are assembled pointing backwards from the switch, using a piece of fairly thick tinned copper wire soldered to an unused switch connection (position 11) for their common or negative connection point. This should be clear from the photographs.

Frequency switch S2 is a single-pole 12-way switch with its limiting device set to give seven ways. Although C12 is shown as a single component in the circuit diagram it actually consists of a 150pF and a 33pF capacitor connected in parallel, this combined value being selected for the correct range by trial and error after the rest of the circuit was complete and fully  adjusted.

Final Adjustments:
The project is now ready for final adjustment, where the preset resistors are trimmed to obtain the optimum performance. Before commencing the 1kHz frequency range (using C14, 22n 1%) should be selected with switch S2, and Frequency control VR3 should be set to around midtravel so that the unit is operating at about 1kHz.
 
Preset VR1 should have previously been set to give a positive supply of about 12V, and the remaining presets VR2, VR4, VR5,VR6 and VR7 should all be set to about half travel. Multi-turn types seem to be supplied already set to this, but if doubt exists they can be turned in one direction until a “click” is heard and then turned back again for half their total number of turns.
 
The triangle output waveform should be selected with S3 and the project allowed a few minutes to settle to its normal operating temperature following power-up. The first adjustment consists of connecting a meter between ground (0V) and the output of IC5 (pin 6), and carefully adjusting preset VR1 to obtain an average d.c. voltage of zero at this point, i.e. no d.c. offset in the output waveform.

Sinewave adjustment is carried out using presets VR5, VR6 and VR7. Presets VR6 and VR7 adjust the shapes of the positive and negative output half cycles respectively, clockwise rotation giving them a more “pointed” shape, and anticlockwise a more “rounded” one. Preset VR5 has less effect but actually adjusts both duty cycle and frequency to a small extent. 

Connect an oscilloscope to the output at SK1 and adjust VR6 and VR7 for the best sinewave shape. Presets VR6 and VR7 interact to some extent so repeated adjustment will be required.
 EPE

3 comments:

  1. awesome site! :D
    can you publishing the pcb layout?

    ReplyDelete
  2. This post is very simple to read and appreciate without leaving any details out. Great work! best generator for travel trailer

    ReplyDelete
  3. Hi, I hope you will be perfect and enjoying the life.
    Its dr.Rana , nice to see your informative post on blogger. It is very interesting and knowledge based. I like discuss some key points regarding the subject.
    i am also trying to build a blog on microcontroller projects, and which have your valuable advice.
    If you could see my blog Microcontroller Solutionhere is its link. https://microcontroller-atmel-pic-avr.blogspot.com/.
    Regards.
    Dr.Rana

    ReplyDelete