Chapter 5 : Waveform Generator

example 5.1, Page No.186

In [4]:
# Astable multivibrator using IC555

import math
#Variable declaration
C = 0.01*10**-6              # capacitance
RA = 2*10**3                 # Resistance RA
RB = 100*10**3               # Resistance RB

#Calculations
T_high = 0.693*(RA+RB)*C
T_low = 0.693*RB*C
T= T_high+T_low
f = 1/T
D = T_high*100/T

#Result
print("Frequency of oscillations, f = %.1f Hz\nDuty cycle = %.1f%%"%(f,D))
Frequency of oscillations, f = 714.4 Hz
Duty cycle = 50.5%

example 5.2, Page No.186

In [13]:
# Astable multivibrator using IC555

import math
#Variable declaration
C = 1.0*10**-6               # capacitance 
C1 = 0.01*10**-6             # capacitance C1
RA = 4.7*10**3               # Resistance RA
RB = 1.0*10**3               # Resistance RB

#Calculations
Ton = 0.693*(RA+RB)*C
Toff = 0.693*RB*C
T= T_high+T_low
f = 1.4/((RA+2*RB)*C)
D = (RA+RB)*100/((RA+2*RB))

#Result
print("T_on = %.2f ms\nT_off = %.3f ms"%(Ton*1000,Toff*1000))
print("Frequency of oscillations, f = %.1f Hz\nDuty cycle = %.0f%%"%(math.floor(f*10)/10,D))
T_on = 3.95 ms
T_off = 0.693 ms
Frequency of oscillations, f = 208.9 Hz
Duty cycle = 85%

example 5.3, Page No. 187

In [1]:
# Astable multivibrator using IC555

import math
#Variable declaration
f = 1000.0               # frequency
d = 50.0/100.0           # duty cycle
C = 0.01*10**-6          # capacitance

#Calculations
T = 1/f
Ton = d*T
Toff = d*T
RA = 1.44/(2*f*C)

#Result
print("RA = RB = %.0f k-ohm"%(RA/1000))
RA = RB = 72 k-ohm

example 5.4, Page No. 187

In [6]:
# IC555 timer as an astable multivibrator

import math
# Variable declaration
f = 700.0                 # frequency
d = 0.5                   # duty cycle
C = 0.01*10**-6           # capacitor value assumed

#Calculations
Ra = 1.44/(2*f*C)

#Result
print("C  = %.2f micro-F\nRA = RB = %.0f k-ohm (100 k-ohm standard value)"%(C*10**6,Ra/1000))
C  = 0.01 micro-F
RA = RB = 103 k-ohm (100 k-ohm standard value)

example 5.5, Page No. 188

In [9]:
# IC555 timer as an astable multivibrator

import math
# Variable declaration
f = 800.0                 # frequency
d = 0.6                   # duty cycle
C = 0.01*10**-6           # capacitor value assumed

#Calculations
Ra = 1.44/(5*f*C)  # since Rb = 2Ra and f = 1.44/(Ra+2Rb)*C
Rb = 2*Ra


#Result
print("C  = %.2f micro-F\nRA = %.0f k-ohm\nRB = %.0f k-ohm"%(C*10**6,Ra/1000,Rb/1000))
C  = 0.01 micro-F
RA = 36 k-ohm
RB = 72 k-ohm

example 5.6, Page No. 189

In [13]:
# Timer design(refer fig. 5.11)

import math
# Variable declaration
Ton = 5.0         # On timing oof the timer

# Calculations
C = 10*10**-6     # assumed value
R = Ton/(1.1*C)

#Result
print("C = %.0f micro-F\nR = %.2f ohm"%(C*10**6,R))
C = 10 micro-F
R = 454545.45 ohm

example 5.7, Page No. 189

In [19]:
# Design of astable multivibrator(refer fig. 5.12)

import math
#Variable declaration
Ton  = 3.0             # ON time
Toff = 1.0             # OFF time

#Calculations
C = 10*10**-6          # Capacitor assumed value
R2 = Toff/(0.693*C)
R1 = (Ton/(0.693*C))-R2


