Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Op Amp and Transistor-Based Analog Square Wave Generator Design

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Op Amp and Transistor-based

Analog Square Wave Generator


Design
November 13, 2022 by Nicholas St. John

Analog oscillator circuits are commonly used to


create square wave clock signals for the timing of
synchronous circuits. This article covers the
theory, design, and key features of analog square
wave generators.
Many electronic systems require a timing mechanism. This is most often done
via a clock signal, which is a square wave of a specific frequency. For many
applications, the clock signal is generated within the system via a square wave
oscillator. However, this square wave signal can also be an input to the
system. 
Since many analog and digital circuits can be employed as square wave
oscillators, we'll aim to cover both types; however, in this article, we will
discuss the design of analog oscillators, cover their theory of operation, and
review their advantages and disadvantages.
 

Op-amp Square Wave Generator Using an


Astable Multivibrator
The first circuit we will study is a single op-amp circuit known as the astable
multivibrator, as shown in Figure 1.
 

Figure 1.  Single op-amp astable multivibrator oscillator for generating a square wave.

If you momentarily ignore the RC feedback from the output, V , to the OUT

negative input, V , you might recognize the rest of this circuit as a Schmitt
c

trigger with hysteresis. The Schmitt trigger has positive feedback and only two
stable operating points (V  = V  or V  = V ). As we will explain, the astable
OUT DD OUT SS

multivibrator configuration relies on this positive feedback and hysteresis.  

Upon startup of the circuit, we have a capacitor (C) completely discharged to


the ground. Since there is an internal offset between the inputs of any
amplifier, the positive feedback will ensure the output is driven to one of the
two stable states (depending on whether the internal offset is positive or
negative).

Now, let’s assume that V  is driven to the positive rail (V ) at the start. At this
OUT DD

point, V  will begin to charge through the resistor, R , and the voltage at V  can
c 3 p

be calculated using the resistor voltage divider equation:


 

V p 1 = V O UTR1R1 + R2 = VDDR1R1 + R2 ��1=�����1�1+�2=


����1�1+�2
 
From here, V  will continue to charge until it becomes slightly larger than the
c

threshold voltage at V . At this point, V  will pull down to the negative rail
p OUT

(V ), and V  will begin to discharge.


SS c

With the new value for V  equal to V , we also have a new threshold voltage:
OUT SS

V p 2 = V O UTR1R1 + R2 = V SS R1R1 + R2 ��2=�����1�1+


�2=����1�1+�2
 
Next, V  will continue to discharge until it becomes lower than the voltage at
c

V . Then, the output will be driven back to the positive supply rail, V . This
p DD

process will continue periodically, resulting in a square wave at the output of


the op-amp.
 

Op-amp Square Wave Simulation: Voltage Waveform


and Frequencies
For the circuit of Figure 1, let’s plug in some component values and simulation
performance:

 R  = R  = 10 kΩ 
1 2

 R  = 1 kΩ
3

 C = 1 uF
 V  = +5 V
DD

 V  = -5 V
SS

In Figure 2, we have plotted the voltage waveforms of V , V , and V . c OUT p

 
Figure 2.  Op-amp astable multivibrator square wave oscillator simulation. Top: VOUT  (green).
Bottom: Vc  (blue) and Vp  (red)

As we can see, V  charges and discharges to the trip points defined earlier by
c

the resistor voltage divider between R  and R  and the supply voltages. The


1 2

trip points, V  and V , are defined as:


high low

Vhi g h = V p 1 = 5(10 k10 k + 10 k) = 2.5 V �ℎ��ℎ=��1=5(10 k10 k+


10 k)=2.5 V
 

Vl ow = V p 2 = − 5(10 k10 k + 10 k) = − 2.5 V ����=��2=−5(10 k1


0 k+10 k)=−2.5 V
 

The frequency of the waveform in Figure 2 is 451 Hz. It is defined by the RC


time constant of R  and C in Figure 1 required to charge and discharge the
3

capacitor between V  and V . high low

To accurately calculate the frequency of the circuit in terms of the


components, we must utilize the charging/discharging equation of an RC
circuit. The general form of the charging equation is:
 

V(t) = V max+ (Vi n iti a l − V max ) e− t τ �(�)=����+


(��������−����)�−��
 
Solving for t in this equation, we obtain:

t = −τ ⋅ l n (V max− V(t)V max− Vi n iti a l) �=−�⋅��(����−�(�)�


���−��������)
 

Now, if we assume the time to charge from V to V , with V = V , and we


low   high max   DD

double the time to account for charge and discharge, we obtain the output
period:
 

