Help with Function Generator Circuit

Having trouble with my circuit - just can't seem to get it to work...

Anyone able to figure out where I went wrong?

https://www.circuitlab.com/circuit/574jj5/circuit-v1_0/

by Incontro
March 14, 2013

A few places ...

1) Time steps way too long.

See:

https://www.circuitlab.com/circuit/d4qjc5/relaxation-osc-fixed-01/

2) One of D3 or D4 needs to be inverted.

3) Bad practice for Schmitt trigger o/p to drive the LEDs directly. There has to be a resistor between the opamp o/p and the LEDs. The +ve feedback connection still comes off the LEDs so you still have the defined +/- voltage swing.

However there are a number of problems using CL opamps models.

See:

https://www.circuitlab.com/circuit/7k7nbh/cl-opamp-models-do-not-show-supply-currents/

https://www.circuitlab.com/circuit/vr8fd7/cl-opamps-do-not-model-vout-vs-iout/

https://www.circuitlab.com/circuit/75e48w/opamp-supply-pins-01/

Fix it by:

a) Replace IC1b with TL082 with supply rails component;

b) put label +6V on one supply pin;

c) put label -6V on other supply pin;

See:

https://www.circuitlab.com/circuit/a5bzf7/good-netname-and-a-free-voltage-source/

but also:

https://www.circuitlab.com/circuit/96br67/bad-net-name/

d) add series resistance between opamp o/p and LEDS with feedback still from LEDs

An improvement - and industry an standard trick - replace LEDs with bridge rectifier and a zener to define more accurately symmetrical o/p swing.

3) Remove the virtual split power rail circuit. It does nothing for the sim other than slow everything down and increase the chances of convergence failure.

Add it in again later when you've got the main funct gen working or sim it separately with a simplified behavioural funct gen as a load.

4) Ditto OA1, R10, R12.

After doing all that, set;

C1 = 22nF;

Stop time = 10m;

Time Step = 100u

and you get ...

https://www.circuitlab.com/circuit/4vda3h/circuit-v1_0-simplified-fixed/

:)

by signality
March 14, 2013

1) Fixed.

2) Silly mistake, fixed.

3)Is that to limit the current to the LED's so that it operates within "safe" limits? If so, yes, probably should be.

So adding a resistor both just before D3 and D4 (in series):

R=(V(s)-V(d))/I =(2.3-2.2)/(30*10E-3) =3.333 OHM

Assumptions:

Operating Current: 30mA (Green LED)

Operating voltage: 2.2V

Circuitlab shows 2.3V (peak) across the diode when simulated.

So adding a 3.3 Ohm resistor will work as opposed to 3.9 Ohms? As I am worried that the 3.9 might not quite provide enough voltage to power on the LED.

a)

Fixed the op-amps glitches using your advice. And I thought it was me doing something drastically wrong haha. One question: Why does the second (Schmitt trigger) op-amp need to be replaced with TL series and not the Integrator?

d) Your suggestion is probably better, but I was trying to use the LED's as some sort of a "stroboscope." But will use your trick in all other needs from now. :)

4) Added the power supply module again, all works.

5) Ok, will add back later. For some reason the output voltages without the amplifier module seem to be quite high - any reason for this?

FINALLY) You are a lifesaver, thank you so, so much!! I was literally pulling my hairs out over this one :)

by Incontro
March 15, 2013

"3)Is that to limit the current to the LED's so that it operates within "safe" limits? If so, yes, probably should be.

So adding a resistor both just before D3 and D4 (in series):

R=(V(s)-V(d))/I =(2.3-2.2)/(30*10E-3) =3.333 OHM

Assumptions:

Operating Current: 30mA (Green LED)

Operating voltage: 2.2V

Circuitlab shows 2.3V (peak) across the diode when simulated.

So adding a 3.3 Ohm resistor will work as opposed to 3.9 Ohms? As I am worried that the 3.9 might not quite provide enough voltage to power on the LED."

No.

There are 2 problems with using LEDs the way you have in your circuit.

i) CL's rail-less opamp has no output voltage limit. If you use it in any circuit where the output voltage is not directly controlled by the input voltage (i.e. basically an inverting or non-inverting amplifier), the o/p voltage will fly off to +/- infinity.

You cannot clamp the voltage at the o/p pin of the CL rail-less opamp model.

Hence in any circuit that does not meet the criterion given above - i.e. your Schmitt Trigger - any load will see an infinite current through it.

That's part of what the references to the CL opamp models above are describing.

And that's why you need to use the CL opamps with supply rails. They limit the max +/- o/p voltage swing to the rails.

The choice of the TL082 was arbitrary. It was the first that came off the pallette. But because the CL models do not properly model the actual o/p voltage swings of the part numbers they have on them, the only real difference as far as your concerned between the TL082 and the 741 CL models when used in a Schmitt Trigger is that the slew rate - and hence edge speed - of the TL082 is a lot faster.

The integrator works OK with a rail-less model because although the o/p can ramp off to infinity, as soon as it reaches the trip levels set by the Schmitt Trigger, the i/p reverses polarity and so the o/p ramps down again.

That said, it is possible though that CL could make a mistake in working out the initial conditions and initialise the integrator o/p at +/- inifinity.

See also:

https://www.circuitlab.com/docs/circuit-elements/#opamp

ii) You need a resistor in series with a LED that limits the change in LED current vs. the change in supply voltage and LED voltage. If your LED forward voltage can change by say 0.1V (e.g. vs. temperature and LED current) and your supply voltage can change by say 0.5V then the voltage across the resistor in series with the LED must be >> (0.1+0.5)V:

https://www.circuitlab.com/forums/optoelectronics/topic/6vu3zs7w/how-to-add-an-anonymous-led/

You can use a single resistor for the two LEDs because only one conducts at a time.

Beware though that the reverse voltage rating of the LEDs must be > the max forward LED voltage!

Also have a close read of:

https://www.circuitlab.com/circuit/mp673a/two-leds-separate-vs-shared-resistor/

https://www.circuitlab.com/circuit/z79rqm/leds-with-resistor-biasing/

If you really want to use LEDs then, in:

https://www.circuitlab.com/circuit/4vda3h/circuit-v1_0-simplified-fixed/

replace the zener across the +/- pins of the bridge rectifier with a single LED. That maintains the strobe but preserves the symmetry of the +/- o/p swing.

Or replace the bridge rectifier and zener with a pair of anti-parallel LEDs.

"5) Ok, will add back later. For some reason the output voltages without the amplifier module seem to be quite high - any reason for this?"

V(SQ) is a rail to rail swing output set by the CL opamp model (see above links about CL opamps);

The swing of V(TRI) is set by the forward drop of the bridge rectifier + the zener voltage. That's fundamental to how this type of function generator operates.

V(SIN) is somewhat less the V(TRI).

by signality
March 15, 2013

Post a Reply

Please sign in or create an account to comment.