Sawtooth and triangle pulses (How to?)

Thread Starter

ChrisChemist116

Joined Mar 13, 2009
79
Howdy

I have seen many oscillator circuits out there, from the eponymous 555 to the well known CMOS using inverters resistors and capacitors and of course with op amps. However i seen most of them deal with square pulses.

How about making triangle waves and sawtooth. How can i make triangle and sawtooth generators using only CMOS?.:confused:

I attached an example made with 4049. The only one i found on my book.:)

 

Wendy

Joined Mar 24, 2008
23,421
It can be done, but you need a constant current source to work with the square wave. Op amp integrators do this extremely well. So do transistors.
 

SgtWookie

Joined Jul 17, 2007
22,230
Have a look at the attached. It's using a CD4516 synchronous up/down counter to drive an R2R ladder. The output is an approximation of a triangle wave; you can cascade more 4516's to achieve smaller steps, and use an RC filter on the output to improve it further.

See Wiki's resistor ladder article: http://en.wikipedia.org/wiki/Resistor_ladder

A 4093 quad Schmitt-trigger NAND is shown used to generate the clock pulse. VR1 adjusts the speed of the clock. R1 limits the maximum output current of the 4093 to a safe level. The 2nd gate acts as a buffer, but it really isn't necessary.

All inputs of the two unused 4093 NAND gates must be grounded or tied to Vdd.

The output signal will be very low-current. You will need to use some kind of a buffer or fast voltage follower circuit.

[eta]
The 2nd schematic has 256 steps instead of the previous 16 steps. You can see the improvement in the shape of the waveform, however you start running into speed limitations due to how fast you have to clock it to get one complete cycle.
 

Attachments

Last edited:
If you feed a square wave into a cpapacative load with a serees resistor and look at the output at the junction of the two you will be more or less there.
I'm not saying you cant do it more accuratly with some complex controls, it would depend just how accurate the waveform has to be.
Have you checked the tutorials on this site .... I will be suprised if there isnt anything there that demonstrates the concept.

You can also use the cap voltage to feed the amp that spawns it, add a little historeesis and 1 opamp can oscilate with sawtoth wave at one of its inputs and a square wave at its output (Exactly how a 555 works as it happens)

my post on generator control demonstrates the concept but would be improved if a bipolar opamp were used which would elliminate the need for a pullup and make the output symetrical.

Al
 

Wendy

Joined Mar 24, 2008
23,421
I've been thinking about how to linearize a 555 sawtooth. I can make a very good sawtooth, but not a triangle using current mirrors (another constant current source). Two diodes and two current mirrors perhaps?
 

ELECTRONERD

Joined May 26, 2009
1,147
You could put a square wave into the input of a op-amp integrator; that will produce a sawtooth wave. Thus, if you want a square wave you can directly connect to the output of a 555 timer (or other square wave circuit), or you can connect to the output of the integrator if you would like to have a sawtooth wave.
 

Potato Pudding

Joined Jun 11, 2010
688
A triangle is created by charging and discharging a capacitor at constant current. Needing to do that with logic ICs is what makes this tricky.

The simplest answer really is to just use a couple of transistors.
 
I think I have sawtooth and triangle mixed up ... Oooops

If sawtooth has a vertical edge and a ramp then what I said earlier is entirly incorect because I was actually talking about a triangle, two ramps.

I am wrong arnt I ...
In my previous post i said [1 opamp can oscilate with sawtoth wave] |\|\|\|\|\
when what I meant was [1 opamp can oscilate with triangle wave] /\/\/\/\/

