# Problem when measure square wave and Charge & Discharge

#### Sakamoto21

##### New Member
From circuit diagram
Target : I want to make square wave on Vout (Period =18 sec on :8 sec off: 10 sec)
I have problem when I use scope to measure triangle and Vout , I have followed target. But when I use scope to measure Vout only, time Period and time on reduce. it's not followed target.
I don't understand.
Q: why measure triangle signal and no measure, it's too difference.
* Actual I use op-amp: NJM2904C.
I attached data sheet .

My calculation.

file 1 &2
Please check my calculate is right?
If wrong, I would like to know how to calculate.

Thank you

#### crutschow

##### Well-Known Member
But when I use scope to measure Vout only, time Period and time on reduce. it's not followed target.
I don't understand.
And I don't understand what your problem is from your unclear description.

#### Sakamoto21

##### New Member
We've got problem for this circuit I calculate charge and discharge time not same with simulation.

This is simulation of triangle signal. Charge time: 8.97 sec
discharge time: 8.823 sec
Period: 17.79 sec
____________________________________________________________________________________________________________________________________________

From my calculated
I use op-amp : NJM2904C
From data sheet : Vop = 5.6V -> Vo = 4.3V I got this equation.
I solved for I1 and I2
I1= 0.026mA
I2= 0.015m A
R3= 100k
Find Vc1 = (I1+I2)*R3 -> 4.1V

Calculate Charge : Vc=Vs" (1-" e^((-t/RC)))
t= -ln[1-(Vc/Vs)][RC]
use R4=390k and C=10uF , Vs = 4.3 V , Vc = 4.1V
t =
11.96 sec

SIMULATION Charge time: 8.97 sec

It's not same with simulation. I don't know mistake point.
Please guild me to calculate this circuit.

THANK YOU

#### Attachments

• NJM2904_E.pdf
292.8 KB · Views: 10

#### Diver300

##### Well-Known Member
The circuit charges and discharges the capacitor most of the way to fully charged and fully discharged. The simulation shows that the charge and discharge times are more than twice the time constant, which is RC, so 390 kΩ * 10 μF = 3.9 seconds.

The result is that the voltage is changing very slowly, so minor adjustments to the voltage will make a big difference.

In this case I think that it is the output voltage of the op-amp when high that is having an effect. You have calculated with the op-amp producing 4.3 V while the simulation produces a higher peak voltage.

Also the target voltage should be 4.05 V if your output voltage is 4.3 V. That may be more important than changes in the output voltage as the target voltage changes as well if the output voltage changes.

Here is a tip for a quick way to calculate the voltage of the common point of 3 resistors. You take one pair of resistors, and calculate the resistance of the two in parallel. In this case, the two 100 kΩ resistors give 50 kΩ in parallel. Then you take the voltage that they would produce without the third resistor, in this case 5.6 V / 2 = 2.8 V. Then you calculate the voltage that the third resistor would create to a voltage and resistance you have just calculated, so a 50 kΩ resistor connected to a 2.8 V source. In this case the voltage difference between 4.3 and 2.8 is 1.5 V. The 10 kΩ and the 50 kΩ divide that by 6, so 0.25 V across the 10 kΩ resistor, and that gives 4.05 V.

I haven't followed your calculation but your equivalent circuit shows the 390 kΩ in parallel with the 10 kΩ which is incorrect. Where an op-amp is used as an amplifier, in some cases you regard the op-amp inputs as being at the same voltage. Here, it is used as a comparator and there is a significant voltage between the inputs of the op-amp except for the brief moments when the output switches.

• rjenkinsgb

#### rjenkinsgb

##### Well-Known Member
To put it simply, it is impossible to rely on the opamp giving any fixed high level voltage.

The datasheet shows around a 10% variance with no load, and rather more when loaded (depending on the load).
The output low level has a lot less variance, but there is still some.

Using an opamp with "rail to rail" output characteristics will improve things with that design, but it will never be perfect and it will never be exactly repeatable using real-world components, there will always be some variation due to IC and other component tolerances.

To get perfect symmetry, the simple approach is a higher frequency oscillator and a divider; the oscillator duty is then irrelevant as long as the frequency is stable.

Or a crystal (or ceramic resonator) oscillator and divider, which would give repeatable, close-tolerance results for mass production.

##### Well-Known Member
Per rjenkinsgb comments, the input range (where OpAmp is linear) = The output range is = And might be questions how spice model accommodated / modeled this behavior.

Regards, Dana.

#### Nigel Goodwin

##### Super Moderator

Replies
1
Views
106
Replies
1
Views
2K
Replies
6
Views
1K
Replies
6
Views
2K
Replies
4
Views
987 