diyAudio (
-   Class D (
-   -   triangle wave (

ted12 26th March 2005 08:02 PM

triangle wave
Hi everyone

I just finish my first class d amp
but althouugh I had tried using opamp ,I still cannot make a suitable triangular wave for PWM inpt .

Without using MAX038, does any good method can generate tri wave with freq 300khz and 6Vpp (+3V/-3V)? Thanks

subwo1 26th March 2005 08:52 PM

Hi ted12, you can charge/discharge a capacitor with two current sources, one NPN and one PNP, driven by a square wave.

hitsware 26th March 2005 08:55 PM

use faster opamps

phase_accurate 29th March 2005 04:28 AM

I once used a CD4060 (or was it 4040 ?) oscillator/divider to generate a clean rectangular. This was fed into an inverting integrator - and there you go.......



Pierre 29th March 2005 10:52 AM

What kind of THD did you obtain with that method, Charles?

Best regards,
Pierre (looking for some "dead-time" to improve my current design)

phase_accurate 29th March 2005 01:31 PM

The THD was 0.44 % - with mainly 2nd order due to the complementary output stage of the amp. Most of the rest (i.e the higher- and mostly odd-order- harmonics) was due to bad layout.
The triangle quality of this method is mainly depending upon the op-amp and the dimensioning of the circuit.



sovadk 29th March 2005 08:10 PM

I have earlier tryed to use opamp's to generate triangle waves like hitsware suggested, but been very unsuccessful with it. Although I was using a opamp with a GBW of 70MHz, the triangle wave had very distorted spikes.

This is how I generate a very linear triangle wave with a frequency of about 400kHz (see the picture below). You can adjust C27 to change the frequency. R49 is connected to a virtual ground with Vcc/2 potential.
I have chosen to use a very fast comperator, but it's not necessary.
A slower comperator might give you softer spikes on your triangle wave, which will limit the max. linear duty-cycle a little bit.

I can't provide you with any simulations, but I'll asure you that you'll get a very clean triangle wave with this configuration.

hdoggz 30th March 2005 09:22 AM

I made a pretty decent triangle wave that put out 400KHz at 5V pk2pk. I used 'hitsquare's circuit with a LM311 comparator and some op-amp with a gain-bandwitdh of 4MHz.

finding the right resistor and cap values was kind of a back and forth process tho

genome 30th March 2005 08:28 PM

Hi hdoggz
Would you please share your circuit?

hdoggz 1st April 2005 07:53 AM

hi genome,

I don't have the exact values for all the components in my triangle wave generator because I worked on it last year for a school project. However, here are a couple of things that might help. i attached a hyperlink picture of the circuit I used along with the names of the op-amp and comparator.

frequencey: f = n / (4 CiRi)
peak triangle voltage: VT = 15 / n
- this assumes + and - 15V supply to both the op-amp and the comparator. if you have different supplies, change the 15 in the VT equation to whatever you have. Keep in mind both supplies must have the same DC magnitude or the triangle won't be completely symmetrical.

component selection:
The important thing about the op-amp is that it have a really high gain-bandwidth. The comparator needs to have a rail-to-rail output and be high-speed. I also attached a hyperlink to a screenshot that I captured of this circuit. you'll notice that the top of the triangle wave is not very sharp. The reason for this is that the comparator takes a long time switching from the -15V rail to the +15V rail. you can speed up this time by lowering the value of the pull-up resistor(not shown in schematic).

All times are GMT. The time now is 09:09 PM.

vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright 1999-2017 diyAudio

Content Relevant URLs by vBSEO 3.3.2