[sci.electronics] Square to Sawtooth

rohlf@unc.cs.unc.edu (John Rohlf) (03/29/89)

		Given an externally generated square wave of varying 
	frequency(audio range) and varying amplitude, what is the best/
	easiest way of converting it to a sawtooth of the same frequency
	and amplitude? 

jewett@hpl-opus.HP.COM (Bob Jewett) (03/30/89)

> 		Given an externally generated square wave of varying 
> 	frequency(audio range) and varying amplitude, what is the best/
> 	easiest way of converting it to a sawtooth of the same frequency
> 	and amplitude? 

One solution:

Find a VCO that has a unit-amplitude sawtooth as an auxiliary output.
Phase lock the VCO to the input square wave.  To get the amplitude
right, full-wave rectify the square wave and apply the result and the
sawtooth to an analog multiplier.

till@lucid.com (Don Tillman) (03/30/89)

   From: rohlf@unc.cs.unc.edu (John Rohlf)
   Date: 28 Mar 89 23:08:54 GMT

   Given an externally generated square wave of varying 
   frequency(audio range) and varying amplitude, what is the best/
   easiest way of converting it to a sawtooth of the same frequency
   and amplitude? 

Have a ramp preset to the square wave's high voltage level at the
square wave's rising transition.  Slew the ramp down from that point.
Electrically adjust the slew rate so that the ramp crosses zero at the
square wave's falling transistion.  This could track correctly after a
cycle or two.

The ideas I threw out both involved generating a voltage proportional
to the square wave's frequency first: either use that voltage to
adjust the ramping rate from the square wave's high voltage or drive a
voltage controlled integrator.  Neither way is real accurate.

mark@motcsd.UUCP (Mark Jeghers) (03/30/89)

In article <7476@thorin.cs.unc.edu> rohlf@unc.cs.unc.edu (John Rohlf) writes:
>
>		Given an externally generated square wave of varying 
>	frequency(audio range) and varying amplitude, what is the best/
>	easiest way of converting it to a sawtooth of the same frequency
>	and amplitude? 

A couple of methods of varying complexity/quality/cost:

A. Simple capacitor discharge setup.  Load the square wave output with
   a diode and a capacitor (and maybe a small resistor) such that the
   cap charges more or less instantaneously and discharges slowly.  The
   problem is that the quality is low and it works over a small range
   of frequencies.

B. A more complex version of "A", using a transistor to control the discharge
   rate of the cap.  Use the transistor as a "throttle", varying the discharge
   rate in inverse proportion to the frequency.  Complications: you must have
   a voltage or current available that varies with the frequency, also, I don't
   recall the exact wiring of the parts to achieve this effect.

C. The D/A approach.  Start with a square wave many octaves higher than what
   you want as your output.  Feed it to a binary counter, 7 or 8 bits wide
   for instance.  Feed that to an A/D converter and sawtooth will be output.
   It will contain staircases which can be filtered out.  Using more bits
   will reduce the staircases in size, but also require a higher initial
   frequency.  A square wave whose frequency matches the sawtooth can be
   taken directly off the lowest frequency bit of the binary counter.

Corrections/expansions/comments upon this are welcome.

Mark Jeghers
Motorola Computer Systems

henry@utzoo.uucp (Henry Spencer) (03/31/89)

In article <65200002@hpl-opus.HP.COM> jewett@hpl-opus.HP.COM (Bob Jewett) writes:
>Find a VCO that has a unit-amplitude sawtooth as an auxiliary output.

It's trivial to build such a thing, by the way:  an integrator integrating
the input, a comparator for "reached the top", and a one-shot feeding an
analog switch to reset the integrator.
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

strong@tc.fluke.COM (Norm Strong) (04/01/89)

In article <1989Mar30.164612.28073@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
}In article <65200002@hpl-opus.HP.COM> jewett@hpl-opus.HP.COM (Bob Jewett) writes:
}>Find a VCO that has a unit-amplitude sawtooth as an auxiliary output.
}
}It's trivial to build such a thing, by the way:  an integrator integrating
}the input, a comparator for "reached the top", and a one-shot feeding an
}analog switch to reset the integrator.

Yes, the problem is trivial as stated.  Let's see if we can make it more
interesting:

	How would you make the circuit so that the sawtooth starts at zero on
the leading edge of the square wave, and reaches maximum just as the square
wave falls.  Let this be a steady state repetitive waveform.  Manual
adjustments are not permitted.  

Now, isn't that more interesting?
-- 

Norm   (strong@tc.fluke.com)

henry@utzoo.uucp (Henry Spencer) (04/02/89)

In article <7518@fluke.COM> strong@tc.fluke.COM (Norm Strong) writes:
>}>Find a VCO that has a unit-amplitude sawtooth as an auxiliary output.
>}
>}It's trivial to build such a thing, by the way:  an integrator integrating
>}the input, a comparator for "reached the top", and a one-shot feeding an
>}analog switch to reset the integrator.
>
>	How would you make the circuit so that the sawtooth starts at zero on
>the leading edge of the square wave, and reaches maximum just as the square
>wave falls.  Let this be a steady state repetitive waveform.  Manual
>adjustments are not permitted.  
>
>Now, isn't that more interesting?

No, not very, actually:  this is what phase-locked loops are for.  Barring
unusual situations like very high frequencies, a $5 4046 kills this problem
dead.  (Why do you think I was building a sawtooth VCO?)  Sometimes you need
a bit of ingenuity in the surrounding circuitry to get the details right,
but automatically synchronizing a generated waveform with an external one
is basically a solved problem.  Getting the amplitude to match is actually
the hardest part of the original problem.

The advent of one-chip phase-locked loops, analog switches, and high-quality
op amps has reduced a lot of such analog signal-processing problems to
trivialities.  It only gets sticky when the cheap, convenient chips are
ruled out by demanding requirements like very high speed or very high
precision.
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu