# Triangular-Wave Generator Uses a Single IC

Abstract: This application note outlines the implementation of a single-supply, triangular wave oscillator using the MAX9000 and some passive components. The application circuit uses an op amp, comparator, and a voltage reference as active building blocks. The MAX9000 is chosen because it integrates these three components.

## Introduction

The linearity of triangular waveforms makes triangular wave generators useful in many "sweep" circuits and test equipment. For example, switched-mode power supplies and induction motor-control circuits often use a triangular wave oscillator as part of the pulse width modulator (PWM) circuit. This article presents a compact, triangular wave oscillator using a single MAX9000 IC and some passive components. The MAX9000 device family integrates a high-speed operational amplifier, a high-speed comparator, and a precision bandgap reference.## Circuit Description

*Figure 1. Design concept for a basic triangular-wave generator.*

*Figure 2. A triangular wave generator using the MAX9000.*

**Figure 1**shows a basic triangular wave generator circuit.¹ It is comprised of two basic building blocks: an integrator to generate the triangular wave output, and a comparator with external hysteresis (Schmitt trigger) to set the amplitude of the triangular wave as desired.

The op amp is configured as an integrator to provide the triangular output. This approach is based on the simple fact that integration of a constant voltage results in a linear ramp. The integrator's output is fed back to its inverting input by a Schmitt trigger. The input threshold voltages of the Schmitt trigger are designed to change state corresponding to the desired peak voltages of the triangular wave output.

There is a drawback to the circuit in Figure 1: the peaks of the triangular wave can only be symmetrical about the reference voltage applied to the comparator's inverting input. To generate a triangular wave from 0.5V to 4.5V, for example, a reference voltage of (0.5V + 4.5V)/2 = 2.5V is needed. Since a standard bandgap reference has an output voltage of 1.23V, it would be preferable if the voltage range of the triangular wave could be set independent of the bandgap reference. This flexibility is achieved by adding resistor R3 to the hysteresis network, as illustrated in

**Figure 2**where the circuit uses the MAX9000. Resistor R3 enables the peaks of the triangular wave to be set independent of the reference voltage.

## Design Considerations

### Step 1. Build the "Trigger-Happy" Comparator (Schmitt Trigger Design)

**a) Select R2**

The input bias current at CIN+ of the comparator is less than 80nA. To minimize errors caused by the input bias current, the current through R2 should be at least 8µA. Current through R2 is (V

_{REF}- V

_{OUT})/R2. Considering the two possible output states to solve for R2, two formulas result:

R2 = V

_{REF}/I

_{R2}

And:

R2 = [(V

_{DD}- V

_{REF})/I

_{R2}]

Use the smaller of the two resulting resistor values. For example, with V

_{DD}= 5V, V

_{REF}= 1.23V, and I

_{R2}= 8µA, the two values of R2 are 471.25kΩ and 153.75kΩ. Therefore, for R2 choose the standard value of 154kΩ.

**b) Select R1 and R3**

During the rising ramp of the triangular wave, the comparator's output is tripped low (V

_{SS}). Similarly, the falling ramp requires the comparator's output to be at logic high (V

_{DD}). That is, the comparator must change state corresponding to the required peak and valley points of the triangular wave. Applying nodal analysis at the noninverting input of the comparator and solving for these two thresholds, gives the following simultaneous equations:

In this example, the voltage range of the triangular wave is from 0.5V to 4.5V. Hence substituting V

_{IH}= 4.5V, V

_{IL}= 0.5V, V

_{DD}= 5V, and V

_{REF}= 1.23V yields R1 = 124kΩ and R3 = 66.5kΩ.

### Step 2. Make a Clean Sweep (Integrator Design)

Considering the two possible output states of the comparator, the magnitude of the current flowing through the resistor R4 is given as:I

_{R4}= (V

_{DD}- V

_{REF})/R4

And:

I

_{R4}= V

_{REF}/R4

The maximum input bias current of the op amp is 2nA. Therefore, to minimize errors the current through R4 must always be greater than 0.2µA. This constraint implies that:

R4 < 6.12MΩ

The frequency of the triangular waveform is given as:

For this example, choose f = 25kHz, V

_{OUT},

_{P-P}= 4V (for a 0.5V to 4.5V triangular wave), and V

_{REF}= 1.23V. This gives the time constant as R4 × C = 9.27µs. Select C = 220pF and R4 = 42.2kΩ.

### Step 3. Look Before You Leap

The resulting output will match the designed frequency, if the op amp is not slew limited. Since the feedback capacitor charges (or discharges) at a constant current, the maximum rate of change of output signal is:Recognizing process variations, the op amp must have a typical slew rate 40% higher than the output signal's maximum rate of change, at least 0.56V/µs in this case. Referring to the MAX9000's data sheet, the slew rate of the op amp is 0.85V/µs which is adequate for the 25kHz waveform.

## Results

Figure 3 plots the output waveform of the circuit in Figure 2.*Figure 3. Output waveform for the triangular wave circuit in Figure 2.*

**References**

¹ Terrell, David L., "Opamps: Design, Application and Troubleshooting," ISBN 0-7506-9702-4.