Sorry :-(

And whilst I am on the subject of me being wrong, I have to come clean.
I had assumed that a cap charged via a resistor from a constant voltage would present a linear voltage rise at the cap/res junction.
However thinking about the info in this thread has made me realise that as the cap charges its voltage increese will decrease the rate of charge and the opersit will happen during discharge. which is why those who know are talking about current sources.

Another silly mistake .... Ah well

Al (Feeling a little silly)
 

Potato Pudding

Joined Jun 11, 2010
688
You are not really wrong.

The Op Amp method is very very common. The trick is that you use a low range of hysterisis so that the charge and discharge is across a narrow range and changes in current are very small.

The downside is that you are talking about creating a smaller signal in order to reduce the nonlinearity.

The trick is that you use something like a Quad Op Amp. That makes it possible to have a square wave, triangle wave and sine wave, and an adjusted gain amplifier stage that can make the small signal as big as you want it to be.

And the ramp can be hacked from a triangle op amp circuit by using asymmetric parallel resistance values a high value for the gradual ramp and a low value for the discharge which is in series with a diode. It is simple in theory but the duty cycle and other tuning requirements can make it a little bit tricky. Not so much that you can't just play with it to make it work within a reasonable time.
 

SgtWookie

Joined Jul 17, 2007
22,230

SgtWookie

Joined Jul 17, 2007
22,230
Ignore the reference to the MAX038 on that page; it was a fantastic signal generator, but the factory which made it was destroyed by a natural disaster, and the supply has long since been used up.

The other linear signal generator IC's are all but gone, too.

Everything serious is digital nowadays. You can create any arbitrary waveform instantly by just feeding a DAC with RAM, and clocking through however many bits of resolution and accuracy that you need.

BTW, the circuits I posted could be modified to produce a true triangle wave; use the carry/borrow output to clock a D-type FF wired with Q\ to D in, and Q to the U/D inputs of the counters.
 
Last edited:

Wendy

Joined Mar 24, 2008
23,421
Bill, that's been done before.
Here are a couple of links:
http://www.allaboutcircuits.com/vol_6/chpt_6/8.html
http://forum.allaboutcircuits.com/showthread.php?t=31688

There are many more threads like the last one.
Those were all sawtooths. I've made triangle waves using 555/op amps, but that wasn't the goal. A true triangle requires a constant current source that swings both ways, such as an op amp.

I've put some thought into bidirectional stand alone current regulators. It can be done, but the parts count is not good.
 

SgtWookie

Joined Jul 17, 2007
22,230
I see, Bill.

Anyway, I've attached a simulation of what I was talking about in my last post. You can take the input to U_D from either Q or Q\, it really doesn't make a lot of difference, but as you can see, the output is a pretty decent triangle wave. [eta] As shown, there are 128 steps resolution (7 bits) due to the way the terminal count is handled; it could be increased to 8 bits by adding more logic.

Of course, the accuracy of the wave depends on the resistors' tolerance; if they aren't dead-accurate, your output will suffer. That's why it's easier to use a hardware DAC, as the resistors are trimmed internally.
 

Attachments

Last edited:

Thread Starter

ChrisChemist116

Joined Mar 13, 2009
79
First i would like to thank everyone to give me their valuable suggestions to my answer. I will try to be brief to answer some comments given.

Have a look at the attached. It's using a CD4516 synchronous up/down counter to drive an R2R ladder. The output is an approximation of a triangle wave; you can cascade more 4516's to achieve smaller steps, and use an RC filter on the output to improve it further.

See Wiki's resistor ladder article: http://en.wikipedia.org/wiki/Resistor_ladder

A 4093 quad Schmitt-trigger NAND is shown used to generate the clock pulse. VR1 adjusts the speed of the clock. R1 limits the maximum output current of the 4093 to a safe level. The 2nd gate acts as a buffer, but it really isn't necessary.

All inputs of the two unused 4093 NAND gates must be grounded or tied to Vdd.

The output signal will be very low-current. You will need to use some kind of a buffer or fast voltage follower circuit.

[eta]
The 2nd schematic has 256 steps instead of the previous 16 steps. You can see the improvement in the shape of the waveform, however you start running into speed limitations due to how fast you have to clock it to get one complete cycle.
I have seen your simulation through LTSpice, and it seems work fine as well in Labcenter's proteus. But as you mentioned the cascade it is not too smooth. (As it is a ladder in a digital to analog mode). I hope this part i am right.

If RC filter is to be added, where should be in the circuit provided?. I think as far as you did it looks pretty well to me. How do you calculate the frequency of the oscillator?.
To me 4516 and 4093 is quite a good option using only CMOS.

I seen the talk has moved from using OP Amps to function generators.

In my previous post i said [1 opamp can oscilate with sawtoth wave] |\|\|\|\|\
when what I meant was [1 opamp can oscilate with triangle wave] /\/\/\/\/
Sorry :-(
And whilst I am on the subject of me being wrong, I have to come clean.
To...
You are not really wrong.

The Op Amp method is very very common. The trick is that you use a low range of hysterisis so that the charge and discharge is across a narrow range and changes in current are very small.

The downside is that you are talking about creating a smaller signal in order to reduce the nonlinearity. ...
And being compared to ...
Bill, that's been done before.
Here are a couple of links:
http://www.allaboutcircuits.com/vol_6/chpt_6/8.html
http://forum.allaboutcircuits.com/showthread.php?t=31688

There are many more threads like the last one.
And expanded to function generators...

The Exar XR2206 function generator IC is still being made and is available at a few parts distributors.
And going back and forth to the eponymous 555

I've been thinking about how to linearize a 555 sawtooth. I can make a very good sawtooth, but not a triangle using current mirrors (another constant current source). Two diodes and two current mirrors perhaps?
You could put a square wave into the input of a op-amp integrator; that will produce a sawtooth wave. Thus, if you want a square wave you can directly connect to the output of a 555 timer (or other square wave circuit), or you can connect to the output of the integrator if you would like to have a sawtooth wave.
But actually my point was how to do this project using CMOS, which i feel was answered by sarge.

However it seems the other options are quite interesting to me as well.

Ah... i will skip the MAX038 reference, thanks Sarge.

Ignore the reference to the MAX038 on that page; it was a fantastic signal generator, but the factory which made it was destroyed by a natural disaster, and the supply has long since been used up...
I've seen your last simulation, which does generate triangle waves. How do you calculate the frequency?.
 

SgtWookie

Joined Jul 17, 2007
22,230
http://www.national.com/ds/CD/CD4093BC.pdf
See page 4.
For values of Vt+ and Vt-, see the table on page 3. It varies over temp, and between batches.

If you want the frequency to be reasonably accurate, then use an oven controlled crystal oscillator.

Note that the output will have a very high impedance. You won't be able to do much with it except drive the input of a very high impedance buffer.
 
Top