Maker Pro
Maker Pro

Simple but precise ramp/triangle generator

T

Tilmann Reh

Hello,

I am looking for a simple but reasonably precise ramp (sawtooth)
or triangle generator. It is intended as part of a PWM circuit that
must output constantly OFF for low input voltages and constantly ON
for an input voltage of 5 V.

Specs so far: frequency is about 50 kHz, single supply (5V and 12V
available). Oh, and it must be cheap and built from commonly available
parts, and should not need any adjustment.

I have been trying the "precision triangle generator" of National's
LB-23 with a TLC272 as OP and the LM393 as comparator, with treshold
voltages of 0.2 and 4.8 V. It works ok, however the TLC272 is far too
slow to correctly change the integration direction at the lower
treshold (output very near to negative supply) - at least at 50 kHz...
So the lower edge of the triangle is massively distorted and the signal
not usable in this application.

Other "cheap and common" but faster OPs lack the required output swing
(must be close to the negative supply rail). Modern OPs like the LM6132
are rather expensive...

I also have looked at complete ICs that contain oscillator and/or PWM
comparator (like SG3524, TL494, TL5001, NE555 etc.) - but they all lack
the required precision of oscillator amplitude and thus would require
adjustment. (They are good only in closed loops.)

Any hints welcome, be it fast but common and cheap OPs suitable for this
application, or complete different methods of generating such a ramp or
triangle waveform (or a reliable 0..100% PWM signal for 0..5 V input).

Thanks,
 
M

mike

Tilmann said:
Hello,

I am looking for a simple but reasonably precise ramp (sawtooth)
or triangle generator. It is intended as part of a PWM circuit that
must output constantly OFF for low input voltages and constantly ON
for an input voltage of 5 V.

Specs so far: frequency is about 50 kHz, single supply (5V and 12V
available). Oh, and it must be cheap and built from commonly available
parts, and should not need any adjustment.

As with most "simple questions", the devil is in the details.
It's hard to deal with specifications like "reasonably precise".
"cheap", "low voltages", etc.

As a general rule, these things are hard:
1) generating anything analog that has to go near zero or either supply
voltage.
generating any pulse width that has to go all the way to zero or 100% df.
2) triangles. Yeah, a crummy triangle is easy. A very good triangle
is much harder.
3) sensing triangle values near min or max.

Don't know your application, but I don't think you'll ever be happy
generating a pwm signal that is well behaved near 0 and 1 from a
triangle and comparator.

If your application allows, suggest you rethink the problem and use
digital means (PIC processor comes to mind) or use two comparators to
compare points on the triangle that are NOT near min and max.

Think about two triangles out of phase.
mike
I have been trying the "precision triangle generator" of National's
LB-23 with a TLC272 as OP and the LM393 as comparator, with treshold
voltages of 0.2 and 4.8 V. It works ok, however the TLC272 is far too
slow to correctly change the integration direction at the lower
treshold (output very near to negative supply) - at least at 50 kHz...
So the lower edge of the triangle is massively distorted and the signal
not usable in this application.

Other "cheap and common" but faster OPs lack the required output swing
(must be close to the negative supply rail). Modern OPs like the LM6132
are rather expensive...

I also have looked at complete ICs that contain oscillator and/or PWM
comparator (like SG3524, TL494, TL5001, NE555 etc.) - but they all lack
the required precision of oscillator amplitude and thus would require
adjustment. (They are good only in closed loops.)

Any hints welcome, be it fast but common and cheap OPs suitable for this
application, or complete different methods of generating such a ramp or
triangle waveform (or a reliable 0..100% PWM signal for 0..5 V input).

Thanks,



--
Return address is VALID.
Wanted, 12.1" LCD for Gateway Solo 5300. Samsung LT121SU-121
Bunch of stuff For Sale and Wanted at the link below.
Compaq Aero floppy,ram,battery.
MINT HP-41CV, 2-METER AMPS, 200CH SCANNER
http://www.geocities.com/SiliconValley/Monitor/4710/
 
J

Joerg

Hi Tilmann,

The only pretty sawtooths that I designed were all consisting of a
current source and a very good film capacitor. For the current source a
simple two-transistor setup would work.

Sensing was through a fast comparator and the reset I did with a FET
such as the BSS123, or BSS84 if you go in the other direction. Parts
cost was under $1 with the bulk of that being the cost of the film
capacitor.

Regards, Joerg
 
S

Spehro Pefhany

Hi Tilmann,

The only pretty sawtooths that I designed were all consisting of a
current source and a very good film capacitor. For the current source a
simple two-transistor setup would work.

Sensing was through a fast comparator and the reset I did with a FET
such as the BSS123, or BSS84 if you go in the other direction. Parts
cost was under $1 with the bulk of that being the cost of the film
capacitor.

Regards, Joerg

I'd use a BJT current source and a capacitor and a comparator for a
50kHz sawtooth. The amplitude can be nice and stable, and I assume for
this application you don't care if the frequency varies a bit, so a
ceramic cap would work.

