Sine Square Triangle Oscillator

Discussion in 'General Electronics Chat' started by Dippo, Jan 9, 2012.

  1. Dippo

    Thread Starter New Member

    Oct 24, 2011
    Hello everybody,

    While playing with LTSpice, i figured out that a oscillator for me is the best way to understand electronics and build further from here.
    I stumbled upon a schematic in LTSpice what showed me exactly what i wanted.
    While i was removing the parameters in this schematic, i found out that one line was/is very important to let everything work correctly.
    It's this line: .IC v(U1i) 1u
    I've checked the help file of LTSpice and it say's:
    .IC -- Set Initial Conditions

    The .ic directive allows initial conditions for transient analysis to be specified. Node voltages and inductor currents may be specified. A DC solution is performed using the initial conditions as constraints. Note that although inductors are normally treated as short circuits in the DC solution in other SPICE programs, if an initial current is specified, they are treated as infinite-impedance current sources in LTspice.

    Syntax: .ic [V(<n1>)=<voltage>] [I(<inductor>)=<current>]

    Example: .ic V(in)=2 V(out)=5 V(vc)=1.8 I(L1)=300m

    ---- ends

    I've tried many things to replace is .IC statement to get the same result, but it didn't workout.
    So, currently i am thinking that this circuit is not working at all, but only works in LTSpice. Is this correct?

    Thanks and Greetings, Dippo
  2. Adjuster

    Late Member

    Dec 26, 2010
    This oscillator seems to have more than one possible operating mode. Feedback is applied around a long loop incorporating three amplifiers, so it may not be surprising that the conditions for oscillations could be met in more than one way. (It is however possible that the model may not line up well with practice under all conditions.)

    An oscillator that requires particular initial conditions to start properly in simulation may also be unreliable in practice. This might be addressed by applying some kind of pulse on switch-on, but personally I distrust this sort of thing: a transient glitch may later "shock" the circuit into protracted malfunction.
  3. Dippo

    Thread Starter New Member

    Oct 24, 2011
    Thanks for the reply. I figured out (at-least i think i did) what the parameter means (.IC v(U1i) 1u). It means it needs a load at location U1i in order to work correctly. So, it also means that U1o and U2o can get a load, but it's not possible to put a load on a other spot at the same time.
    I put a .01 Ohm resistor parallel with the already existing resistor in order to let it work. I have not checked everything yet, but it looks good so far, and no pulse on switch-on is needed.

    Thanks and greetings, Dippo
  4. PaulEE


    Dec 23, 2011

    Also, as far as your decision to play with an oscillator as an intro to this stuff:

    Good move!

    The concept of resonance and amplification are two of the key ideas in electrical engineering.

    An oscillator will oscillate when two conditions are met (nyquist stabability criterion):
    1->The overall gain from output/input is greater than or equal to one.
    -->In the real world, it is usually a bit more than one to account for non-idealities
    2->The phase difference between the input and output is 0 degrees/180 degrees (0 = 180)

    The circuit you posted works, but barely.

    Look up "multivibrator opamp" on google, as well as "integrator" and "inverting/non inverting opamp"

    Often, those are put together to build the circuit you're speaking of.

    Also, check out "wein bridge oscillator", which gives a great sine wave when built well.
  5. Wendy


    Mar 24, 2008
    We are talking simulators for the most part. A very close equivlent has been both built and simulated. You should not need to shock this circuit as the square wave and triangle wave op amps form a hysteretic oscillator, which is actually a type of multivibrator. No resonance is present, just RC timing.

    555 Hysteretic Oscillator Expains Theory of operation of a Hysteretic Oscillator.

    HELP with function generator using IC 555 timer! Note, the op amp Schmitt trigger is replace with a 555.
  6. Dippo

    Thread Starter New Member

    Oct 24, 2011
    Hi guys, thanks for the reply's.

    After surfing the web and reading documentation, i found out that this circuit is named: buffered phase shift oscillator. Is this correct? Because i can't find much information about it. I tried to compare this circuit with other circuits (TI had some good documentation), but nothing comes near.

    Also, i have problems to tell what the gain is. The circuit uses 2 power supply's (1 for positive, 1 for negative), the circuit output 3 different types (square, triangle, sine). If i let the circuit run without any errors, the gain is equal to 1 power supply.
    The other problem i have, is that this circuit has 3 different types of output (square, triangle, sine), not that it is wrong, because now i can influence each other and i can learn from it. But let say i want to remove the triangle, then the circuit no longer works because triangle is needed to create a sine.

    Anyway, the reason to create a function generator is to create a timer for my pic, because timing is still a issue. I can buy a timer chip, but then i can't learn anything about it, and it's also useful in other projects.

    Thanks and greetings, Dippo
  7. Wendy


    Mar 24, 2008
    I just looked at your circuit again, it wasn't quite what I thought it was.

    I went through a similar exercise a long while back, these are my two threads.

    I thought the illustration on this post was interesting...

    This circuit, which is directly equivalent to yours, just wasn't stable, and no amount of tweaking would make it so. It was way too dependent on the specs of the op amp, especially the slew rates.

    So I went another route, which worked much better. Another user picked up the ball on a later thread (which I'll post after this link) and worked out a lot of details.

    I had fun with it. Guess this makes me a bit odd.
  8. Dippo

    Thread Starter New Member

    Oct 24, 2011
    Cool, i never read that post. Thanks!

    I uploaded the latest version of this design in LTSpice. My thoughts about it:
    The Maximum timestep option in LTSpice does not work correct with this circuit. If it's above 0ms, LTSpice shows no errors.
    I couldn't increase the squarewave above 800 mv. So i went backwards and lowered the voltage to 1.75 positive/1.75 negative. If you increase the voltage, you see the squarewave get sharper and the sinuswave get bigger.
    Also, i think the electron flow must be used instead of the conventional flow.
    This design is not ready, but i am currently in a state to say that this is the maximum i can get out of it. If i alter this design to get a bigger triangle, then the sine or the square will/can get corrupt. That's why i asked if it's possible to remove 1 opamp, because there then new possibility's.

    Thanks and greetings, Dippo
  9. Dippo

    Thread Starter New Member

    Oct 24, 2011

    I got it working! Thanks to Jony130 i found out what was wrong.

    Now i need some good op-amps to test it in real life.

    Greetings, Dippo.
  10. Jony130

    AAC Fanatic!

    Feb 17, 2009
    In witch place I helped you? Because somehow I can not remember where.

    Additional you circuit is not very good.
    The capacitors C1, C2 and C3, C5 will work only once. There is now path to discharge current.
    And you sine wave is is hard clipping.
    Why don't you use this classic circuit ? And if you want low THD sinewave you need to build proper sinewave generator.
    Last edited: Jan 15, 2012