Function generator with adjustable frequency from 0 Hz to over 400 kHz, adjustable amplitude, DC offset, duty, and of course the function selection – square, triangle, and sine. Generator based on good old ICL8038 integrated chip generator that gives pretty good shaped signals as for amateur purposes.
Changes and problems
This circuit has been designed a little differently than ICL’s note or other similar circuits are suggesting. I tested a bunch of different configurations with different peripherals and chosen the best – so to get good waveshape at 400kHz. I got rid of some of the elements, I added my own solutions. The two ICL chips that i have can oscillate around up to 420-430kHz, and practically we can get good waveforms up to that frequency.
The biggest problem of these circuits generators is strong distortion on sine wave output pin 2 at frequencies above 100kHz – so most of the solutions based on this chip has a limited frequency. I found a workaround by not putting the load on the square wave output from pin 9 (open collector that needs to be pulled up to the power supply). In some way the quality of other waveforms is dependent on the load on this pin. Pull-up resistor is activated only when switching output to the square waveform – with the same switch. I got rid of the recommended in the note 10M pot to “improve” the vaweforms. As it turned out its only making them worse, and add a characteristic spout on the top of the upper half of the sine.
Square output pin 9 with open collector, normally would never be able to give a good square wave at these frequencies. Rising edge depends only on the pull-up resistor and its growing very slowly. If we give too strong pull-up resistor, in turn, the trailing edge will be weak because the internal transistor is too heavily loaded. Here, i fixed the square wave with a comparator so that the slope is pretty steep, steep as applied comparator can give. Shown in the schematic LM393 (1.3μs response time) has been replaced by LM293 comparator with 300ns response time – so square wave is acceptable at 400kHz, but it would be good to use even faster model of comparator.
The amplitude of the signal, unfortunately, is not the same for each function, tests have shown that trying to match it with the usual R/R signal dividers will give very distorted waveforms (rounded square and triangle) – so i resigned from such divisors. When ICL is powered from +-12V voltage, it gives VPP voltage waveforms:
Sine = 0.22 * VCC
Triangle = 0.33 * VCC
Square = 0.9 * VCC
We don’t have to concern for the last of them because it gets fed to the input of comparator supplied from +-5V, giving at the output amplitude of signal almost equal to its supply voltage, let’s assume (because each comparator can give different output voltages) that it is a 9.5 VPP (peak to peak). Since the input voltage for the comparator has a greater amplitude than its supply voltage, I decided to fed it just trough the current limiting resistor. Here, the potentiometer is used as a source of compare voltage for the comparator, set it to get the same signal duty that has been set for ICL. Sinusoidal signal coming from the ICL is 5.28 VPP and triangular is 7.92 VPP – so the spread is not that large. A small note here, the scale of the amplitude potentiometer can only have a decorative function or you can match it to only one function. Use of R/R dividers pretty destroys signals, so choice is yours.
Amplitude and DC offset adjustment
Waveforms obtained in this way still need to be fed to the operational amplifier that will allow setting of the amplitude and DC offset. Shown in the schematic TL072 (3MHz and Slew Rate of only 13V/μs) is the absolute minimum that is suitable for such a circuit. Sinusoidal and triangular waveforms will be passed nice, but we can forget about the square. I also tested the NE5532 opamp and it falls considerably worse (10 MHz and slew rate 8V/μs). A LM358 is not even worth of bother. In this case, I used the LM6172 operational amplifier (100MHz and 3000V/μs) which is doing its job great – it passes shape of the rectangle exactly as it got it from the comparator and allows for the full dc offset and amplitude regulations. First half of this opamp is working as repeater, so that the second one that works as an amplifier wont load ICLs signal with its input because they are very “delicate”. +-12V supplied opamp allows for adjusting the amplitude from 0V to 22V. Adding the DC offset regulation to the circuit in such a way that has been done here, has a one disadvantage – waveforms (particularly square) will be having a discharged capacitor effect at a very low frequencies (below 100Hz) – this is the DC offset adjustment potentiometer support capacitor. Its marked as 10uF bipolar on the schematic, but its good to put bigger one to reduce this effect.
The previously published AVR frequency meter has been used in this construction, so its completes the whole generator and allows to perform the frequency adjust without using an external meter or oscilloscope. Shown generator board allows connection of such a meter, giving him power supply and signal to probe. This signal is taken after the waveform switch and is formed in the second half of the above mentioned comparator, and produces a square wave signal with +-5V voltage which its bottom half is then cut off with a 1N4148 diode to the level of -0.7 V. This signal is fed to the meter, the AVR input pin accepts such signals.
Power supply components included on the board are producing +5 V and-5V for the comparator and frequency meter, and +12 V and-12V for the ICL8038 and operational amplifier. When making this construction and starting it for the first time, make sure that the frequency meter do not draw too much current from the positive line, witch can cause a voltage drop so that 7805 or 7812 stabilizers will experience a drop below their working voltage and give a small sine shaped drops from 50Hz mains – impossible to see without oscilloscope. If this happen, you must increase the capacity of the main filter capacitors or use a more powerful transformer. Voltage transformer should have a 2x14V minimum to allow the proper operation of 7812 and 7912 stabilizers.
In this article i described how to make a simple front panel (its not translated, sorry), and beside regular files such as PCB files, i added a ready-to-print design of the front panel in the PDF format, suitable for housing Z1A, in the attachment. Due to certain limitations of the program in which the panel was designed, scales of the potentiometers provide a full range of regulation, such as duty fill from 0% to 100%, where the circuit does not achieve such regulation. In series with potentiometers, you can try to add resistors so that they will show exactly what generator is doing – i was not playing with this. Duty adjustment is in the range of about 5-10% to 90-95%, is non-linear, and adjusting its lower half reduces the frequency of oscillation for a large values – its a defect or the ICL8038 or it just is designed to work in such way. Offset, amplitude, and frequency scales are pretty accurate.
Shielding, temperature drift
Whole electronic circuit is protected by a tin to minimize the impact of the electromagnetic field of a transformer and power lines. ICL chip changes its oscillation frequency depending on the temperature, so when you turn on the generator, wait approximately two minutes until all the elements get heated to they operating temperature and then fine-tune the frequency. For example, a cold circuit set to 400kHz, decreases its frequency by about 1-2 kHz after warming up. After stabilize, the frequency can change a bit (ICL chip fault), but it should not change over time. For this reason, i do not recommend an active cooling housing – in my case air flow does not exist, and the 7805 can get pretty hot (big current draw by frequency meter) and rise temperature of the whole circuit – I think it even helps to stabilize the temperature.
In my version of device i added the input mode for the meter, which can be selected on the range switch, and the output connector can be used to measure external signals. Provide a minimum 0V-3V signal – such signal can be measured by the meter. The signal may be larger, it is matched by the same elements that adjust it at the output of the comparator. Graphics in attachment shows the connections of switches, in this case, I used two rotating ones, 2 x 6 rows each. “Gold-plated” RCA connector is used temporary because I ordered BNCs but they came with a big delay.
Gallery belows shows also output waveforms at 400kHz.
DOWNLOAD – Eagle 6.4.0 project files and PDFs version 1.1; PDF file for front-panel br>