# Generation of triangle wave at 15KHz frequency

I want to generate a triangle wave with peak value 5V. I am using a 555 timer to generate square wave pulse of frequency 15KHz. Then I passes this square wave through a active integrator ( A opamp with RC circuit). But for various RC values I used i was just getting a flat line. So please help with the circuit for integrator I will be really grateful.

• Can you provide schematic of your current setup? I suspect there may be a simple problem that you have overlooked. Commented Feb 7, 2015 at 14:15
• !This is the link to my simulation. I am using a function generator to generate square-wave. Then as u can see it is feed into a active integrator. And on the left u can see the output of the integrator Commented Feb 9, 2015 at 0:55

## 3 Answers

Simple triangle-wave generator using two op-amps. One op-amp is configured as a Schmitt trigger, other op-amp is an integrator. You mention 5V, so I'll include the bias network needed for single-supply operation. Note that you have to use op-amps with rail-to-rail inputs AND outputs.

simulate this circuit – Schematic created using CircuitLab

Component values are NOT necessarily correct: R5 & C2 control the frequency. The ratio of R3 & R4 control the amplitude of the triangle wave - this also affects frequency.

• I tried simulating this circuit in multisim using 741 op-amps, the output was flattening out, all the could see an flat output. This circuit was working fine small frequencies like 100 Hz, but was flattening out for high frequencies. Commented Feb 9, 2015 at 0:04

It would be a trivial task to generate a triangle wave using an 8-bit microcontroller like the PIC16F753 which has a 9-bit DAC (digital to analog converter). It can run on 5v.

The DAC has a limited current drive, but the part also includes an op amp with rail to rail outputs and a drive capability of 50 mA, which can be internally connected to the output of the DAC.

Since this microcontroller has a built-in oscillator (factory calibrated to ±1%), it will be as accurate as a discrete solution using 1% parts, and the only other part needed besides the microcontroller is a decoupling cap on V$_{DD}$.

Digi-Key sells this part in a DIP package in single quantities for \$1.21.

• In line with another question about whether analog systems are still used for real-world modelling. People need to realise/accept/understand that one of the places that microcontrollers really shine is in replacing large amounts of analog circuitry with a single MCU. "I want to do it with analog components, no microcontroller" is like saying "I don't want to use matches to start a fire, I want to rub two sticks together like the olden days". Commented Feb 7, 2015 at 22:10
• @markt Besides the internal DAC, the PIC16F573 also includes an op-amp (very rare for a microcontroller), two high speed analog comparators, and an 8-channel 10-bit A/D. Quite a bit of analog circuitry for a low-end 14-pin part. Commented Feb 7, 2015 at 22:47

With a simple integrator each RC pair will have an optimal frequency range. For example if the rising integrator voltage reaches the max or min voltage (namely the op-amp supply rails) the triangle wave goes flat (at the high or low end).

You should have noticed that changing the RC pair also changes the max voltage swing of the triangle wave. There will be an optimal RC pair for each different square wave frequency, (if you want a constant voltage swing).

Also note that a 555 does not have a bipolar output (unless you use extra circuitry) so the average voltage is positive. If the op-amp uses a bipolar supply your triangle wave will potentially flatten out at one end well before the other end flattens out.

One modification to get better control of the triangle wave size (and reduce the flattening) would be to place a variable resistor in parallel with the capacitor, this allows the gain of the integrator op-amp to be adjusted, giving a wider working range for each RC pair. A resistor in this position also helps prevent the output from easily drifting too far in one direction due to unequally biased square waves (wave shapes with a DC average).