# Square to Triangle Wave Integrator Amplitude Problem

#### Tony Elliott

Joined May 8, 2015
158
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:

#### crutschow

Joined Mar 14, 2008
30,455

#### Attachments

• 2.4 KB Views: 59
Last edited:
• OBW0549 and Tony Elliott

#### Tony Elliott

Joined May 8, 2015
158
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.

#### Tony Elliott

Joined May 8, 2015
158
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.

View attachment 93023
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.

#### crutschow

Joined Mar 14, 2008
30,455
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.
What do you mean by that? • Tony Elliott

#### OBW0549

Joined Mar 2, 2015
3,566
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.
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.

#### Tony Elliott

Joined May 8, 2015
158
What do you mean by that? 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.

#### Tony Elliott

Joined May 8, 2015
158
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.

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.

#### Alec_t

Joined Sep 17, 2013
13,063
What part does the paint play in the sound generation?

#### Tony Elliott

Joined May 8, 2015
158
What part does the paint play in the sound generation?
It resists the frequency potentiometer on the square wave circuit.

#### crutschow

Joined Mar 14, 2008
30,455
It resists the frequency potentiometer on the square wave circuit.
That makes absolutely no sense to me. #### atferrari

Joined Jan 6, 2004
4,651
Horrible sound.

• Tony Elliott

#### GS3

Joined Sep 21, 2007
408
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

#### Tony Elliott

Joined May 8, 2015
158
That makes absolutely no sense to me. #### Tony Elliott

Joined May 8, 2015
158
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.
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..

#### atferrari

Joined Jan 6, 2004
4,651
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.

#### Attachments

• 25.2 KB Views: 58

#### GS3

Joined Sep 21, 2007
408
The power is 9v and frequency is 10 Hz - 10 kHz (high down to second like timed pulses [VCO - LFO]).
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.

#### Tony Elliott

Joined May 8, 2015
158
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.
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.

#### Tony Elliott

Joined May 8, 2015
158
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.
This looks great, the IC is cheaper as well.

#### GopherT

Joined Nov 23, 2012
8,012
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?