Convert 33Hz of Square wave signal of (0 to 3.3V) to 33Hz of Triangular wave of (0 to 3.3V) using only Integrator circuit

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
Hie Can anyone tell me the values of Resistor and capacitor in a integrator circuit to Convert 33Hz of Square wave signal of (0 to 3.3V) to 33Hz of Triangular wave of (0 to 3.3V). No need circuit for square wave generator as we can get it from function generator. I just need the integrator circuit. I have got the result with passive RC circuit in series. But i need to solve using only Inegrator circuit with exact specification mentioned.

If anyone can solve it, Please help.

Thank you in advance
 

MrAl

Joined Jun 17, 2014
11,389
Hello,

Some questions for you....

Do you want to use an op amp? Most likely you will have to.
How accurate does the 3.3v output have to be? Is 3.2 to 3.4v ok for example? This is important to know.

The op amp circuit can be as simple as a couple resistors and a capacitor, but the above information about the range of output allowed has to be specified.
 

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
yes we will use opamp in the integrator, and yes 3.2 to 3.4 is okay. I have got the result using RC circuit in series with Subtractor and than non inverting amplifier!!! But I need to get the same result using Only integrator and its resistor and capacitor.
 

Attachments

MrAl

Joined Jun 17, 2014
11,389
yes we will use opamp in the integrator, and yes 3.2 to 3.4 is okay. I have got the result using RC circuit in series with Subtractor and than non inverting amplifier!!! But I need to get the same result using Only integrator and its resistor and capacitor.
Hello,

Given your op amp circuit the calculation of the values is fairly simple.

First, the input current is:
Iin=Vin/Rin

Then we can use one of the defining equations for the capacitor:
dv=i*dt/C

Now for the ramp UP you need to go from 0v to +3.3v so the total difference is 3.3 volts but we have to divide that by 2 to calculate the current because the triangle will be going up for 1/2 of the voltage and down for the other 1/2. This means that dv=3.3, but i=(3.3/2)/1000 the input current, and dt is 1/2 cycle time for your wave which is 1/(30*2) seconds.
The non inverting terminal also has to be biased to 3.3/2 volts, which is 1.65 volts.
So in other words, bias the non inverting terminal to 1.65v and use a cap value of:
1/132000 Farads.
You also need an input DC blocking capacitor of say 10uf to 100uf.

Does does make sense to you?

There is just one small catch. There is an ever present input offset that must be considered. It can be small but could lead to a large output offset in some cases. This means the input current is really:
Iin=(Vin+Voff)/Rin

where Voff is considered constant over short periods of time but somewhat variable over long periods of time. This means some way to compensate for this has to be incorporated into the design.

The usual method is to simply place a relatively large value resistor across the capacitor. This ruins the perfect linear ramp a small amount but is often acceptable.

If your Voff is say 5mv and the Rin is 1k then the current due to the input offset is 0.005/1000=5ua.
Doesnt seem like much, but it could lead to output saturation over time.
Placing a 100k resistor across the cap will keep the output offset to 0.5v and that may or may not be acceptable. If it is not acceptable then you should move toward a very low input offset op amp and then the input offset could be as low as 0.5ma meaning the output offset with the same setup would only be 500uv, usually acceptable.

As mentioned, the near perfect linear ramp without the parallel resistor is degraded somewhat by the inclusion of this parallel resistor so that has to be considered and a decision has to be made if this is acceptable or not. If it is not acceptable you could look for a lower input offset op amp or move to a automatic reset circuit that forces a zero output when it is really supposed to be zero, which is often used in high accuracy circuitry that incorporate op amp integrators.

Note this circuit needs testing to be sure the output triangle really looks acceptable. In theory this is perfect but in practice want to be sure it works right.



We could look at some waveforms if you like to help you decide.
 
Last edited:

atferrari

Joined Jan 6, 2004
4,764
Now for the ramp UP you need to go from -3.3v to +3.3v so the total difference is 6.6 volts. This means that dv=6.6, and 'i' is the input current, and dt is 1/2 cycle time for your wave which is 1/(30*2) seconds.
@MrAl Why the ramp should start at -3.3V? I expected it would start at 0V.
 

crutschow

