Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Triangle wave generator for pwm

Status
Not open for further replies.
Opamp circuits always have a reference voltage that is a bias voltage. In this circuit it is at half the supply voltage so the square-wave and triangle-wave can swing symmetrically with equal up and down amplitudes, using the symmetrical opamp I used.

The 47nF timing capacitor is charged by and is discharged into the 5.6k resistor. The current in the resistor is constant and is determined by the square-wave amplitude provided to the resistor by the first opamp (0V plus 0.7V and the supply voltage minus 0.7V).

My PWM circuit compares the triangle-wave to a DC voltage, not a sine-wave.
My description before wrongly said that the triangle-wave drives the Mosfet gate. Actually, the triangle-wave is compared to a DC voltage and the output of the comparator drives the Mosfet gate.
if I wanted to adopt your triangle wave circuit in my own pwm circuit to compare it with a sine how do I increase the frequency to 5000hz
Also I want to ask you used a voltage devider to create the refremce voltage but I want to ask if I powered it with a 12V and I need to use a 6V reference can one use a 7806 regulator.the reason am asking is in the case of a bubba oscillator where we input half vcc will using a regulator be ok since o use a12V power source or i could use a potentiometer as a voltage divider.
 
The 47nF capacitor and the 5.6k resistor in my circuit make the frequency. If the capacitor value is smaller, maybe 2.7nF or if the resistor value is smaller, maybe 3k then its frequency will be 5kHz.

Only TWO RESISTORS make a half-the-supply voltage reference for my PWM circuit and for an analog oscillator, you do not need a voltage regulator if your supply voltage is fairly stable. I used an opamp to buffer the reference voltage in my circuit because it was not used for anything else, but it is not needed because the input of an opamp uses a very small current.

Why are you using 4 opamps to make a Bubba sine-wave oscillator when the PWM circuit I showed compares the triangle-wave to simple DC?
 
I really am not that busy as am always at home for now so am doing all this to keep busy but aside that i want to have different oscillators just for hobby sake.
So can i eliminate the voltage reference part of the tri oscillator?
Then I just tweak the resistor capacitor to get my desired frequency and am good to go.
 
So can i eliminate the voltage reference part of the tri oscillator?
NO!
The voltage reference is extremely important for an opamp circuit. Simply use two resistors to make a voltage divider if the supply voltage is fairly stable.
If the supply is a dual polarity supply then the voltage reference is usually 0V.
 
NO!
The voltage reference is extremely important for an opamp circuit. Simply use two resistors to make a voltage divider if the supply voltage is fairly stable.
If the supply is a dual polarity supply then the voltage reference is usually 0V.
When you mean dual polarity does it mean for example from a 12v source (a battery)we say +12v and -12v where the -12v will be the 0V reference and if this is so then I can eliminate the comparator part from your circuit which you used to create the reference since you are using a single supply I assume.hope am not a bother to you
 
When you mean dual polarity does it mean for example from a 12v source (a battery)we say +12v and -12v where the -12v will be the 0V reference and if this is so then I can eliminate the comparator part from your circuit which you used to create the reference since you are using a single supply I assume.
No.
A 12V battery has +12V and 0V. It does not have -12V. Half the supply is +6V which will usually be the reference voltage.
A dual polarity supply has +12V, 0V and -12V, the total voltage is 24v. So half the supply is 0V which is the reference voltage. Then the output can swing positive and negative.

My circuit did not use a comparator to create the reference voltage of +2.5V. Instead it used two 100k resistors as a voltage divider and an opamp U2a with a voltage gain of 1 as a buffer. The buffer is not needed but since U2 was a dual opamp the first opamp U2a was not used so I used it as a buffer.
 
ok here the thing.i am having trouble finding a good mordern audio opamp as i searched for the MC33172 and MC33174 but my supplier says he cant find it but he was able to show me TL084 and TL082 so am asking will TL082 be able to work well for frequencies up to 100khz with no crossover distortion and is it power consumption friendly.it seems available here so i can make do with it.
 
The TL082 dual and TL084 quad opamps work well up to 100kHz and have no crossover distortion. The typical supply current for the TL082 is 2.8mA but the maximum is 5.6mA. Their minimum allowed supply is 7V. The output swings about 1.5V from ground and about 2.5V from the positive supply voltage when there is a reasonable load.
 
so i can go ahead and use it for my sine wave oscillator and triangle wave oscillator?
could you explain what you mean by output swing a little better please?
 
Hi,

The triangle need not be perfect and it need not go all the way from 0 to Vcc.

I posted a complete system with output filter and all in this thread, post number 6:
https://www.electro-tech-online.com/threads/basic-concepts-of-power-electronics.138463/

Notice the wave shape of the triangle, which is not a true triangle. The difference is it is a curved triangle, and that just changes the loop gain slightly from top to bottom. If the triangle isnt too far off, it works ok. Obviously you cant use a 'triangle' that starts out very steep and then levels off for too long, but it's ok if it curves a little.
 
could you explain what you mean by output swing a little better please?
The datasheet for every opamp shows its "maximum peak output voltage swing" when its supply is usually plus and minus 15V and with different load resistors. For the TL08x it is 10V peak with a 2k load or 12V peak with a 10k load.
Then if the supply is only 7V the output voltage swing into a 10k load is only 3V or a little more.
 
