# Square to Triangle Wave Integrator Amplitude Problem

Discussion in 'General Electronics Chat' started by Tony Elliott, Oct 16, 2015.

1. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
Hi everyone,

I have made a triangle wave from a 555/4013 square wave circuit using a integrator and then into a sine wave. But on low frequencies the triangle wave is high in amplitude (very loud) but on high frequencies it becomes low in amplitude (very quiet), I need to fix this problem,

I was thinking if I could take a audio source from the square wave oscillator, turn it into a voltage output and put it with the amplifier pot that makes the triangle louder as it sweeps from low to high. This could work. Any ideas how to turn a square wave audio source into a smooth voltage that climbs to make the triangle amplitude equal as it climbs up in frequency?

Or has anyone got any better solutions? I would prefer to use analogue circuits.

This is where I got the square to triangle integrator circuit from:

2. ### crutschow Expert

Mar 14, 2008
13,501
3,375
An integrator will naturally change it's amplitude with frequency.
Here's a circuit where the triangular wave is largely independent of frequency by varying the value of R1.
But the filtered sine-wave output will still vary.

Edit: C3 should be 10uF, not 1pF.

• ###### Triangle Gen op amp.asc
File size:
2.4 KB
Views:
14
Last edited: Oct 17, 2015
OBW0549 and Tony Elliott like this.
3. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
Here is a post on a thread I saw that might be useful.

Off the top of my head, here's how I might consider approaching the solution.

The higher the square wave frequency, the lower the resulting triangle wave if you use "normal" integration circuitry. If you want to address this issue you could "filter" the square wave and use a peak measurment circuit to produce a "control" voltage that rises linearly as the squarewave frequency increases. This can be used to control integration rates.

Another method is to "examine" the amplitude of the resulting triangle wave and use this to control the amount by which the triangle wave is post-amplified - i.e. big triangle wave = low gain, small triangle wave = big gain. Maybe this technique and the variable integration method can work together successfully.

To make a triangle wave I'd use an integrator circuit formed around a current source and this current source could be designed to inject more current as the squarewave frequency increases hence keeping the output amplitude roughly constant. You'd need two current sources to make this work; one for the rise and one for the fall of the triangle.

4. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
You see the challenge is I have to use a certain square wave circuit to start with as it is the only circuit that works with my project.

5. ### crutschow Expert

Mar 14, 2008
13,501
3,375
What do you mean by that?

Tony Elliott likes this.
6. ### OBW0549 Well-Known Member

Mar 2, 2015
1,395
941
Why? What is it about this circuit of yours that makes it "the only circuit that works" in your project? What's so special about a 555 and a 4013?

Do it the way crutschow suggested in post #2, with a circuit that naturally generates a triangle wave of constant amplitude regardless of frequency. It's easier than what you proposed, simpler and more reliable-- and probably will perform better, too.

7. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
the square wave circuit I use is for a art installation and its the only circuit that works, your triangle wave circuit looks great with perfect waves but I don't think it would work with my installation.

8. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2

Above is a short video of he installation the 555/4013 is super responsive with the paint when printing and other circuits stop working after a few prints. so I need to wave shape this circuit.

9. ### Alec_t AAC Fanatic!

Sep 17, 2013
5,975
1,135
What part does the paint play in the sound generation?

10. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
It resists the frequency potentiometer on the square wave circuit.

11. ### crutschow Expert

Mar 14, 2008
13,501
3,375
That makes absolutely no sense to me.

12. ### atferrari AAC Fanatic!

Jan 6, 2004
2,667
784
Horrible sound.

Tony Elliott likes this.
13. ### GS3 Senior Member

Sep 21, 2007
408
35
This is confusing but I'll take a stab at it anyway. So you have a rectangular wave and you want to generate a triangular wave. You do not give us frequency or voltage ranges nor power requirements. It is all very theoretical.

The simplest way to generate a ramp is with a constant current source and a capacitor but, as you have found out, the amplitude will be larger as the period grows. You could then have some AGC (automatic gain control) circuit to maintain constant amplitude.

Another way would be to have the constant current source to be variable and controlled by the period or frequency of the square wave. Have a voltage-controlled current source so that you have square wave frequency to voltage to current.

The best solution would depend on frequency, power, etc.

Tony Elliott likes this.

May 8, 2015
140
2

15. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
The power is 9v and frequency is 10 Hz - 10 kHz (high down to second like timed pulses [VCO - LFO])
This is great, I have had a look on the internet at AGC designs and will start experimenting, I also got some advice on a AD650 frequency to voltage converter so I will experiment and see which works..

16. ### atferrari AAC Fanatic!

Jan 6, 2004
2,667
784
So much secret makes hard to understand anything.

Here you have the article from the EDN site that I managed to save long time ago. Trying to find it today on line, I had no luck but I recalled I had it already.

File size:
25.2 KB
Views:
14
17. ### GS3 Senior Member

Sep 21, 2007
408
35
Power is 9V?

The frequency range ratio, 10 Hz - 10 kHz, is 1000 so quite large and amplifying the small triangular wave by 1000 does not seem like the best solution. I would try to look into generating the triangular signal at the correct level from the start.

This is more complex than you think and the definition of the question requires much more information. So you have a 9 V (P-P?) rectangular wave which can be anywhere between 10 Hz and 10 kHz and you want a triangular wave of the same frequency and amplitude. Does it have to be *exactly* the same frequency or can there be some leeway? Does it have to transition exactly when the rectangular wave transitions? Is the frequency stable or does it vary? If it varies how fast does the triangular wave need to track? The more tolerance you have in the answers the simpler the solution. If your rectangular wave's frequency varies fast and the triangular wave has to track it exactly in phase and amplitude then the problem is more complex than if there is some leeway. Any solution that requires a feedback loop requires careful analysis for stability.

18. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
9v p-p yes, the triangle waves frequency can be adjusted on the square wave capacitor and can be attenuated with resistors so that is fine, the amplitude needs to be improved it doesn't have to be exactly constant as the sine wave converter amplifies a better curve shape when the amplitude of the triangle wave is fairly constant and frequency modulation will improve.

19. ### Tony Elliott Thread Starter Member

May 8, 2015
140
2
This looks great, the IC is cheaper as well.

20. ### GopherT AAC Fanatic!

Nov 23, 2012
6,314
4,034
So, I understand that you use electrically conductive paint and longer traces have more resistance and that resistance change alters the frequency of the 555 timer.

Is that correct?