#Result
print("C = %.0f micro-F\nR1 = %.0f ohm\nR2 = %.0f ohm"%(C*10**6,R1,R2))
C = 10 micro-F
R1 = 288600 ohm
R2 = 144300 ohm

example 5.8, Page No.190

In [13]:
# Monostable and astable mode of IC555

import math
#Variable declaration
Ton = 10*10**-3               # ON timing
C = 0.22*10**-6               # Capacitance
V = 1.4                       # LED voltage drop
I = 20*10**-3                 # current provided by circuit
f = 1000.0                    # frequency of astable multivibrator
d = 0.95                      # duty cycle of astable multivibrator


#calculations
R = Ton/(1.1*C)
R = math.ceil(R/100)/10
Vcc = 15.0                    # standard, assumed
Vbe = 0.7                     # standard, assumed
VECsat = 0.2                  # standard, assumed
Vo = Vcc -2*Vbe-VECsat
Rled = (Vo-V)/I

C1 = 0.01*10**-6              # capacitor for noise immunity
x = 1.44/(f*C1)               # x = R1+2*R2.......(i)
y = (1-d)/(d*2-1)             # y = R2/R1.........(ii)
y = math.floor(y*10**4)/10**4
R1 = x/(1+2*y)                # using (i) and (ii)
R2 = y*R1

#Result
print("For LED driving circuit:\nCapacitance = %.2f micro-F\nResistancce = %.1f ohm\nVo = %.1f V\nRled = %.0f ohm"%(C*10**6,R,Vo,Rled))
print("\nFor astable multivibrator:\nC = %.2f micro-F\nR1 = %.1f ohm\nR2 = %.2f ohm"%(C1*10**6,R1/1000,R2/1000))
For LED driving circuit:
Capacitance = 0.22 micro-F
Resistancce = 41.4 ohm
Vo = 13.4 V
Rled = 600 ohm

For astable multivibrator:
C = 0.01 micro-F
R1 = 129.6 ohm
R2 = 7.19 ohm

example 5.9, Page No. 191

In [15]:
# IC555 as a monostable multivibrator(refer fig. 5.15)

import math
#VAriable declaration
T = 5*10**-3                # output pulse width


#Calculations
C = 0.1*10**-6              # capacitance
R = T/(1.1*C)

#Result
print("R = %.2f k-ohm\nThe value of R should be less than 100 k-ohm, as obtained."%(R/1000))
R = 45.45 k-ohm
The value of R should be less than 100 k-ohm, as obtained.

example 5.10, Page No. 191

In [18]:
# IC555 based square wave generator

import math
#Variable declaration
f = 1000.0                 # required frequency
Vcc = 12.0                 # input voltage

#Calculations
T = 1/f
Td = T/2
C  = 0.1*10**-6           # assumed
R2 = Td/(0.69*C)

#Result
print("R2 = %.2f k-ohm\nR1 = 100 ohm + 10 k-ohm pot(With pot, precise squre wave can be obtained)"%(R2/1000))
R2 = 7.25 k-ohm
R1 = 100 ohm + 10 k-ohm pot(With pot, precise squre wave can be obtained)

example 5.11, Page No. 192

In [21]:
# Clock with 50% duty cycle

import math
# Variable declaration
f = 2000.0              # required output frequency 

#Calculations
T = 1/f
Td = T/2
C = 0.1*10**-6                 # assumed
R2 = Td/(0.69*C)

#Result
print("R1 = R2 = %.3f k-ohm"%(R2/1000))
R1 = R2 = 3.623 k-ohm

example 5.12, Page No.193

In [26]:
# Rectangular waveform using astable multivibrator

import math
# Variable declaration
T = 1.0*10**-3         # Total time period of output waveform
Ton = 0.6 *10**-3      # Ton time


#Calculations
D = Ton/T
x = (1-D)/(2*D-1)      # Rb/Ra
f = 1/T
C = 0.1*10**-6         # assumed
Ra = (1.44/(f*C))/5
Rb = x*Ra

#Result
print("C = %.2f micro-F\nRa = %.2f k-ohm\nRb = %.2f k-ohm"%(C*10**6,Ra/1000,Rb/1000))
C = 0.10 micro-F
Ra = 2.88 k-ohm
Rb = 5.76 k-ohm