Best regards,
Spehro Pefhany
 
J

Joerg

Hi Spehro,
... and I assume for this application you don't care if the frequency varies a bit, so a
ceramic cap would work.
It would but the new ECH Panasonic series SMT film caps are nowadays
below 50 cents so a lil' luxury won't hurt. Those yield a nice clean and
low noise ramp.

Regards, Joerg
 
T

Tom Bruhns

As you note, things get difficult as you get very close to the supply
rails. Why not simply use a resistive divider to rescale the input
to, say, 1.0V to 4.0V, and use a sawtooth that goes between those
limits? Or...generate a negative supply (perhaps the sawtooth
generator can also generate the supply...), so the op amp doesn't need
to operate so close to the rail.

Cheers,
Tom
 
K

Ken Smith

Hi Spehro,

It would but the new ECH Panasonic series SMT film caps are nowadays
below 50 cents so a lil' luxury won't hurt. Those yield a nice clean and
low noise ramp.

I've had much too high of a failure rate on the SMT film caps. I'd
recomend SMT NPO ceramic caps.
 
K

Ken Smith

Tilmann Reh said:
slow to correctly change the integration direction at the lower
treshold (output very near to negative supply) - at least at 50 kHz...

How about:

Make your ramp at some higher voltage and use an RC circuit to level shift
it down so the negative peak is at the negative supply.
 
J

Joerg

Hi Ken,
I've had much too high of a failure rate on the SMT film caps. I'd
recomend SMT NPO ceramic caps.
So far I haven't seen problems with film. What happened in your cases?
Failure due to reflow solder stresses? Or did they degrade later?

NPO is very expensive when you need large values. But X7R isn't bad
either except for tolerance. Tilmann's application may not be so
critical in this respect.

Regards, Joerg
 
K

Ken Smith

Hi Ken,

So far I haven't seen problems with film. What happened in your cases?
Failure due to reflow solder stresses? Or did they degrade later?

These were 1% film caps. I did a check on a sample of the parts to make
sure they really were 1%

This is from memory:

After soldering something like 5% of the parts were well under the spec
value. I assume this was because of the reflow. It was the only part we
saw a problem on in that board.

Of the ones that were still good: Some of them died in the vibration test.
Some died after getting to the customers.

If we had to reheat the board to rework some other part the film caps
would likely fail.

You have to be careful about what chemicals get near the board too.

NPO is very expensive when you need large values. But X7R isn't bad
either except for tolerance. Tilmann's application may not be so
critical in this respect.

If you really want to make a constant amplitude and constant frequency,
there are tricks where you servo the current to get just exactly the right
swing and base the timing on a XTAL.
 
J

Joerg

Hi Ken,
These were 1% film caps. I did a check on a sample of the parts to make
sure they really were 1%

This is from memory:

After soldering something like 5% of the parts were well under the spec
value. I assume this was because of the reflow. It was the only part we
saw a problem on in that board.

Of the ones that were still good: Some of them died in the vibration test.
Some died after getting to the customers.

If we had to reheat the board to rework some other part the film caps
would likely fail.

You have to be careful about what chemicals get near the board too.
Thanks for the info, Ken.
If you really want to make a constant amplitude and constant frequency,
there are tricks where you servo the current to get just exactly the right
swing and base the timing on a XTAL.
Then there is another but after I did that I felt I had pounded in a
thumbtack with a sledge hammer: A clock, a counter that just keeps going
round-robin (overflow at the end and start over), followed by a DAC-08,
and a low pass after that. Nice ramp. Cheap, but it felt like cheating.

Regards, Joerg
 
L

legg

Hello,

I am looking for a simple but reasonably precise ramp (sawtooth)
or triangle generator. It is intended as part of a PWM circuit that
must output constantly OFF for low input voltages and constantly ON
for an input voltage of 5 V.

It doesn't matter how well behaved the ramp and comparator are, the
will always be a discontinuity at the extremes. This is created by
non-zero delays from the control point through to the power train
functioning with real components and the tendency of this nonlinearity
to produce cycle skipping.

The condition is loosely chaotic, but as all known conditions are
typically non-destructive, providing linear operation of switches is
avoided, it's a matter of lumping it, in an imperfect world.

RL
 
T

Tilmann Reh

Tom said:
As you note, things get difficult as you get very close to the supply
rails. Why not simply use a resistive divider to rescale the input
to, say, 1.0V to 4.0V, and use a sawtooth that goes between those
limits?

I also thought about that. Maybe, if I don't find a satisfying solution
to the oscillator problem, I will do it that way. It will be a
disadvantage that with open input the output will not be constantly
OFF, but I can probably deal with that. And tolerances of the
resistor networks might become an issue - I will have to carefully
calculate the extremes.
Or...generate a negative supply (perhaps the sawtooth
generator can also generate the supply...), so the op amp doesn't need
to operate so close to the rail.