i made a triangle wave of about 500o hz usiing the circuit in this thread although changing the resistor values to make the amplitude high as possible after doing some simulations and got it to work well and i also made a bubba oscillator oof about 50 to 100hz abd got it to oscillate well and i used the opamps TL084 for the bubba and TL082 for the triangle but heres the strange thing i decided to use a 555 timer as a comparator to generate a PWM signal but when i compared them i was getting a weird output instead of the normal PWM square wave look alike am supposed to get so i have decided to use a normal comparator like lm393 instead.am just wondering what could have happened uisng the 555 as i wired it correctly.
Also to make the triangle wave amplitude as high as possible it is determined by the two resistors in the comparator part of the oscillator cirucit i used R1=100k,R2=about 86k and for the integrator R= 5k p0t(freq adjust) and C= 10nf.R1 and R2 determine amplitude and i want it to be high so am wondering how determination of amplitude works.Based on simulations on proteus i saw that making the two resistors close as posiible gave us higher amplitude but on practically testing the circuit using TL082 i saw that the selected values was enough for the circuit to oscillate as making them equal would not oscillate at all so i had to adjust until i got oscillation with those values.
i want the PWM to be high as posible maybe up to 10V peak to peak. am powering from a 12v source by the way
 
A 5 kHz linear sawtooth generator can be made very simply with a couple of discrete devices:
SawtoothSch01.png

The 2N2222 acts as a constant current source to charge the capacitor, which results in a very linear voltage ramp. The SCR discharges the capacitor when the voltage reaches a trigger point set by the pot. I built this circuit to use the absolute minimum number of parts, so the voltage divider pot does double duty to set the transistor bias, and trigger point of the SCR.

Here is the waveform at 5 kHz:
Waveform5kHz.jpg

This circuit would still need an output buffer if you want to feed it into any significant load.

BTW, regardless of which circuit you decide upon, the capacitors must be film type, not ceramic. The capacitance of ceramic capacitors decreases as they charge up, and this noticeably affects linearity of the waveform.
 
Last edited:
A 5 kHz linear sawtooth generator can be made very simply with a couple of discrete devices:
View attachment 81706
The 2N2222 acts as a constant current source to charge the capacitor, which results in a very linear voltage ramp. The SCR discharges the capacitor when the voltage reaches a trigger point set by the pot. I built this circuit to use the absolute minimum number of parts, so the voltage divider pot does double duty to set the transistor bias, and trigger point of the SCR.

Here is the waveform at 5 kHz:
View attachment 81707
This circuit would still need an output buffer if you want to feed it into any significant load.

BTW, regardless of which circuit you decide upon, the capacitors must be film type, not ceramic. The capacitance of ceramic capacitors decreases as they charge up, and this noticeably affects linearity of the waveform.
how do i buffer the signal
 
If you intend to feed it into an input of a comparator to generate the PWM, then you can probably use it without a buffer. Otherwise, a simple emitter follower will work. For example, I've fed the output of this circuit directly into an LM311 comparator with no problems.
 
Last edited:
Pulse width Modulation is a technique that Modulated signal and
frequency also encodes information for transmission. 2 principal algorithms are
using in PWM. They are PSB(Photovoltaic solar battery) and MPPT. Non-Sinusoidal waveform named is Triangular
shape. TW waves curve are periodic, piecewise linear, continuous real function.
Nevertheless, a very good triangle wave generator can be built using a dual op
amp. In 220 Hz you will get perfect triangle wave in peak to peak 12V. 555
timer also use in triangle wave for generated PWM.

Have a look at
**broken link removed**
**broken link removed**
https://www.ni.com/white-paper/13238/en/
With apporprite Figure***
 

Attachments

  • ts122001_1.gif
    ts122001_1.gif
    22.9 KB · Views: 1,025
The problem with having a non-linear triangle or sawtooth is that the gain of the PWM converter (PWM duty-cycle versus input voltage) then varies with signal level. This can affect the loop dynamics in a feedback control system.
 
tha
4QD used to have excellent tutorials on generating PWM with Op-amps (https://www.4qd.co.uk/). I relied on its wisdom. Unfortunately, those tutorials seem to be gone. Nevertheless, while searching for them, I came across this interesting note: **broken link removed** Scroll down to the PWM section. It uses just one op-amp, so you will have to ground the input for another op-amp. Such a waste of silicon ;)

John

Edit: Found it! https://www.4qdtec.com/pwm-01.html Browse around. There is some good information there.
thanks for the link John it's really good i am going to save the page
 
The problem with having a non-linear triangle or sawtooth is that the gain of the PWM converter (PWM duty-cycle versus input voltage) then varies with signal level. This can affect the loop dynamics in a feedback control system.

Hello,

In a feedback system this effect will usually be minimal because the loop gain is large to begin with, so as long as the triangle is not too curved it works just fine (just like an op amp circuit with internal gain that is uncontrollable).
It's only in the feed forward only system that there could be a marked effect due to the change in ratio between the input and averaged output. If the triangle slope was different near zero as compared to near the peak then the modulated output would be distorted in a similar manner.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top