• 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.

LTSpice and oscillators: what's the secret?

Status
Not open for further replies.

allaccess

New Member
I am having trouble getting LTSpice to simulate oscillations. I drew a schematic of a simple DC source and resistor circuit to make sure I could get the software to work, and after running and adding a current waveform, the waveform displayed just as it should.

Then, I tried two oscillators: a 1 transistor relaxation oscillator, and, a 2 transistor multivibrator. After running and adding a waveform, neither showed any signs of oscillation. Instead of a waveform that went up and down, I just got a flat, steady-state line. I also added the modifier "startup" to the .tran. That didn't make any difference either.

Is there a setting or entry method I don't know about?

Thanks, allaccess
 
Last edited:

crutschow

Well-Known Member
Most Helpful Member
Try the .uic Transient option (bottom option below):

upload_2017-9-15_17-23-43.png

Spice normally does a DC initial bias calculation with no inductors or capacitors, and that can put an oscillator in a quasi-stable state.
Avoiding this calculation usually allows the oscillations to start.
 

allaccess

New Member
I tried your suggestion, crutshow. Still no waveform.
Here's the circuit. I breadboarded it and it works great:
 

ronsimpson

Well-Known Member
Most Helpful Member
Please send your SPICE file. So we don't have to draw it from zero and so we can see what you are doing.
 

allaccess

New Member
Attached is the file "2 transister oscillator.asc" which is the file generated by LTSpice which contains the above circuit. If anybody can get it to show the waveforms that the actual circuit generates, I would be grateful.
Thanks, allaccess
 

Attachments

allaccess

New Member
Allaccess is mortified. I forget to draw the capacitor! :banghead:. Please disregard my thread. Ugh.
After discovering the above, I edited this reply:
I drew the capacitor and still can't get oscillating waveforms, so I ask again to help me figure out why I am getting just flat lines. I have attached the corrected .asc file.
 
Last edited:

allaccess

New Member
After discovering the above, I edited this reply:
I drew the capacitor and still can't get oscillating waveforms, so I ask again to help me figure out why I am getting just flat lines. I have attached the corrected .asc file.
 

Attachments

MikeMl

Well-Known Member
Most Helpful Member
Try this:

1. every circuit MUST have a GND node.
2. the NPN and PNP generic transistors are too small (Ic) to be useful in a circuit like this. Use "real" transistors.
3. B supply is for a specialized use. Not for a power supply, especially when you need to use the .startup directive.
4. use a real LED with a forward voltage drop similar to what you use in your real circuit instead of a generic Si diode. It will not oscillate if you put a "white" LED model (Vf=3.3V is too high to ever pass any current with only a 3V battery; Red Vf=~2V works)
5. Your sim time was 3 orders of magnitude too short.
6. do not use .uic. It is a pile driver when a little tap will do. The .startup directive will shock the oscillator enough to get it going. (btw-the oscillator will start without the .startup directive, but it draws a lot of current for quite a while...)
 

Attachments

Last edited:

simonbramble

Active Member
a real oscillator relies on some disturbance in the circuit to 'get it going'. If the circuit has a resonance at one frequency as well as enough gain in the circuit to overcome the losses, it will build up to sustained oscillation.

Now LTspice tends to apply the supply voltages before it starts the simulation, so you have no disturbance to the circuit so it does not oscillate. Try ramping the power supply up from 0V to Vsupply over 1us at the start of the simulation. You can use the PWL voltage source to do this. This might work
 

atferrari

Well-Known Member
I vaguely recall doing something like adding an RC "cell" somewhere in the feedback path, whose resonant frequency was close to if not the same of the design. Not sure how it was actually connected but surely started the oscillations. From what I remember it meant something at start time and irrelevant afterwards.

Simon's post made me recall the above.

My defunct PC treasures way too many things I did in the last years. The new one not in service yet.
 

atferrari

Well-Known Member
Thank you Mike, Simon, atferrari.
I need to understand LTSpice better before I try any further.
Besides the "official" tutorials, those by Simon Bramble are short and to the point.
 

crutschow

Well-Known Member
Most Helpful Member

allaccess

New Member
Success! LTSpice now accurately shows the oscillations.
However, my 1 transister relaxation oscillator still doesn't show oscillations:
(does LTSpice not like transistors used in reverse?)
upload_2017-9-16_17-10-41.png

attached is the LTSpice .asc file.

Thanks, allaccess
 

Attachments

Last edited:

MikeMl

Well-Known Member
Most Helpful Member
You are using an reverse bias avalanche mode of the transistor which is not modeled in the transistor Spice model. It is not modeled because it is usually not tested for/specified by the transistor maker, and no designer of a commercial product would ever use it for a re-produceable, manufacturable product...
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top