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.

Triangular wave generator

Status
Not open for further replies.

normad

Member
Hey guys :),

im trying to simulate a triangular wave generator using ltspice. i calculated the the resistor values so that ill get a 5V(p-p) output at 5kHz.
But for some reason i cant figure out the hysteresis circuit doesnt switch when its supposed so all i get is one increasing half of a triangle.
inorder to trigger the circuit in the beginning im using a small pulse. culd this be the reason?
ive uploaded the ltspice file
 

Attachments

  • partc.asc
    1.9 KB · Views: 467
You need to skip the initial operating point calculation so the effects of the capacitors charging are actually simulated, rather than allowed to stabalis beforehand. That way the pulse you added to kickstart the simulation, which was causing the problem in the first place, can be removed.
 

Attachments

  • Triangle wave.asc
    1.6 KB · Views: 583
thanks! :) but i dont understand what you mean by skipping initial operating point calculation.. how does that trigger the comparator?

and in this circuit the frequency of the oscillator is determined by the integrator isnt it? so when you do a time domain analysis on the integrator circuit you get

Code:
Voc =   1/RC ×  ∫Vin dt

      =   1/RC × Vin×t

so if i want a frequency of 5kHz and the C value is 10 nF and the output signal is supposed to be 5V(p-p)
i substitute

Voc = 5, C = 10nF , Vin = 15 , t = 1/2f

but the R value im getting is twice the actual value :confused:

what am i doing wrong?
 
thanks! :) but i dont understand what you mean by skipping initial operating point calculation.. how does that trigger the comparator?

and in this circuit the frequency of the oscillator is determined by the integrator isnt it? so when you do a time domain analysis on the integrator circuit you get

Code:
Voc =   1/RC ×  ∫Vin dt

      =   1/RC × Vin×t

so if i want a frequency of 5kHz and the C value is 10 nF and the output signal is supposed to be 5V(p-p)
i substitute

Voc = 5, C = 10nF , Vin = 15 , t = 1/2f

but the R value im getting is twice the actual value :confused:

what am i doing wrong?

hi,
Look at this.
Click the partc.asc to run it.


AAesp01.gifAAesp03.gifView attachment partc.ascAAesp02.gif
 
Last edited:
hi nomad,
Have you worked out why you need that resistor from the starting trigger pulse generator.??:)
 
It doesn't need a starting pulse.

Eric,
There's no need for a starting pulse if you set the simulator up properly.

thanks! :) but i dont understand what you mean by skipping initial operating point calculation.
Before starting the simulation, LTSpice stabilises the capacitor voltages and inductor currents. The is often good because you don't have to wait for decoupling capacitors to charge but it stops oscillator circuits which rely on capacitors to charge from simulating properly.

It's in the transient section of the edit simulation command dialogue box, see attached.
LTSpice Skip Initial1.png

Try this:
Connect a resistor and capacitor in series, say 100k and 100µF respectively, (an RC constant of 10s) across a DC voltage source, say 10V.

Go to edit simulation command and set the stop time for something reasonable like 60s, this should be long enough for you to see the capacitor charging.

First make sure the skip initial operating point calculation box is unticked and run the simulation. You'll find that the capacitor voltage is 10V from the beginning, when you'd expect to see a charging curve. This is because LTSpice has found the steady state voltage for the capacitor before the simulation even started.

Then go to edit simulation command again, tick the skip initial operating point calculation and rerun the simulation. This time you'll notice that the capacitor charges as expected.

If you can't get this to work, post the .asc file and I'll show you where you're going wrong.

Your oscillator relies on the capacitor charging from when the power is first applied which is why the simulation won't run with the skip initial operating point calculation box ticked.
 
Last edited:
Eric,
There's no need for a starting pulse if you set the simulator up properly.

hi hero,
I know that, thanks anyway for the thought.:)

If you note I asked him why he thought the 10k resistor, which I added, was necessary.
I was trying to get him to think about the actual stimulating pulse source parameters.
Hopefully to avoid any problems in future simulations.

Perhaps he will post the answer, I guess you know..;)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top