I don't like that method... The complete circuit is single supply.

Thanks,
 
T

Tilmann Reh

Joerg said:
I'd use a BJT current source and a capacitor and a comparator for a
50kHz sawtooth. The amplitude can be nice and stable, and I assume for
this application you don't care if the frequency varies a bit, so a
ceramic cap would work.

The linearity of the ramp or triangle is not too critical, also the
frequency might be off 10% or so. So I don't need "good" caps.
A cheap film or NPO cap (THT, by the way) will surely do.

When using a current source (standard 2 BJT type) to charge a cap,
and a comparator to discharge it, the lower treshold will be
determined by the comparator hysteresis. The cap will not be
(almost) completely discharged, unless you add circuitry to
ensure that (constant time discharging pulse, or the like).
This again will make the circuit more complicated.

Maybe I can delay the comparator output after discharging by a small
cap (with an open collector output, that should work) to make sure
the integrating cap gets completely discharged. Will have to try
that...

Thanks,
 
B

Ban

Tilmann said:
The linearity of the ramp or triangle is not too critical, also the
frequency might be off 10% or so. So I don't need "good" caps.
A cheap film or NPO cap (THT, by the way) will surely do.

When using a current source (standard 2 BJT type) to charge a cap,
and a comparator to discharge it, the lower treshold will be
determined by the comparator hysteresis. The cap will not be
(almost) completely discharged, unless you add circuitry to
ensure that (constant time discharging pulse, or the like).
This again will make the circuit more complicated.

Maybe I can delay the comparator output after discharging by a small
cap (with an open collector output, that should work) to make sure
the integrating cap gets completely discharged. Will have to try
that...

Thanks,

Here is some circuit, where the cap is charged/discharged from 1.25V to
3.75V and the resulting triangle wave is amplified by another opamp. The
variable resistor sets the frequency. fine trimming the 330R in the current
sources can adjust the symmetry if needed. I just found that opamp-no. on my
drawing sheet and didn't read the datasheet, should be a rail to rail output
type.

+---------------+-----------+--------------+--------o +5V
| | | |
.-. .-. .-. |
| |330 330| | | | .-.
| | | | | |100k | |
'-' '-' '-' 20k| |
| | | '-'
| 2N2904 |< | |
|-+---------| | |
/| | |\ | |
| | | | |6762
+---+ | | square out | |\
| | +--|<-+->|-+------)--------------)-|+\ triangle out
.-. | | 1N4148 | | o | | >--+--o
| |<-+ | | | | +-|-/ |
| |5k +----------)------)----------+ | |/ .-.
'-' | | | 6762 | | | |
| | 1N4148 | | |\ | | | |10k
| +->|-+--|<-+------)----|-\ | | '-'
+---+ | | | | >--+ | |
| | | | +----|+/ | +-------+
\| | |/ | | |/ | |
|-+--------| | | ___ | |
<| 2N2902 |> | +---|___|--+ .-.
| | | | 100k | |
.-. .-. | .-. 20k| |
| | | | --- | |100k '-'
| |330 330| | --- | | |
'-' '-' |22n '-' |
| | | | |
+--------------+-----+------+--------------+----+----o GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de
 
F

Frithiof Andreas Jensen

Tilmann Reh said:
Hello,

I am looking for a simple but reasonably precise ramp (sawtooth)
or triangle generator. It is intended as part of a PWM circuit that
must output constantly OFF for low input voltages and constantly ON
for an input voltage of 5 V.

Why not use one of the many dedicated PWM controller IC's?
 
T

Tilmann Reh

Frithiof said:
Why not use one of the many dedicated PWM controller IC's?

Not suitable for open loop applications (see the related paragraph
in my first post). Most of them also don't allow 100% ON.
 
J

Jeff

Ken Smith said:
How about:

Make your ramp at some higher voltage and use an RC circuit to level shift
it down so the negative peak is at the negative supply.

Did that before. Works good.
 
J

Jeff

Then there is another but after I did that I felt I had pounded in a
thumbtack with a sledge hammer: A clock, a counter that just keeps going
round-robin (overflow at the end and start over), followed by a DAC-08,
and a low pass after that. Nice ramp. Cheap, but it felt like cheating.


Add some ROM with the address driven by the counter and DAC on the data
lines (cheap R 2R ladder in my case), and you can generate any waveform you
want! Did that once before using a AVR to replace a lot of stuff.
 
F

Fred Bloggs

Tilmann said:
Hello,

I am looking for a simple but reasonably precise ramp (sawtooth)
or triangle generator. It is intended as part of a PWM circuit that
must output constantly OFF for low input voltages and constantly ON
for an input voltage of 5 V.

Specs so far: frequency is about 50 kHz, single supply (5V and 12V
available). Oh, and it must be cheap and built from commonly available
parts, and should not need any adjustment.

Sounds like a 555 application to me-
 
Top