Audio Project Amplifier Speaker Loudspeaker Kit
diyAudio.com diyAudio Forums Archive > Top > Amplifiers > Class D
 
triangle wave - Click HERE for Original Thread
ted12
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
Hi ted12, you can charge/discharge a capacitor with two current sources, one NPN and one PNP, driven by a square wave.
hitsware
http://ourworld.compuserve.com/home...owden/funct.gif

use faster opamps
phase_accurate
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.......

Regards

Charles
Pierre
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
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.

Regards

Charles
sovadk
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
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
Hi hdoggz
Would you please share your circuit?
Thanks
hdoggz
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.

equations:
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).

http://filebox.vt.edu/users/hgilmer...ave_circuit.JPG
http://filebox.vt.edu/users/hgilmer...hz_triangle.JPG
trihieu
Hey Hdoggz,

Can you tell me the values of the resistors?
Thank you very much.
trihieu
Hey sovadk,

In the circuit that you have, the other end of C26 connected to ground? Or is it something else?
Thanks
sovadk
C26 is a part of a high pass filter, used to shift the DC level of the triangle wave, before feeding the pwm comperators. It plays no role in the triangle generator.
sovadk
I've done some simulations on my schematic. I've added a outbuffer to improved linearty and output impedance.

This is the result:




I've alos attached the orcad/pspice files for those of you who want to play arround with it.
hdoggz
trihieu,

The two equations in my previous post determine the value of the resistors and caps based on the frequency and amplitude ofthe triangle wave you want. I think once you solve them, you have more unknowns than equations which is a good thing cuz that means you can start off by choosing the value of one of the resistors. I'd start with something like 10k for 'R' to keep the current low. also, you may want to simulate thewhole thing in P-Spice before actually building it to doublecheck everything. again, use really highspeed components
trihieu
Thank you so much guys.
trihieu
sovadk,

What components are E4 and U1? I'm trying to buy those 2 components to build the circuit, but dont know what those are. Could you please help me out?
Thanks
sovadk
E4 together with R9 and C3 is just working as a comperator. I've placed a picture earlier in this thread, showing the actual configuration. You can brobably use LM119, LM219, LM319 or some other cheap comperator. Be aware that those comperators need a pullup resistor to work, since they have a open drain configuration. I don't know why so many conperators are made with a open-drain configuration. It really limits their rise time, and increese the current if you go for a small pullup resistor.

U1 and V3 are used to trigger oscillation in pspice and are not needed IRL. Pspice starts a simulation by calculating DC bias points. If the circuit isn't triggered by something, I'll stay in that initial state forever.

If you are going to buy some resistors for this circuit, you won't have to go for the exact values. I believe that I've chosen values from the E24 range.

The ratio between R7 and R8 controls the hysteresis voltage on the comperator. In other words the amplitude of the triangle wave.

Q1 and Q2 are current generators. The resistors arround these transistors contorls the current, which controls the slope of the triangle wave.

C1 is charged by alternately by Q1 and Q2, where dU/dt=I/C. Thereby C1 also contorls the slope of the triangle wave.

The frequency of the triangle wave is a function of the slope and the hysteresis voltage.

Q5 together with R13 is just a simple voltage follower. The triangle wave is only linear if there are no resistive loads to C1, which will give the slope an exponential character.

V2 can be made with a simple decoupled resistive voltage divider.

I believe that Orcad has a free limited version of capture and pspice, if you would like to simulate the circuit that I've attached.
That should be about all there is to say for now.

Good luck with it.

Kaspar Sinding Meyer

Page generated in 0.047708988189697 seconds with 17 queries,
spending 0.01061559 doing MySQL queries and 0.03709340 doing PHP things.

Powered by: Search Engine Indexer and vBulletin
Copyright ©1999-2008 diyAudio.com