T = 2t = − 2 τ ⋅ l n (VDD − V up VDD − Vl ow ) = − 2R C ⋅ l n (V

DD(1 − R1R1 + R2)VDD − V SS R1R1 + R2) �=2�=−2�⋅��(���−���


���−����)=−2��⋅��(���(1−�1�1+�2)���−����1�1+�
2)
 

This equation shows that the RC time constant dominates, while the values of
R  and R  have a weak relationship to the period because they change the trip
1 2

points to which the capacitor must charge and discharge. 

If we plug in the values of R , R , R , and C, we get a period of 455 Hz, which


1 2 3

matches nearly our frequency of 451 Hz from the simulation.

This circuit is simple, effective, and supports both low and high frequencies,
limited by the op-amp’s slew rate driving the output during the switching
events. The downside is that the output swing cannot be made smaller,
thereby setting a hard limit on the frequency as the output must swing from
rail to rail. 
To build this circuit with a single supply op-amp that swings from the ground
(0 V) to V , the ground nodes connected to the capacitor and resistor R  must
DD 1

be changed to a mid-range voltage—typically  VDD2 ���2.


 

Transistor-based Square Wave Oscillator Using


a BJT
An astable multivibrator can also be made with discrete transistors instead of
the op-amp. An example using bipolar junction transistors (BJTs) is illustrated
in Figure 3.

Figure 3.  BJT-based astable multivibrator for square wave generation.

 
Upon startup of this circuit, one transistor, let’s assume Q2, will go into the
“cut-off” region, where it conducts no current. This will cause the collector
node (top of Q2) to charge up to V .  DD

Meanwhile, Q1 will be saturated and thus conducting current. This will cause
the node of C  connected to the base of Q2 to charge up through R  until Q2
1 3
is pushed into saturation. Upon being pushed to saturation, the sharp voltage
drop on the right side of C  causes a heavy negative response at the base of
2

Q1, pushing it into cut-off.

This kind of push-pull behavior happens continuously, creating output voltage


waveforms on both collectors of Q1 and Q2. The outputs are square waves of
the same frequency but opposite phases. Since the bases of Q1 and Q2
charge/discharge via RC circuits of R  with C  and R  with C , respectively, we
3 1 2 2

can define the output period of the generator as:


 

T = t1 + t2 �=�1+�2
 

t1 = 0.69R3 C 1 �1=0.69�3�1
 

t2 = 0.69R2 C 2 �2=0.69�2�2
 

In the transient waveforms, t  is the pulse width of the output at collector Q1,
1

while t  is the pulse width at collector Q2. As one can see in the equations,
2

t  need not be equal to t , and thus we can create rectangular waveforms of


1 2

variable duty cycle. 

This behavior is demonstrated in the simulation results of Figure 4. For this


simulation, we have designed the circuit to have a 50% duty cycle with t  = t . 
1 2

 
Figure 4.  Bipolar transistor astable multivibrator output with symmetric outputs.

 
The components values for this simulation are:

 R  = R  = 1 kΩ
1 4

 R  = R  = 100 kΩ 
2 3

 C  = C  = 10 nF
1 2

The BJTs are standard 2N2222 NPNs. Therefore our expected time constants
from our basic equation are:
 

t1 = t2 = 0.69R C = 0.69(100 kΩ)(10 nF) = 690   μ


s �1=�2=0.69��=0.69(100 kΩ)(10 nF)=690 ��
 
The measured result from our simulation is 681 μs which is close to our design
value of 690 μs.
We can also change this design to have nonsymmetric performance. If we
halve the resistance of R  to 50 kΩ, we can change the period of t  to 345 us.
2 2

The simulation result for this circuit after the change is shown in Figure 5.
 

Figure 5.  Bipolar transistor astable multivibrator output with nonsymmetric outputs.

From Figure 5, we see the ability to create nonsymmetric output rectangular


waves with easily adjustable duty cycles. The simulation results are t  = 681 μs 1

and t  = 335 μs which is again close to those predicted by our design


2

equations. 

Overall, the BJT-based astable multivibrator has much more flexibility when
compared to the op-amp oscillator. While slightly more complex in structure,
it does not require a negative power supply and produces both the output
and its complement. It also gives the ability to form generic rectangular waves
of variable frequency and duty cycle instead of pure square waves of variable
frequency.

Review of Analog Square Wave Generator


Circuits
Analog implementations of square wave oscillators rely on feedback
mechanisms via RC charging/discharging that define the square wave
frequency. While not limited to pure square waves, as seen in the BJT version
of the astable multivibrator, both of these circuits allow for highly configurable
square waveforms to be generated via a simple circuit with no reference signal
required.

You might also like