# Slow triangle wave

Discussion in 'The Projects Forum' started by wayneh, Aug 9, 2016.

1. ### wayneh Thread Starter Expert

Sep 9, 2010
12,391
3,246
This is a continuation of a thread I started last year. But it's a little more focused so I think it's better to start a new thread.

I need a triangle wave with a cycle time of ~30 seconds. I've developed a simulation of a standard op-amp circuit that does a nice job. But it requires a 68µF capacitor for the integrator and I don't think I can use a polarized capacitor for that. Sticking to non-polarized capacitors – usually 1µF or below – I can't get anywhere near 30 seconds.

Is there some other way to do this? Could I use the 2nd op-amp on the dual IC to help somehow? If it matters, a little bit of clipping to make a trapezoid would be fine but it needs to be nearly a triangle.

I have a 555 as the input to this. If using the timing cap voltage on the 555 would help, that's an option

2. ### #12 Expert

Nov 30, 2010
16,704
7,354
The way I see this is an op-amp square wave oscillator because the cap is connected to ground on one end. Then, either use an RC to make a capacitor charging slope or alternately turn on constant current generators to charge and discharge for a more linear ramp. A third way is to charge a capacitor to a small amount of the Vcc and Vee and get a pretty nice ramp from that, then amplify the ramp.

3. ### wayneh Thread Starter Expert

Sep 9, 2010
12,391
3,246
Well the last one is something I'm thinking of, amplifying the voltage on the 555's timing cap.

What this circuit is replacing is a big 1000µF cap in an RC tank. It works. Not only is it physically large, though, but when you go through too many RC intervals to get closer to the rails and get more time, it makes the wave shape not so much like a triangle. I'm looking for an alternative.

4. ### Sensacell Well-Known Member

Jun 19, 2012
1,184
277
30 seconds!
That's where leakage and drift start to kill you!

What does the triangle drive?
What are the accuracy requirements?
Begs for a DAC and a counter, or maybe a charge pump?
Both could be post-filtered to mitigate the voltage steps in between.

5. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
For a constant current charging ramp, ec=it. Starting with a 10 uF ceramic cap, and noting that a 30 second period means 15 seconds up and 15 seconds down,
9 V x 10 uF = i x 15 s
i = 9 uA
So, you need an opamp with input errors significantly less than 9 uA. I don't see any reason why the classic dual opamp integrator and comparator circuit can't do this, especially if you parallel 3 or 4 caps to get the charging current up. We use 10 uF 50 V ceramic caps in an SMT 1206 package in lots of circuits. Good part.

ak

6. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,047
295
My Wavetek function generator has no problems generating a perfect triangle wave at .004 Hz. These are selling dirt cheap on Ebay these days. I picked mine up at a local auction for under \$100...best investment I've made in a long time.

7. ### crutschow Expert

Mar 14, 2008
13,505
3,378
Below is the LTspice simulation of a relaxation oscillator triangle-wave generator that uses two switched, complementary current mirrors to charge and discharge a grounded capacitance, giving a low distortion triangle wave.
Grounding the capacitor means you can use a large polarized capacitor to get the long time constants needed for a 30s period without requiring extreme resistance values.
The op amps are in a quad package with RR input and output to give an output amplitude close to the rails.
U1 acts as a comparator with a large hysteresis, U2 act as a comparator to invert the signal, and U3 is a buffer-follower for the triangle output.
Note that the selected op amp has a maximum supply voltage of 5.5V.

• ###### Triangle Gen op amp RR LF.asc
File size:
2.9 KB
Views:
6
Last edited: Aug 10, 2016
Alec_t likes this.
8. ### wayneh Thread Starter Expert

Sep 9, 2010
12,391
3,246
This is what I'm leaning towards today.
The input, far left, is the voltage on a 555's timing cap. This is applied to the non-inverting pin of U6 used as a voltage follower, and then amplified ~3X by the second op-amp, U7.

9. ### wayneh Thread Starter Expert

Sep 9, 2010
12,391
3,246
The control pin of a 2nd 555 timer.
Low. It just needs to resemble a triangle
Too complex. I'm replacing an RC tank that uses a 1000µF capacitor. I want the solution to be smaller with minimal complexity.

