 Good morning, everybody. I am Sachin Gengze, head of the electronics engineering department at Valchen Institute of Technology. In today's session, we are going to discuss about a very simple circuit which can be used to generate square and triangular wave. The learning outcome of this session include after completing this session, you student will able to explain a working of a very simple square and triangular wave generator which can be designed using operational amplifier. As we know a waveform generator is a circuit that generate repetitive waveforms of fixed amplitude and frequency. And we can design different types of the waveform which can generate sinusoidal signal or a square wave signal, a triangular wave signal, a sawtooth wave signal. In today's lecture, we are going to look at the circuit which can generate both square and triangular wave. Now the triangular wave generator can be very simply designed using two different circuits. The first one is a square wave generator. So, first I have to design a square wave generator and if I give the output of the square wave generator to integrator, the output of the integrator is a triangular wave. So, this circuit, if I pick up the signal at this point, I get a square wave. If I pick up a signal at this point, I get a triangular wave. So, this can generate, this kind of circuit can generate both the signal square wave and a triangular wave. Let us first have a look at a simple circuit where an op-amp can be used as a square wave generator. Let us assume, when I make the power supply on, the initial charge on the capacitor is zero. So, the capacitor is not charged. So, the voltage V2 is equal to zero. Meanwhile, there is some output offset voltage present which is feedback and then it is available as a non-inverting terminal as a V1. Let us assume that this output voltage is plus Vsat or this output voltage is plus Vsat. So, the voltage present at the V1 is equal to V1 is equal to plus Vsat into R1 divided by R1 plus R2 because of the voltage divider rule. So, what is the situation? Initially, I say that the V2 is equal to zero and V1 is equal to plus Vsat. V1 is equal to plus Vsat into R1 divided by R1 plus R2 and the output is equal to plus Vsat. Now, as the output is equal to plus Vsat, the capacitor C start through this resistor R, the capacitor C start charging towards the plus Vsat. So, the situation is V1 is a fixed positive voltage which is definitely less than plus Vsat because it is equal to plus Vsat into R1 divided by R1 plus R2. However, this voltage V2 is now rising towards plus Vsat. At one particular instant of time, please understand, this voltage is fixed which is equal to plus Vsat into R1 plus R1 divided by R1 plus R2 and this V2 is increasing from zero towards plus Vsat. At one instant of time, this V2 becomes greater than V1 and at that instant when the V2 is greater than V1, the output of the op-amp changes from minus Vsat to plus Vsat. So, now what is the situation? The output is equal to minus Vsat. Now, when the output is equal to minus Vsat, the V1 is equal to minus Vsat into R1 divided by R1 plus R2 which is a negative voltage. Now, what happened to the capacitor? As you can see, this output voltage is minus Vsat. The capacitor now starts charging towards minus Vsat through this resistor R. So, again the situation is V1 is a negative voltage which is equal to minus Vsat into R1 divided by R1 plus R2. V2 is now going towards minus Vsat. At one instant of time, the voltage V2 becomes less than V1 and when the voltage V2 falls below V1, the output of the op-amp again changing the state from minus Vsat to plus Vsat and then again this voltage becomes V1 is equal to plus Vsat into R1 divided by R1 plus R2 and the capacitor again start charging towards the plus Vsat and then this will continue. The output will switch between plus Vsat and minus Vsat from minus Vsat again to plus Vsat and then I get a square wave over here. So, if I look at this circuit, the output V0 is a square wave which is changing between plus Vsat and minus Vsat. So, if I look at the wave form, the output V0 as I say is changing between plus Vsat and minus Vsat and if I look at the wave form across the capacitor, this light is across the capacitor and then the voltage across the capacitor is that initially the capacitor start charging towards plus Vsat but when it reaches to V1, the output again becomes minus Vsat and then the capacitor start charging towards the minus Vsat when it becomes less than minus just below minus V1 then again output becomes plus Vsat and so on. So, if I look at the if I look at the wave form across the capacitor, I get this kind of wave form. So, here I consider the output as a square wave. Then the frequency of this square wave is given by F0 is equal to 1 upon 2 RC natural logarithm of 2 R1 plus R2 divided by R2 and if I substitute R2 is equal to 1.16 R1, I can reduce or I can simplify this equation F0 is equal to 1 upon 2 RC. Then the second circuit that we are going to look at is called as an op-amp as an integrator. Please understand the first circuit that we have discussed is op-amp as a square wave generator. We know that the output of the square wave generator if we give to that integrator then the output of the integrator is a triangular wave. So, the second circuit that we are going to discuss is nothing but op-amp as an integrator. Op-amp as an integrator can again be designed using a very simple components. One is an op-amp of course and the second is resistor and then I can use a capacitor in feedback loop of the op-amp and then this circuit becomes op-amp as an integrator. If we can derive the output of the op-amp as an integrator as V0 is equal to minus 1 upon R1 CF into integration 0 to T Vn with respect to T plus C. Now this C is nothing but the initial voltage which is present on the capacitor CF. Now if we look at this equation it tells that the output of an op-amp is nothing but the integration of input voltage with respect to time and this minus sign indicate that if the input is positive the output will be out of phase of that that is the output is going to be negative and vice versa. This minus R1 by CF is nothing but the proportionality constant I can consider that as a proportionality constant for this particular integration. So here if I apply a square wave to the input of the instead so in this circuit it is shown that it is a sinusoidal wave. Now instead of sinusoidal wave suppose I apply a square wave over here the output of the integrator is going to be a triangular wave but look at the polarity when the input is positive the output is negative going and even the input is negative the output is positive going. So the moral of the story is that when the input is a square wave the output is going to be a triangular wave. So here you can pause the video and answer the question if the input to the integrator circuit which is designed using an op-amp is a sinusoidal signal of 1 kilo hertz what is going to be the output of the circuit. So I think you are ready with the answer if this input is a sinusoidal signal the output is an integration of the sinusoidal signal over there which I can get. So with this circuit now we know that the op-amp can be used as an integrator. So now how I can combine these two circuit the first one is the op-amp as a square wave generator and then the output of you can see over here I can use this op-amp as a square wave generator and the frequency of that is given by 1 upon 2 RC then the output of the square wave generator can be given and to an integrator and the output of an integrator is nothing but a triangular wave. Of course the frequency of the square wave and the frequency of the triangular wave are going to be same which is given by 1 upon 2 RC. So this is a very simple circuit we can use only two op-amp and few other components like resistor and capacitor and can design a circuit which will give me the output as a square wave as well as a triangular wave. So the reference that we have used for this session is a very popular book operational amplifier and layer integrated circuit by Ramakan Kaikwa. So with that we stop over here thank you very much for joining this my session. Thank you once again.