In this post we will learn how to build 3 simple function generator circuits using a single IC 4049, for generating accurate square waves, triangle waves, and sinewaves through easy switch operations.

Using only one low-cost CMOS IC 4049 and a handful of separate modules, it is easy to create a robust function generator that will provide a range of three waveforms around and beyond the audio spectrum.

The purpose of the article was to create a basic, cost-effective, open source frequency generator that is easy to construct and used by all hobbyists and lab professionals.

This goal has undoubtedly been accomplished, as the circuit provides a variety of sine, square and triangle waveforms and a frequency spectrum from roughly 12 Hz to 70 KHz employs just single CMOS hex inverter IC and a few separate elements.

No doubt, the architecture may not deliver the efficiency of more advanced circuits, especially in terms of waveform consistency at increased frequencies, but it is nevertheless an incredibly handy instrument for audio analysis.

**For a Bluetooth Version you Can Read this Article**

## Block Diagram

The circuit operating basics from the above shown block diagram. The function generator's main section is a triangle / squarewave generator which consists of an integrator and a Schmit trigger.

Once the output of the Schmitt trigger is high, the voltage feeding back from the Schmitt output to the input of the Integrator allows the output of the Integrator to ramp negative before it exceeds the lower output level of the Schmitt trigger.

At this stage the Schmitt trigger output is slow, so the small voltage fed back to the input of the integrator allows it to ramp up positively before the Schmitt trigger's upper trigger level is reached.

The Schmitt trigger's output goes high again, and the integrater output spikes negative again, and so forth.

The integrator output's positive and negative sweeps represent a triangular waveform whose amplitude is calculated by the Schmitt trigger's hysteresis (i.e. the difference between the high and low trigger limits).

The Schmitt trigger production is, naturally a square wave made up of alternating high and low output states.

The triangle output is supplied to a diode shaper through a buffer amplifier, that rounds off the highs and lows of the triangle to create an approximate to a sinewave signal.

Then, each of the 3 waveforms can be chosen by a 3-way selector switch S2 and supplied to an output buffer amplifier.

## How the Circuit Works

The full circuit diagram of the CMOS function generator as seen in the figure above. The integrator is entirely built using a CMOS inverter, Nl, while the Schmitt mechanism incorporates 2 positive feedback inverters. It's N2 and N3.

The circuit works this way; considering, for the moment, that the P2 wiper is in its lowest location, with N3 output being high, a current equivalent to:

**Ub - U1 / P1 + R1**

travels via R1 and p1, where Ub indicates the supply voltage and Ut the N1 threshold voltage.

Because this current is unable to move into the inverter high impedance input, it begins traveling towards C1/C2 depending on which capacitor is toggled in line by the switch S1.

The voltage drop over C1 thus decreases linearly such that the output voltage of N1 rises linearly before the lower threshold voltage of the Schmitt trigger is approached just as the output of the Schmitt trigger becomes low.

Now a current equivalent to **-Ut / P1 + R1** flows through both R1 and P1.

This current always flows through C1, such that N1's output voltage increases exponentially until the Schmitt trigger's maximum limit voltage is achieved, the Schmitt trigger's output rises, and the entire cycle begins all over again.

To maintain the triangle wave symmetry (i.e. the very same slope for both the positive-going and the negative-going parts of the waveform) the condenser's load and discharge currents has to be identical, meaning Uj,-Ui should be identical to Ut.

However, sadly, Ut being decided by the CMOS inverter parameters, is normally 55% ! The source voltage Ub = Ut is approximately 2.7 V with 6 V and Ut approximately at 3.3 V.

This challenge is overcome with P2 which requires modification of the symmetry. For the moment, consider that thai R-is related to the positive supply line (position A).

Regardless of the setting of P2, the Schmitt trigger's high output voltage always remains 11.

Nevertheless, when N3 output is low, R4 and P2 establish a potential divider such that, based on P2's wiper configuration, a voltage between 0 V to 3 V could be returned back into P1.

This ensures the voltage is no longer -Ut and but Up2-Ut. In case the P2 slider voltage is around 0.6 V then Up2-Ut should be around -2.7 V, therefore the currents of charging and discharging would be identical.

Obviously, due to the tolerance in the value of Ut, the P2 adjustment should be performed to match specific function generator.

In situations in which Ut is less than 50 percent of the input voltage, connecting the top of R4 to ground (position B) might be appropriate.

A couple of frequency scales can be found, which will be assigned using S1; 12 Hz-1 kHz and 1 kHz to approximately 70 kHz.

Granular frequency control is given by P1 that changes the current of charge and discharge of C1 or C2 and thus the frequency through which the integrator ramps up and down.

The squarewave output from N3 is sent to a buffer amplifier via a waveform selector switch, S2, that comprises of a couple of inverters biased like a linear amplifier (hooked up in parallel to improve their output current efficiency).

The triangle wave output is provided through a buffer amplifier N4 and from there by the selector switch to the buffer amplifier output.

Also, the triangle output from N4 is added to the sine shaper, consisting of R9, R11, C3, Dl, and D2.

D1 and D2 pull little current up to around +/- 0.5 volts but their diverse resistance drops beyond this voltage and logarithmically limit the highs and lows of the triangle pulse to create an equivalent to a sinewave.

The sine output is transmitted to the output amplifier via C5 and R10.

P4, which varies the gain of N4 and hence the amplitude of the triangle pulse supplied to the sine shaper, changes the sinus transparency.

Too low a signal level, and the amplitude of the triangle would be below the threshold voltage of the diode, and it will proceed with no alteration, and too high a signal level, the highs and lows would be strongly clipped, thereby providing not well formed sine wave.

