Archive of the former Yahoo!Groups mailing list: MOTM

previous by date index next by date
  topic list next in topic

Subject: Re: Anderton PWM (pulse to triangle)

From: The Old Crow <oldcrow@...
Date: 1999-11-02

On Tue, 2 Nov 1999, Thomas Hudson wrote:

> Can you give more details about how this is done. I'm not an
> electronics whiz, but I have a project where I would like to
> convert pulses to triangles.

The best example is to look at a simple LFO circuit that provides pulse
and triangles waveforms, such as this one I selected at random from the

This circuit has two sections, a "comparator" and an "integrator".
If you remember calculus classes, then integration should at least sound
familiar. (A comparator can also be considered a differentiator with no
"interval" between points (series cap C=0), for those who have dealt with
the math).

Differentiation is essentially taking a sum value of parameter/variable
apart to find the rate-of-change between the (numeric) parts. Integration
is essentially taking a bunch of individual numeric "parts" and summing
them together over a range. These two principles are the complement of
each other.

Now, how does helps us in the synth world:

Looking at the schematic, note that the author provided two
LFOs-on-one-quad op-amp. Either one suits this explanation. I'll talk
about the "upper" circuit.

The op-amp on the left is the basic integrator. what it does is average
the change in voltage over a period of time by storing the "instantaneous"
value of the voltage on the capacitor and feeding it back to the input to
be added to the next "instantaneous" voltage. Since integration is the
summation of all intervals in a range, by definition this circuit is an

Here is what that integrator sees during a single input period T at some
frequency, say, 1Hz.

+V t=0 _______t=T=1 __t=0 t=T=1 second
| --__
0V | --__
_______| --__
Input (pin 6) Output (pin 7)

Notice that the output goes ∗negative∗ because the postitive-going input
is going to the negative (inverting) op-amp terminal. Remember this.
(AC circuit analysis says that one of the conditions for the above
grpahs to be valid is that the circuit has been running a "long time";
e.g., we're not looking at the power-up state. Pretend this LFO has
been running for 10 seconds).

The thing to observe here is that even though input square wave cycle
has a sharp step halfway through, the output is the ∗average∗ of every
input that can be summed up between t=0 and t=T. This is how a voltage
ramp is created.

Now, to get the integrator to reverse the slope and complete the
triangle, something is needed to change the sign of the value being fed
into the integrator. This is what the comparator is for. The comparator
is the op-amp on the right side of the circuit diagram. This op-amp
compares the ramp from the integrator with zero volts (see the + input
connected to ground? --zero volts) and each time the ramp goes above zero,
it causes the comparator output to go to a postive voltage. This is what
creates the negative-going ramp as seen above.

Now here is the trick: This positive voltage goes back to the MINUS
input of the integrator, which means that the integrator is generates a
down-ramp. Eventually, this down-ramp voltage will go below zero. When
the comparator sees this drop below zero, its output changes quickly to a
negative voltage. The negative voltage goes back to the integrator just
like the positive voltage did, but remember, it is going into the minus

Two minuses make a plus, so now the integrator does this:

+V _______ t=T t=0 __ t=T
t=0 | __--
0V | __--
| __--
-V |_______ --

The two outputs end up strung together: /\/\/\/\/

The side benefit is that the comparator is generating square waves at
the same rate: __--__--__--__--

Extra info: the "rate" control sets how much voltage is allowed back to
the intergrator to be changed into triangles. This change rate of
integration for a given cycle.

The diode and voltage divider resistor create a square wave output in
the range of 0~5V.

There are other caveats to consider when conveeting pulses to triangles,
such as that an integrator is also a 1st-order low-pass filter.

Hope this helps,