example 5.13, Page No.195

In [34]:
# 555 timer in astable mode

import math
# Variable declaration
Ra = 4.0*10**3              # Resistance Ra
Rb = 4.0*10**3              # Resistance Rb
C = 0.01*10**-6           # Capacitance

#Calculations
f = 1.44/((Ra+2*Rb)*C)
D = (Ra+Rb)/(Ra+2*Rb)

#Result
print("frequency  = %.0f KHz\nDuty cycle = %.2f%%"%(f/1000,D*100))
frequency  = 12 KHz
Duty cycle = 66.67%

example 5.14, Page No. 195

In [37]:
# Timer design

import math
# Variable declaration
Ton = 5                 # ON time width

# Calculations
C = 10*10**-6           # assumed
R = Ton/(1.1*C)

#Result
print("R = %.2f k-ohm"%(R/1000))
R = 454.55 k-ohm

example 5.15, Page No.196

In [42]:
# Astable multivibrator

import math
#Variable declaration
f = 2000.0               # output frequency
D = 0.75                 # duty cycle


#Calculations
x = (1-D)/(2*D-1)        # Rb/Ra
C = 0.1 *10**-6          # assumed
Ra = (1.44/f)/(C*2)
Rb = x*Ra

#Result
print("C  = %.1f micro-F\nRa = %.1f k-ohm\nRb = %.1f k-ohm"%(C*10**6,Ra/1000,Rb/1000))
C  = 0.1 micro-F
Ra = 3.6 k-ohm
Rb = 1.8 k-ohm

example 5.16, Page No.197

In [10]:
# 555 as astable mode to generate square wave(refer fig.5.25)

import math
# Variable declarations
f = 1000.0                      # output square wave frequency
Vo = 5.0                        # output voltage
Ton = 0.5*10**-3                # ON time of suare wave
Toff= 0.5*10**-3                # OFF time of suare wave
Vl = 5.0                        # Lamp voltage rating
Il = 50*10**-3                  # lamp current rating

#Calculations
C = 0.1*10**-6                  # capacitance, assumed
Rb = Toff/(0.69*C)
Rb = Rb/1000.0                  #k-ohm
VLed = 0.7                      # voltage drop accross LED
R =(Vo-VLed)/(Il)
R = 100                         #standard value  
P = (Il**2)*R

# Result
print("duty cycle is 50%% hence,\nRa = Rb = %.3f k-ohm\nCurrent limiting Resistance for LED is, R = %.0f ohm\nP = %.2f W"%(Rb,R,P))
duty cycle is 50% hence,
Ra = Rb = 7.246 k-ohm
Current limiting Resistance for LED is, R = 100 ohm
P = 0.25 W

example 5.17, Page No. 199

In [16]:
# Ramp generator using IC555

import math
#Variable declaration
f = 5000.0                 # output frequency
Vcc = 5.0                  # input voltage


# Calculations
Vd = 0.7                   # = Vbe, assumed 
Ic = (Vcc-Vd)
RC = 3*Ic/(Vcc*f)
C = 0.05*10**-6            # assumed
R = RC/C
Ic = Ic/R

#Result
print("C = %.2f micro-F\nR = %.2f k-ohm\nIc = %.3f mA"%(C*10**6,R/1000,math.floor(Ic*10**6)/1000))
C = 0.05 micro-F
R = 10.32 k-ohm
Ic = 0.416 mA

example 5.18, Page No.205

In [22]:
# Triangular wave generator

import math
#Variable declaration
f = 5000.0                     # output frequency 
Vo = 10.5                      # output voltage
Vsat = 15                      # saturation voltage


#Calculations
x = 2*Vsat/Vo                   # R3/R2:: this value is wrong in the book
R2 = 10*10**3                   # assumed
R3 = 4*R2                       # calculationg using value given in book
C1 = 0.01*10**-6                # assumed
R1 = R3/(4*C1*R2*f)


#Result
print("C1 = %.2f micro-F\nR1 = %.0f k-ohm\nR2 = %.0f k-ohm\nR3 = %.0f k-ohm"%(C*10**6,R1/1000,R2/1000,R3/1000))
C1 = 0.05 micro-F
R1 = 20 k-ohm
R2 = 10 k-ohm
R3 = 40 k-ohm