The output buffer amplifier input resistors are chosen such that all three waveforms have a nominal peak to minimum output voltage of around 1.2 V. The level of output could be changed through P3.

### Setting Up Procedure

The adjustment method is simply to change the symmetry of the triangle and the purity of the sinewave.

In addition, the triangle symmetry is ideally optimized by examining the squarewave input, since a symmetrical triangle is produced if the squarewave duty cycle is 50% (1-1 mark-space).

To do this, you will have to adjust the preset P2.

In a situation where the symmetry increases as the P2 wiper is moved down towards the N3 output but correct symmetry could not be achieved, the upper part of R4 must be joined in the alternate position.

The purity of the sinewave is changed by adjusting P4 until the waveform 'looks perfect' or by varying for minimal distortion only if there is a distortion meter to check.

As the supply voltage affects the output voltage of the different waveforms, and therefore the purity of the sine, the circuit must be powered from a robust 6 V supply.

When batteries are used as power source batteries they should never be forced to run too much downward.

The CMOS ICs used as linear circuits drain higher current than in usual switching mode, and hence the supply voltage must not exceed 6 V, or else the IC can heat up due to heavy thermal dissipation.

Another great way of building a function generator circuit can be through the IC 8038, as explained below

## Function Generator Circuit using IC 8038

The IC 8038 is a precision waveform generator IC specially designed for creating sine, square and triangular output waveforms, by incorporating least number of electronic components and manipulations.

Its working frequency range could be determined through 8 frequency steps, starting from from 0.001Hz to 300kHz, through the appropriate selection of the attached R-C elements.

The oscillatory frequency is extremely steady regardless of temperature or supply voltage fluctuations over a wide range.

Additionally, the IC 8038 function generator offers a working frequency range up to as large as 1MHz. All the three fundamental waveform outputs, sinusoidal, triangular and square can be at the same time accessed through individual output ports of the circuit.

The frequency range of the 8038 can be varied through an external voltage feed, although the response may not be very linear. The proposed function generator also provides like adjustable triangle symmetry, and adjustable sine wave distortion level.

### Function generator Using IC 741

This IC 741 based function generator circuit delivers increased test versatility compared to the typical sine wave signal generator, giving 1 kHz square and triangle waves together, and it is both low-cost and very simple to construct. As it appears the output is approximately 3V ptp on square wave, and 2V r.m.s. in the sine -wave. A switched attenuator might quickly be included if you want to be gentler to the circuit that's being tested.

### How to Assemble

Start stuffing the parts onto the PCB as displayed in the component layout diagram, and make sure to insert the polarity of the zener, electrolytics and ICs correctly.

### How to Set up

To set up the simple function generator circuit, just fine-tune RV1 until the sine waveform is slightly under the clipping level. This provides you with the most effective sinewave through the oscillator. The square and triangle do not require any specific adjustments or set ups.

### How it Works

- In this IC 741 function generator circuit, the IC1 is configured in the form of a Wien bridge oscillator, operating at 1 kHz frequency.
- Amplitude control is supplied by the diodes D1 and D2. The output from this IC is driven via either to the output socket or to the squaring circuit.
- This is connected to SW1a by means of C4 and it is a Schmidt trigger (Q1 -Q2). The zener ZD1 works like a 'hysterisis-free' trigger.
- The IC2, C5 and R10 integrator generates the triangular wave from the input square wave.

#### Simple UJT Function Generator

The unijunction oscillator shown below, is among the easiest sawtooth generators. The two outputs of this give, namely, a sawtooth waveform and a sequence of trigger pulses. The wave ratchets up from around 2V (the point of the valley, Vv) to the maximum peak (Vp). The peak point relies on the power supply Vs and the stand-off BJT ratio, which may range from about 0.56 to 0.75, with 0.6 being a common value. The period of one oscillation is roughly:

**t = - RC x 1n[(1 - η) / (1 - Vv/Vs)]**

where ‘1n’ indicates natural logarithm usage. Considering standard values, Vs = 6, Vv = 2, and **η** = 0.6, the above equation simplifies to:

**t = RC x 1n(0.6)**

Since capacitor charging is incremental, the sawtooth 's increasing slope isn't linear. To many Audio applications, this barely matters. The Figure (b) demonstrates the charging capacitor via a constant-current circuit. This enables the slope going straight up.

The capacitor's charge rate is now constant, independent from Vs, although Vs still influences the peak point. Since the current is dependent on transistor gain, there is no simple formula for frequency measurement. This circuit is designed to work with low frequencies, and has implementations as a ramp generator.

#### Using LF353 op amps

Two op amps are used to construct a precise square wave and triangle wave generator circuit. The LF353 set includes two JFET op amps which are best suited for this application.

The output signal frequencies are calculated by the formula ** f=1 / RC**. The circuit shows an extremely wide operating range with hardly any distortion.

R may have any value between 330 Ohm and around 4.7 M; C can be of any value from around 220pF to 2uF.

Just like the above concept, two op amps are used in the next sine wave an cosine wave function generator circuit.

They generate nearly identical frequency sine wave signals but 90 ° out of phase, and therefore output of the second op amp is termed as a cosine wave.

Frequency is affected by the collection of acceptable R and C values. R is in the 220k to 10 M range; C is between 39pF and 22nF. The connection between R, C and/or is a bit complex, as it must reflect the values of other resistors and capacitors.

Use R = 220k and C = 18nF as an initial point that provides a frequency of 250Hz. The Zener diodes can be low power output diodes of 3.9V or 4.7V.

## Leave a Reply