Joined Mar 14, 2008
34,281
Another way to control the integrator output triangle DC offset is to add a second integrator with a long time constant that feeds back from the first integrator output to its plus input.
You connect the plus input of the slow integrator to 3.3V/2 = 1.65V which then adjusts its output so the average value of the first integrator output equals this voltage.
The minimizes the effect of op amp bias current, and the distortion of the bias resistor across the triangular integrator capacitor.

The time-constant of the second integrator should be at least 40 times the first integrator to minimize ripple in its DC output bias voltage.

Note that this can be done with single supply op amps.
 

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
Thanks Mr AI for getting so much involved with this problem.
The specification you mentioned i followed them and made a circuit, i am getting triangular wave but not in the range and the wave is kinda coming in a weird way. I have attached the pic circuit and the waveform, i would really appreciate if you can check this out and add some corrections if needed.
 

Attachments

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
Hello,

Given your op amp circuit the calculation of the values is fairly simple.

First, the input current is:
Iin=Vin/Rin

Then we can use one of the defining equations for the capacitor:
dv=i*dt/C

Now for the ramp UP you need to go from 0v to +3.3v so the total difference is 3.3 volts but we have to divide that by 2 to calculate the current because the triangle will be going up for 1/2 of the voltage and down for the other 1/2. This means that dv=3.3, but i=(3.3/2)/1000 the input current, and dt is 1/2 cycle time for your wave which is 1/(30*2) seconds.
The non inverting terminal also has to be biased to 3.3/2 volts, which is 1.65 volts.
So in other words, bias the non inverting terminal to 1.65v and use a cap value of:
1/132000 Farads.
You also need an input DC blocking capacitor of say 10uf to 100uf.

Does does make sense to you?

There is just one small catch. There is an ever present input offset that must be considered. It can be small but could lead to a large output offset in some cases. This means the input current is really:
Iin=(Vin+Voff)/Rin

where Voff is considered constant over short periods of time but somewhat variable over long periods of time. This means some way to compensate for this has to be incorporated into the design.

The usual method is to simply place a relatively large value resistor across the capacitor. This ruins the perfect linear ramp a small amount but is often acceptable.

If your Voff is say 5mv and the Rin is 1k then the current due to the input offset is 0.005/1000=5ua.
Doesnt seem like much, but it could lead to output saturation over time.
Placing a 100k resistor across the cap will keep the output offset to 0.5v and that may or may not be acceptable. If it is not acceptable then you should move toward a very low input offset op amp and then the input offset could be as low as 0.5ma meaning the output offset with the same setup would only be 500uv, usually acceptable.

As mentioned, the near perfect linear ramp without the parallel resistor is degraded somewhat by the inclusion of this parallel resistor so that has to be considered and a decision has to be made if this is acceptable or not. If it is not acceptable you could look for a lower input offset op amp or move to a automatic reset circuit that forces a zero output when it is really supposed to be zero, which is often used in high accuracy circuitry that incorporate op amp integrators.

Note this circuit needs testing to be sure the output triangle really looks acceptable. In theory this is perfect but in practice want to be sure it works right.



We could look at some waveforms if you like to help you decide.
Thanks Mr AI for getting so much involved with this problem.
The specification you mentioned i followed them and made a circuit, i am getting triangular wave but not in the range and the wave is kinda coming in a weird way. I have attached the pic circuit and the waveform, i would really appreciate if you can check this out and add some corrections if needed.
 

Attachments

crutschow

Joined Mar 14, 2008
34,281
You cannot have a capacitor in series with the op amp plus input, as there's no place for the input bias current to go.
That's likely what's causing the drift in the output level.
Connect the 1.65V bias voltage directly to the plus input.
 

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
You cannot have a capacitor in series with the op amp plus input, as there's no place for the input bias current to go.
That's likely what's causing the drift in the output level.
Connect the 1.65V bias voltage directly to the plus input.
yeah i did realize that later, I have changed that and getting this output with spike. Can you look into it?
 

Attachments

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
Wow Thanks alot, I have attached the file its coming like this.

can you please walk me through the calculation of how did you decide to get this mentioned values so that i will have a better understanding in future.
 

Attachments

Thread Starter

DeepThinker

Joined Nov 26, 2018
28
Is it a simulation or from your scope?
its just a Simualtaion now, Making sure everything goes fine here before going to hardware and testing in oscilloscope . I found that because of different opamps has different slew rates so spike are also larger or smaller in triangular waves. Can anyone tell me how to control these spikes?
 
Top