exxample 5.19, Page No. 213

In [23]:
print("Theoretical example")
Theoretical example

exxample 5.20, Page No. 220

In [24]:
print("Theoretical example")
Theoretical example

exxample 5.21, Page No.221

In [31]:
# Oscillation frequency(refer fig 5.21)

import math
#Variable declaration
R = 5.1*10**3                     # resistance
C = 0.001*10**-6                  # capacitance
R3 = 6.0*10**3                      # Resistance of R3
R4 = 2.0*10**3                      # Resistance of R4

#Calculations
A = 1+(R3/R4)
f = 1/(2*math.pi*R*C)

#Result
print("A = %d\nAs A > 3, this satisfies the required oscillating condition. Hence, Circuit will work as oscillator.\n"%(A))
print("frequency of oscillations = %.4f kHz"%(f/1000))
A = 4
As A > 3, this satisfies the required oscillating condition. Hence, Circuit will work as oscillator.

frequency of oscillations = 31.2069 kHz

example 5.22, Page No. 221

In [35]:
# design of wein bridge oscillator(refer fig.5.58)

import math
# Variable declaration
f = 1000.0                 # frequency of oscillation
V = 15                     # supply voltage
g = 3                      # gain of non-inverting op-amp for  circuit to be oscillator 

#Calculations 
C = 0.05*10**-6            # assumed
R = 1/(2*math.pi*C*f)
R4 = 10*10**3              # assumed
R3 = (g-1)*R4

#Result
print("C1 = C2 = C = %.2f micro-F\nR1 = R2 = R = %.3f k-ohm\nR3 = %.0f k-ohm\nR4 = %.0f k-ohm"%(C*10**6,R/1000,R3/1000,R4/1000))
C1 = C2 = C = 0.05 micro-F
R1 = R2 = R = 3.183 k-ohm
R3 = 20 k-ohm
R4 = 10 k-ohm

example 5.23, Page No. 225

In [38]:
# output frequency range

import math
#Variable declararion
R = 10*10**3                          # Resistor R
C = 1.25*10**-9                       # Capacitance
Vut = 10.0                            # Upper threshold voltage
Vlt = 0.0                             # lower threshold voltage
Vmin = 10*10**-3                      # minimum voltage 
Vmax = 10                             # Maximum voltage 

#Calculations
Kv = 1/(8*R*C*(Vut-Vlt))
fmin = Vmin*Kv
fmax = Vmax*Kv

#Result
print("Range over whoich output frequency can be varied is %.0f Hz to %.0f KHz."%(fmin,fmax/1000))
Range over whoich output frequency can be varied is 10 Hz to 10 KHz.

example 5.24, Page No. 229

In [48]:
# output frequency(refer fig. 5.67 and 5.68)

import math
# Variable declaration
V = 10                   # supply voltage
R1 = 10*10**3            # Resistor R1
R2 = 1.2*10**3           # Resistor R2
R3 = 10*10**3            # Resistor R3
C1 = 0.001*10**-6        # Capacitance
Vc1 = 7.7                # Voltage at pin 5
Vc2 = 9.5                # Voltage at pin 5

#Calcualtions
# (a)
Vc = R3*V/(R2+R3)
Vc = math.floor(Vc*1000)/1000
fo = 2*(V-Vc)/(C1*R1*V) 
fo = fo/1000             # kHz
# (b)
fo1 = 2*(V-Vc1)/(C1*R1*V)
fo1 = fo1/1000
fo2 = 2*(V-Vc2)/(C1*R1*V)
fo2 = fo2/1000

#Result
print("(a)\nVc = %.3f V\nfo = %.2f kHz\n\n(b)\nfo1 = %.0f kHz\nfo2 = %.0f kHz\nChange in frequency is %.0f kHz"%(Vc,fo,fo1,fo2,fo1-fo2))
(a)
Vc = 8.928 V
fo = 21.44 kHz

(b)
fo1 = 46 kHz
fo2 = 10 kHz
Change in frequency is 36 kHz