A sine, triangular, and rectangular waveform generator based on an original approach.

By Michael A. Shustov (Russia) and Andrey M. Shustov (Germany)
Taken from their book Electronic Circuits for All

A function generator is an instrument that generates more than one waveform of variable frequency and, optionally, amplitude. This is a useful device necessary in labs for testing, tweaking, faultfinding, repairing and tuning electronic devices.

In most function generators of classic design, a rectangular-pulse generator is used as the starting point.

Next comes a rectangular-to-triangular voltage converter usually based on the charge/discharge process. Next, the triangular waveform is transformed into a kind of sinewave, usually including good suppression of the first harmonic.

The main disadvantage of this three-step process and the associated circuitry is the inherent nonlinearity of the charge-discharge processes, which is especially noticeable when the generator frequency is tuned. In particular, the distortion of the sinusoidal signal increases accordingly owing to sub optimal filtering of the higher harmonics of a complex signal.

The other way around

The function generator described below is off the beaten track in that the converting of signals occurs in the reverse order. First, a sinusoidal waveform is created, which is then converted into a triangular waveform. Next, a bipolar signal of rectangular shape is obtained from the triangle.

There are two frequency bands which can be selected by a selector switch. The sinewave signal is generated by an opamp-based oscillator. The triangular wave is generated by converting the sinewave to a triangular shape by rectifying and inverting the sinewave signal. Finally, the squarewave signal is generated by a differential comparator.

Circuit description

Proceeding from theory to practice, the schematic of the Simple Function Generator is available in the download section below.

The circuit works on a ±5 V (symmetrical) power supply. Opamps IC1.A, IC1.B, and IC1.C form the sinewave oscillator. It actually outputs two sinewaves with a 90-degree phase difference. The coverage of the two frequency bands depends on the capacitor values C4 and C6 (33 nF) and their respective counterparts C5 and C7 (3.3 nF). Oscillator feedback is provided by resistor R24. Preset P1 is used to set the feedback to a level where a proper sinewave is obtained without clipping the signals.

The output frequency of the generator is continuously adjustable on dual-potentiometer P2 with its sections P2A and P2B. S1 switches between the two frequency ranges, assuming equal capacitance for C4 and C6 on the ‘low’ range, and C5 and C7 on the ‘high’ range.

The AOUT and BOUT signals from the sinewave oscillator are fed to two practically identical rectifier circuits IC2.A/IC2.B and IC2.D/IC2.C which not only rectify the sinewave but ‘flip’ the clipped part of the waveform to the positive and negative side. That is, the sinewave is fully rectified above and below ‘zero’. These two rectified waveforms are 90 degrees out of phase and have double the frequency of the original sinewave signal. The rectified outputs are added to give signal COUT. This (mathematic) addition conveniently forms the triangular wave, albeit of lower amplitude than the originating sinewave.

The triangular wave is next converted to squarewave shape by IC1.D (another LM324 opamp) in combination with IC3 (an LM311). Preset P4 is used to adjust the bias voltage on IC4 (a 741) which in turn adjusts the offset voltage of the squarewave. Finally, preset P3 is used to adjust the amplitude of the squarewave on DOUT. All three output signals are available on 2-way PCB screw terminal blocks K3 and K2.

With S1 set to the Low range (i.e. with C4 and C6 in circuit) the generator covers 50–500 Hz for sinewave output, and 100-1,000 Hz for triangular and rectangular wave output due to the doubling of the original frequency. By modifying the frequency-determining capacitors or adding additional ranges on S1, frequencies down to sub-Hz can be provided.

When S1 is operated to switch capacitors C5 and C7 into circuit the frequency will rise by a factor of 10. With C5 = C7 = 3.3 nF as shown, the range of generated frequencies is:
  • 1,000–10,000 Hz for the triangular waveform and rectangular waveforms. The effective range is 1,000 to 8,000 Hz; it can be extended upwards slightly by changing C5 and C7 to 2.2 nF.
  • 500-5,000 Hz for the sinusoidal waveform; again the effective range is 500 to 3,500 Hz roughly; upwards of that may be achieved by changing C5 and C7 to 2.2 nF.


Elektor Labs designed a printed circuit board for the Simple Function Generator (see below). Construction should be plain sailing even for relative beginners as all parts are through-hole, the board is spaciously laid out, and there are no microcontrollers to program.

The pinheaders marked P3A and P4A allow external potentiometers to be connected through connecting wires. In that case, omit presets P3 and P4 from the board. 


Assuming you have successfully built the board, the recommended test procedure for the project is as follows:
  • Connect the ±5 V (symmetrical) supply to connector K1.
  • Select the required frequency range Low or High on switch S1.
  • Connect an oscilloscope to line AOUT on K3 (sine), and C (GND).
  • Adjust P1 to get a sinewave signal that’s as clean as possible.
  • Move the ‘scope input to COUT on K3 and check the presence of the triangle signal.
  • Move the ‘scope input to DOUT on K3 and check the presence of the rectangular signal.
  • Operate P2 (dual pot) to confirm it controls the generator output frequency.
  • Adjust P3 to set the amplitude of the signal.
  • Adjust P4 to set the rectangular wave offset voltage.
You’re all set now to apply a sinusoidal, triangular or rectangular, frequency and amplitude adjustable signal to your equipment and see on the ‘scope how it responds!

Component List


R1-R4,R7-R16,R18,R21,R24 = 22kΩ
R5,R6 = 10kΩ
R17,R19 = 1MΩ
R20 = 2.2kΩ
R22,R23 = 3.3kΩ
P1 = 100kΩ trimpot
P2 = 100kΩ ganged (stereo) potentiometer
P3 = 47kΩ trimpot
P4 = 4.7kΩ trimpot


C1 = 100pF, 50V, C0G, 5%
C2,C3,C8 = 100nF, ceramic, 50 V, MCFY Series
C4,C6 = 33nF, 100V, SkyCap SR Series, ±10%
C5, C7 = 3.3nF, 50V, C0G, 5%


D1-D4 = 1N4148
IC1,IC2 = LM324
IC3 = LM311
IC4 = 741 (uA741)


K1 = 3-way PCB screw terminal block, 3.5mm pitch
K2,K3 = 2-way PCB screw terminal block, 3.5mm pitch
P3A = 2-pin pinheader, 0.1" pitch, vertical
P4A = 3-pin pinheader, 0.1" pitch, vertical
S1 = DPDT toggle switch, non-illuminated
8-way DIP IC Socket
14-way DIP IC Socket