My current solution shown above uses one IC and 5 resistors (one not shown, between the 555 and the first op-amp), which is not bad.

10. ### crutschow Expert

Mar 14, 2008
13,505
3,378
Or are you still looking for something better?

11. ### wayneh Thread Starter Expert

Sep 9, 2010
12,391
3,246
I wish the component count were lower, but the result is great. It uses about the same footprint as a big capacitor but has a lower profile and works a lot better.

12. ### Veracohr Well-Known Member

Jan 3, 2011
559
77
I found a 33uF bipolar electrolytic for my own current project, and it's not excessively expensive or anything. IIRC, it's made by Nichion and is series UWP, and may even have a higher capacitance in the series. The 33uF is available at Mouser.

wayneh likes this.
13. ### RichardO Well-Known Member

May 4, 2013
1,341
429
@wayneh If you feel this is a hijack then spin it off to another thread...

I know this is a little late to the fray but maybe someone will find to be useful or at least serve as food for thought.

This scheme uses mostly digital circuits to generate a low frequency. I uses no large timeing caps. Analog is dead.

The basic idea is to generate two frequencies very close together and then mix them to get the difference frequency.

The first circuit uses a CD4060B as an oscillator and reference frequency. The second counter uses the same clock but has an extra clock pulse added every time the counter overflows. The extra clock is made by delaying the MSB of the counter going low, differentiating it and then OR'ing it into the reference clock.

The outputs of the counters are mixed together using an exclusive OR gate. This is roughly equivant to RF mixing. The resulting difference frequency is low pass filtered to get the desired low frequency triangle wave.

There are a some problems with the circuit.
First, It takes a lot of discrete parts (resistorss, capacitors and diode) to create the extra pulse.
Second, The values of the R's and C's must be tailored to match the clock frequency and their values are critical to proper operation.
Third, the extra pulse forces the counter to run at more than twice the speed than is needed the rest of the time.

The second circuit corrects the weaknesses of the first circuit.

The modified clock is now made by using a pair of J-/K flip-flops in place of the R's and C's. This circuit is not frequency dependant.
The new circuit strips a clock pulse insteading of adding one so that the counter doesn't have wasted speed. This allows for a faster and/or smoother triangle wave.
A "left over" exclusive OR gate is used as an AND gate -- it works in this special case.

Some other notes:
Thanks to Alec_T I was able to simulate the circuit.

The simulation uses a CD4060B but a 74HC4060 would also work getting even faster, smoother triangle waves.

The clock frequency and output filter were somewhat arbitrarilly chosen just for simulation. Better values will need to be chosen for a specific triangle frequency.

The output will probably have to be buffered. An op-amp with rail-to-rail output would work best.

The circuit work in simulation but I have not done a rigorous analasys so there may be race conditions in the real world.

The simulations are done with a small frequency division by selecting the "Q5" outputs of the counters. This is to shorten the simulation time. In actual use, higher division Q outputs (probably Q12/Q13 or Q13/Q14) would be chosen.

wayneh likes this.
14. ### wayneh Thread Starter Expert

Sep 9, 2010
12,391
3,246
More than I need, but interesting.

Ironic that you say "analog is dead" and proceed to simulate a sine wave, which is a distinctly analog feature. The stuff inside electrical black boxes may be digital, but us out here in the real world are still quite analog.

15. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

ak

wayneh likes this.
16. ### RichardO Well-Known Member

May 4, 2013
1,341
429
I did not expect that you (or anyone) would actually build the circuit. I just had the idea and had to pass it on.

Triangle wave, actually. The simulation makes it look like a sine wave only because of the filtering. At larger clock frequency divisions the filter would not kill the peaks of the triangle because the clock frequency would be much higher than the triangle wave.

Yeah, but not a bit of analog until the last 2 parts (unless you count the oscillator components).

Here, here. Sooner or later there has to be input and output or the circuit doesn't do anything and might as well be in a welded shut, hermetically sealed box.

p.s. The entire circuit could be done using a 6-pin PIC microcontroller and the RC filter -- only 3 components.

17. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
Except for the R-C delay, the R-C differentiator/pulse former, and that pesky R-C hysteretic oscillator.
p.s. 4 components - gotta decouple the PIC.

ak